extract(...,name,zmin,zmax,reverse) should update metadata and reverse endpoints as requested.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
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