The Colormap class and the colormaps_list.
An interface for passing a 1D function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x |
An interface for passing a 2D function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x | |||
| real(kind=wp), | intent(in) | :: | y |
The Colormap class (attributes are encapsulated):
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | levels | ||||
| integer, | private, | allocatable | :: | map(:,:) | |||
| character(len=colormap_name_length), | private | :: | name | ||||
| logical, | private | :: | status(5) | = | .false. | ||
| real(kind=wp), | private | :: | zmax | ||||
| real(kind=wp), | private | :: | zmin |
| procedure, public :: blend | |
| procedure, public :: colorbar => write_ppm_colorbar | |
| procedure, public :: colorbar_ansi | |
| generic, public :: colormap => write_ppm_colormap_1d, write_ppm_colormap_2d | |
| procedure, public :: compute_RGB | |
| procedure, public :: create | |
| procedure, public :: create_bezier | |
| procedure, public :: create_lagrange | |
| procedure, public :: export_paraview_preset | |
| procedure, public :: extract | |
| procedure, public :: finalize | |
| procedure, public :: get_RGB | |
| procedure, public :: get_levels | |
| procedure, public :: get_name | |
| procedure, public :: get_zmax | |
| procedure, public :: get_zmin | |
| procedure, public :: load | |
| procedure, public :: print | |
| procedure, public :: print_status | |
| procedure, public :: reverse | |
| procedure, public :: set | |
| procedure, public :: shift | |
| procedure, private :: assign_map | |
| procedure, private :: check | |
| procedure, private :: write_ppm_colormap_1d | |
| procedure, private :: write_ppm_colormap_2d |
Returns the number of levels in the colormap
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self |
Returns the name of the colormap
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self |
Assign a colormap from a given "map" array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | map(:,:) |
Check the validity of the colormap and fix it if necessary
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| logical, | intent(in), | optional | :: | check_name | ||
| logical, | intent(in), | optional | :: | check_bounds | ||
| logical, | intent(in), | optional | :: | check_levels | ||
| logical, | intent(in), | optional | :: | check_extract | ||
| integer, | intent(in), | optional | :: | extractedLevels |
Preview the colormap in a truecolor ANSI terminal. Optional width controls how many color blocks are printed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | width |
Compute the RGB values for a z real value
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | z | |||
| integer, | intent(out) | :: | red | |||
| integer, | intent(out) | :: | green | |||
| integer, | intent(out) | :: | blue |
Create a custom colormap from a "map" array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | name | |||
| real(kind=wp), | intent(in) | :: | zmin | |||
| real(kind=wp), | intent(in) | :: | zmax | |||
| integer, | intent(in) | :: | map(:,:) | |||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Create a custom colormap using Bezier interpolation:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | name | |||
| real(kind=wp), | intent(in) | :: | zmin | |||
| real(kind=wp), | intent(in) | :: | zmax | |||
| integer, | intent(in) | :: | colors(:,:) | |||
| integer, | intent(in) | :: | levels | |||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Create a custom colormap using Lagrange interpolation:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | name | |||
| real(kind=wp), | intent(in) | :: | zmin | |||
| real(kind=wp), | intent(in) | :: | zmax | |||
| integer, | intent(in) | :: | colors(:,:) | |||
| integer, | intent(in) | :: | levels | |||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Export the colormap as a Paraview preset file (.json)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | filename |
Extracts colors from the colormap based on specified number of levels (extractedLevels).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | extractedLevels | |||
| character(len=*), | intent(in), | optional | :: | name | ||
| real(kind=wp), | intent(in), | optional | :: | zmin | ||
| real(kind=wp), | intent(in), | optional | :: | zmax | ||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Finalize the colormap, deallocating the map array and resetting status.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self |
Compute the RGB values directly from an integer level number
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | level | |||
| integer, | intent(out) | :: | red | |||
| integer, | intent(out) | :: | green | |||
| integer, | intent(out) | :: | blue |
Load a .txt colormap with RGB integers separated by spaces on each line. Remark: if no path is indicated in filename, the .txt must be present at the root of the fpm project of the user.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | filename | |||
| real(kind=wp), | intent(in) | :: | zmin | |||
| real(kind=wp), | intent(in) | :: | zmax | |||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Useful for testing and debugging:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self |
Print error and fix messages for unvalid colormaps
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self |
Reverse the colormap
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in), | optional | :: | name |
Choose a colormap and set its parameters
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | name | |||
| real(kind=wp), | intent(in) | :: | zmin | |||
| real(kind=wp), | intent(in) | :: | zmax | |||
| integer, | intent(in), | optional | :: | levels | ||
| real(kind=wp), | intent(in), | optional | :: | varargs(:) | ||
| logical, | intent(in), | optional | :: | reverse | ||
| logical, | intent(in), | optional | :: | sanitize |
Apply a circular shift to the colormap (left is +, right is -)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | sh |
The shift |
Writes the colorbar of the colormap in a PPM file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | filename | |||
| integer, | intent(in), | optional | :: | width | ||
| integer, | intent(in), | optional | :: | height | ||
| character(len=*), | intent(in), | optional | :: | encoding |
render a colormap defined by a 1D function into a PPM file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | filename | |||
| procedure(zf1d) | :: | zfun | ||||
| real(kind=wp), | intent(in) | :: | xmin | |||
| real(kind=wp), | intent(in) | :: | xmax | |||
| integer, | intent(in), | optional | :: | width | ||
| integer, | intent(in), | optional | :: | height | ||
| character(len=*), | intent(in), | optional | :: | encoding |
render a colormap defined by a 2D function into a PPM file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Colormap), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | filename | |||
| procedure(zf2d) | :: | zfun | ||||
| real(kind=wp), | intent(in) | :: | xmin(2) | |||
| real(kind=wp), | intent(in) | :: | xmax(2) | |||
| integer, | intent(in), | optional | :: | width | ||
| integer, | intent(in), | optional | :: | height | ||
| character(len=*), | intent(in), | optional | :: | encoding |