rainbow_colormap Subroutine

public pure subroutine rainbow_colormap(map)

Arguments

Type IntentOptional Attributes Name
integer, intent(out), dimension(:,:), allocatable :: map

Called by

proc~~rainbow_colormap~~CalledByGraph proc~rainbow_colormap rainbow_colormap proc~set Colormap%set proc~set->proc~rainbow_colormap program~demo demo program~demo->proc~set program~demo_reverse demo_reverse program~demo_reverse->proc~set program~extract extract program~extract->proc~set program~modify modify program~modify->proc~set

Source Code

    pure subroutine rainbow_colormap(map)
        integer, dimension(:,:), allocatable, intent(out) :: map
        integer :: levels, last, i

        ! The user can not choose the number of levels:
        levels = 256
        last = levels - 1
        allocate(map(0:last, 1:3))
        ! We add three gaussians (red, green, blue):
        do concurrent (i = 0:last)
            map(i, 1) = nint(last * exp(-((206-i) / 70.0_wp)**2.0_wp))
            map(i, 2) = nint(last * exp(-((156-i) / 70.0_wp)**2.0_wp))
            map(i, 3) = nint(last * exp(-((106-i) / 70.0_wp)**2.0_wp))
        end do
    end subroutine rainbow_colormap