test_045 Subroutine

subroutine test_045(id, nfail)

Uses

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

extract() should reduce levels while preserving the original endpoint colors.

Arguments

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

Calls

proc~~test_045~~CallsGraph proc~test_045 test_045 proc~extract Colormap%extract proc~test_045->proc~extract proc~get_levels Colormap%get_levels proc~test_045->proc~get_levels proc~get_rgb Colormap%get_RGB proc~test_045->proc~get_rgb proc~report_test report_test proc~test_045->proc~report_test proc~set Colormap%set proc~test_045->proc~set local local proc~extract->local proc~assign_map Colormap%assign_map proc~extract->proc~assign_map proc~check Colormap%check proc~extract->proc~check proc~reverse Colormap%reverse proc~extract->proc~reverse proc~set->proc~assign_map proc~set->proc~check proc~cubehelix_colormap cubehelix_colormap proc~set->proc~cubehelix_colormap proc~fire_colormap fire_colormap proc~set->proc~fire_colormap proc~inv_rainbow_colormap inv_rainbow_colormap proc~set->proc~inv_rainbow_colormap proc~rainbow_colormap rainbow_colormap proc~set->proc~rainbow_colormap proc~set->proc~reverse proc~zebra_colormap zebra_colormap proc~set->proc~zebra_colormap 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 proc~cubehelix_colormap->local

Called by

proc~~test_045~~CalledByGraph proc~test_045 test_045 program~check check program~check->proc~test_045

Source Code

   subroutine test_045(id, nfail)
      use forcolormap, only: Colormap, wp
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "Colormap%extract: levels reduced and endpoints preserved"
      logical :: ok
      type(Colormap) :: cm
      integer :: r0, g0, b0, r1, g1, b1
      integer :: rr0, gg0, bb0, rr1, gg1, bb1
      integer :: n0

      call cm%set("viridis", 0.0_wp, 1.0_wp)
      n0 = cm%get_levels()

      call cm%get_RGB(0,    r0, g0, b0)
      call cm%get_RGB(n0-1, r1, g1, b1)

      call cm%extract(8)

      call cm%get_RGB(0,                 rr0, gg0, bb0)
      call cm%get_RGB(cm%get_levels()-1, rr1, gg1, bb1)

      ok = (cm%get_levels() == 8) .and. &
         (rr0 == r0) .and. (gg0 == g0) .and. (bb0 == b0) .and. &
         (rr1 == r1) .and. (gg1 == g1) .and. (bb1 == b1)

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