From 0fd60d477e4377c8036f48636f9c024df72d2508 Mon Sep 17 00:00:00 2001 From: vmagnin Date: Sat, 2 Mar 2024 19:09:28 +0100 Subject: [PATCH] Added comments about create methods --- example/demo.f90 | 6 ++++-- example/demo_reverse.f90 | 6 ++++-- src/colormap_class.f90 | 7 +++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/example/demo.f90 b/example/demo.f90 index 6c58794..a84dd5d 100644 --- a/example/demo.f90 +++ b/example/demo.f90 @@ -50,6 +50,7 @@ program demo shape(my_colormap), order = [2, 1] ) !> You can create your own colormap using that array. The name of your !> colormap must conform to the max length defined in colormap_parameters.f90 + !> Use the create() method instead of the set() method. call custom_cmap%create('red_cabbage', 0.0_wp, 2.0_wp, my_colormap) call custom_cmap%colorbar('red_cabbage_colorbar') call test_colormap(custom_cmap, 'red_cabbage_test') @@ -63,13 +64,14 @@ program demo print '("Colormap ", A30, " has ", I0, " levels")', trim(cmap%get_name()), cmap%get_levels() end do - ! Cubehelix can also accept other parameters (varargs array): + !> Cubehelix can also accept other parameters (varargs array): call cmap%set("cubehelix", 0.0_wp, 2.0_wp, 1024, [0.5_wp, -1.0_wp, 1.0_wp, 1.0_wp]) ! We change the name for the output test files: call cmap%colorbar('cubehelix_customized_colorbar') call test_colormap(cmap, 'cubehelix_customized_test') - ! Or you can download it from a .txt file: + !> Or you can download it from a .txt file. + !> Use the load() method instead of the set() method. call custom_cmap%load("test_map_to_load.txt", 0.0_wp, 2.0_wp) call custom_cmap%colorbar('a_loaded_colorbar') call test_colormap(custom_cmap, 'a_loaded_colormap_test') diff --git a/example/demo_reverse.f90 b/example/demo_reverse.f90 index b453761..089d15d 100644 --- a/example/demo_reverse.f90 +++ b/example/demo_reverse.f90 @@ -48,6 +48,7 @@ program demo_reverse shape(my_colormap), order = [2, 1] ) !> You can create your own colormap using that array. The name of your !> colormap must conform to the max length defined in colormap_parameters.f90 + !> Use the create() method instead of the set() method. call custom_cmap%create('red_cabbage_reverse', 0.0_wp, 2.0_wp, my_colormap, reverse=.true.) call custom_cmap%colorbar('red_cabbage_reverse_colorbar') call test_colormap(custom_cmap, 'red_cabbage_reverse_test') @@ -61,13 +62,14 @@ program demo_reverse print '("Colormap ", A30, " has ", I0, " levels")', trim(cmap%get_name()), cmap%get_levels() end do - ! Cubehelix can also accept other parameters (varargs array): + !> Cubehelix can also accept other parameters (varargs array): call cmap%set("cubehelix", 0.0_wp, 2.0_wp, 1024, [0.5_wp, -1.0_wp, 1.0_wp, 1.0_wp], reverse=.true.) ! We change the name for the output test files: call cmap%colorbar('cubehelix_customized_reverse_colorbar') call test_colormap(cmap, 'cubehelix_customized_reverse_test') - ! Or you can download it from a .txt file: + !> Or you can download it from a .txt file. + !> Use the load() method instead of the set() method. call custom_cmap%load("test_map_to_load.txt", 0.0_wp, 2.0_wp, reverse=.true.) call custom_cmap%colorbar('a_loaded_reverse_colorbar') call test_colormap(custom_cmap, 'a_loaded_reverse_colormap_test') diff --git a/src/colormap_class.f90 b/src/colormap_class.f90 index aa216de..75aabd9 100644 --- a/src/colormap_class.f90 +++ b/src/colormap_class.f90 @@ -586,7 +586,7 @@ pure subroutine set(self, name, zmin, zmax, levels, varargs, reverse) end if end subroutine set - ! You can create a custom colormap: + !> You can create a custom colormap from a "map" array. pure subroutine create(self, name, zmin, zmax, map, reverse) class(Colormap), intent(inout) :: self character(*), intent(in) :: name @@ -618,8 +618,7 @@ pure subroutine create(self, name, zmin, zmax, map, reverse) end if end subroutine - - ! You can create a custom colormap: + !> You can create a custom colormap using Lagrange interpolation: pure subroutine create_lagrange(self, name, zmin, zmax, colors, levels, reverse) class(Colormap), intent(inout) :: self character(*), intent(in) :: name @@ -652,7 +651,7 @@ pure subroutine create_lagrange(self, name, zmin, zmax, colors, levels, reverse) end if end subroutine - ! You can create a custom colormap: + !> You can create a custom colormap using Bezier interpolation: pure subroutine create_bezier(self, name, zmin, zmax, colors, levels, reverse) class(Colormap), intent(inout) :: self character(*), intent(in) :: name