test_069 Subroutine

subroutine test_069(id, nfail)

Uses

  • proc~~test_069~~UsesGraph proc~test_069 test_069 module~forcolormap forcolormap proc~test_069->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(...,name,zmin,zmax,reverse) should update metadata and reverse endpoints as requested.

Arguments

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

Calls

proc~~test_069~~CallsGraph proc~test_069 test_069 proc~create Colormap%create proc~test_069->proc~create proc~extract Colormap%extract proc~test_069->proc~extract proc~get_levels Colormap%get_levels proc~test_069->proc~get_levels proc~get_name Colormap%get_name proc~test_069->proc~get_name proc~get_rgb Colormap%get_RGB proc~test_069->proc~get_rgb proc~get_zmax Colormap%get_zmax proc~test_069->proc~get_zmax proc~get_zmin Colormap%get_zmin proc~test_069->proc~get_zmin proc~report_test report_test proc~test_069->proc~report_test 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 local local proc~extract->local proc~extract->proc~assign_map proc~extract->proc~check proc~extract->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_069~~CalledByGraph proc~test_069 test_069 program~check check program~check->proc~test_069

Source Code

   subroutine test_069(id, nfail)
      use forcolormap, only: Colormap, wp
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "extract(name,zmin,zmax,reverse) updates fields and reverses endpoints"
      logical :: ok
      type(Colormap) :: cm
      integer, dimension(0:6,3) :: test_colormap
      integer :: r, g, b
      character(len=:), allocatable :: s
      real(wp), parameter :: tol = 1.0e-12_wp

      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)

      ! For levels=7 and extractedLevels=3, the picked indices are 0,3,6.
      ! With reverse=.true., they become 6,3,0.
      call cm%extract(3, name="ex3", zmin=-1.0_wp, zmax=4.0_wp, reverse=.true.)

      s = trim(cm%get_name())
      ok = (index(s, "ex3") == 1) .and. (index(s, "_reverse") > 0) .and. &
         (abs(cm%get_zmin() - (-1.0_wp)) <= tol) .and. &
         (abs(cm%get_zmax() - ( 4.0_wp)) <= tol) .and. &
         (cm%get_levels() == 3)

      call cm%get_RGB(0, r, g, b)
      ok = ok .and. (r == test_colormap(6,1)) .and. (g == test_colormap(6,2)) .and. (b == test_colormap(6,3))

      call cm%get_RGB(2, r, g, b)
      ok = ok .and. (r == test_colormap(0,1)) .and. (g == test_colormap(0,2)) .and. (b == test_colormap(0,3))

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