test_067 Subroutine

subroutine test_067(id, nfail)

Uses

  • proc~~test_067~~UsesGraph proc~test_067 test_067 module~forcolormap forcolormap proc~test_067->module~forcolormap module~forcolormap_cm_matplotlib forcolormap_cm_matplotlib module~forcolormap->module~forcolormap_cm_matplotlib module~forcolormap_cm_miscellaneous forcolormap_cm_miscellaneous module~forcolormap->module~forcolormap_cm_miscellaneous module~forcolormap_cm_scientific forcolormap_cm_scientific module~forcolormap->module~forcolormap_cm_scientific module~forcolormap_info forcolormap_info module~forcolormap->module~forcolormap_info module~forcolormap_parameters forcolormap_parameters module~forcolormap->module~forcolormap_parameters module~forcolormap_utils forcolormap_utils module~forcolormap->module~forcolormap_utils module~forcolormap_cm_matplotlib->module~forcolormap_parameters module~forcolormap_cm_miscellaneous->module~forcolormap_parameters module~forcolormap_cm_scientific->module~forcolormap_parameters module~forcolormap_info->module~forcolormap_cm_matplotlib module~forcolormap_info->module~forcolormap_cm_miscellaneous module~forcolormap_info->module~forcolormap_cm_scientific module~forcolormap_info->module~forcolormap_parameters iso_fortran_env iso_fortran_env module~forcolormap_parameters->iso_fortran_env module~forcolormap_utils->module~forcolormap_parameters

Large shifts should wrap modulo the number of levels (circular behavior).

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: id
integer, intent(inout) :: nfail

Calls

proc~~test_067~~CallsGraph proc~test_067 test_067 proc~create Colormap%create proc~test_067->proc~create proc~get_levels Colormap%get_levels proc~test_067->proc~get_levels proc~get_rgb Colormap%get_RGB proc~test_067->proc~get_rgb proc~report_test report_test proc~test_067->proc~report_test proc~shift Colormap%shift proc~test_067->proc~shift proc~assign_map Colormap%assign_map proc~create->proc~assign_map proc~check Colormap%check proc~create->proc~check proc~reverse Colormap%reverse proc~create->proc~reverse proc~find_index Colormaps_info%find_index proc~check->proc~find_index proc~get_levels~2 Colormaps_info%get_levels proc~check->proc~get_levels~2

Called by

proc~~test_067~~CalledByGraph proc~test_067 test_067 program~check check program~check->proc~test_067

Source Code

   subroutine test_067(id, nfail)
      use forcolormap, only: Colormap, wp
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "shift(100) == cshift(map, mod(100,levels)) for discrete map"
      logical :: ok
      type(Colormap) :: cm
      integer, dimension(0:6,3) :: test_colormap, ref
      integer :: sh, shmod
      integer :: i, r, g, b

      test_colormap = reshape([ &
         1, 2, 3, &
         4, 5, 6, &
         7, 8, 9, &
         0, 0, 0, &
         9, 8, 7, &
         6, 5, 4, &
         3, 2, 1 ], shape(test_colormap), order=[2,1])

      call cm%create("discrete", 0.0_wp, 2.0_wp, test_colormap)

      sh    = 100
      shmod = modulo(sh, cm%get_levels())
      ref   = cshift(test_colormap, shmod)

      call cm%shift(sh)

      ok = .true.
      do i = 0, cm%get_levels()-1
         call cm%get_RGB(i, r, g, b)
         ok = ok .and. (r == ref(i,1)) .and. (g == ref(i,2)) .and. (b == ref(i,3))
      end do

      call report_test(name, ok, id, nfail)
   end subroutine test_067