fire_colormap Subroutine

public pure subroutine fire_colormap(levels, map)

Arguments

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

Called by

proc~~fire_colormap~~CalledByGraph proc~fire_colormap fire_colormap proc~set Colormap%set proc~set->proc~fire_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 fire_colormap(levels, map)
        integer, intent(in) :: levels
        integer, dimension(:,:), allocatable, intent(out) :: map
        integer :: last, i

        ! Best with 256 levels but you can try other numbers:
        last = levels - 1
        allocate(map(0:last, 1:3))
        do concurrent (i = 0:last)
            map(i, 1) = nint(last * exp(-((last-i) / 200.0_wp)**7.0_wp))
            map(i, 2) = nint(last * exp(-((last-i) / 120.0_wp)**1.8_wp))
            map(i, 3) = nint(last * exp(-((last-i) /  40.0_wp)**0.7_wp))
        end do
    end subroutine fire_colormap