test_053 Subroutine

subroutine test_053(id, nfail)

Uses

  • proc~~test_053~~UsesGraph proc~test_053 test_053 module~forcolormap forcolormap proc~test_053->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

compute_RGB() should pick the expected discrete index for representative z values.

Arguments

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

Calls

proc~~test_053~~CallsGraph proc~test_053 test_053 proc~compute_rgb Colormap%compute_RGB proc~test_053->proc~compute_rgb proc~create Colormap%create proc~test_053->proc~create proc~report_test report_test proc~test_053->proc~report_test proc~get_rgb Colormap%get_RGB proc~compute_rgb->proc~get_rgb 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_053~~CalledByGraph proc~test_053 test_053 program~check check program~check->proc~test_053

Source Code

   subroutine test_053(id, nfail)
      use forcolormap, only: Colormap, wp
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "compute_RGB on discrete z=0,1.1,2 hits expected"
      logical :: ok
      type(Colormap) :: cmap
      integer :: red, green, blue
      integer, dimension(0:6, 3) :: test_colormap

      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 cmap%create("discrete", 0.0_wp, 2.0_wp, test_colormap)

      call cmap%compute_RGB(0.0_wp, red, green, blue)
      ok = (red == test_colormap(0,1)) .and. (green == test_colormap(0,2)) .and. (blue == test_colormap(0,3))

      call cmap%compute_RGB(1.1_wp, red, green, blue)
      ok = ok .and. (red == test_colormap(3,1)) .and. (green == test_colormap(3,2)) .and. (blue == test_colormap(3,3))

      call cmap%compute_RGB(2.0_wp, red, green, blue)
      ok = ok .and. (red == test_colormap(6,1)) .and. (green == test_colormap(6,2)) .and. (blue == test_colormap(6,3))

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