version 0.5.0
keywords.f90
1 !This file is part of Notus 0.5.0
2 
3 !Copyright Bordeaux-INP, Universit√© de Bordeaux, CNRS
4 !
5 !Contributors:
6 !Antoine Lemoine, 25-09-2015, antoine.lemoine@bordeaux-inp.fr
7 
8 !This software is a computer program whose purpose is to simulate fluid flows.
9 
10 !This software is governed by the CeCILL license under French law and
11 !abiding by the rules of distribution of free software. You can use,
12 !modify and/ or redistribute the software under the terms of the CeCILL
13 !license as circulated by CEA, CNRS and INRIA at the following URL
14 !"http://www.cecill.info".
15 
16 !As a counterpart to the access to the source code and rights to copy,
17 !modify and redistribute granted by the license, users are provided only
18 !with a limited warranty and the software's author, the holder of the
19 !economic rights, and the successive licensors have only limited
20 !liability.
21 
22 !In this respect, the user's attention is drawn to the risks associated
23 !with loading, using, modifying and/or developing or reproducing the
24 !software by the user in light of its specific status of free software,
25 !that may mean that it is complicated to manipulate, and that also
26 !therefore means that it is reserved for developers and experienced
27 !professionals having in-depth computer knowledge. Users are therefore
28 !encouraged to load and test the software's suitability as regards their
29 !requirements in conditions enabling the security of their systems and/or
30 !data to be ensured and, more generally, to use and operate it in the
31 !same conditions as regards security.
32 
33 !The fact that you are presently reading this means that you have had
34 !knowledge of the CeCILL license and that you accept its terms.
35 
36 module mod_ui_keywords
37  use mod_lexer
38  implicit none
39 
40  enum, bind(c)
41  ! Related to variable declaration
42  enumerator :: kw_double = 1
43  enumerator :: kw_integer
44  enumerator :: kw_string
45  enumerator :: kw_boolean
46  enumerator :: kw_no_redefine
47  ! Numerical constants
48  enumerator :: kw_pi
49  enumerator :: kw_tau
50  ! Related to declaration
51  enumerator :: kw_abs
52  enumerator :: kw_acos
53  enumerator :: kw_acosh
54  enumerator :: kw_asin
55  enumerator :: kw_asinh
56  enumerator :: kw_atan
57  enumerator :: kw_atan2
58  enumerator :: kw_atanh
59  enumerator :: kw_ceil
60  enumerator :: kw_cos
61  enumerator :: kw_cosh
62  enumerator :: kw_erf
63  enumerator :: kw_erfc
64  enumerator :: kw_exp
65  enumerator :: kw_floor
66  enumerator :: kw_i2s
67  enumerator :: kw_log
68  enumerator :: kw_max
69  enumerator :: kw_min
70  enumerator :: kw_modulo
71  enumerator :: kw_pow
72  enumerator :: kw_sin
73  enumerator :: kw_sinh
74  enumerator :: kw_sqrt
75  enumerator :: kw_tan
76  enumerator :: kw_tanh
77  ! Control structure
78  enumerator :: kw_else
79  enumerator :: kw_exit
80  enumerator :: kw_if
81  enumerator :: kw_while
82  ! Input
83  enumerator :: kw_eval
84  enumerator :: kw_include
85  ! Output
86  enumerator :: kw_export
87  enumerator :: kw_print
88  ! Internal language
89  enumerator :: kw_at_boolean
90  enumerator :: kw_at_integer
91  enumerator :: kw_at_double
92  enumerator :: kw_at_else
93  enumerator :: kw_at_elseif
94  enumerator :: kw_at_exit
95  enumerator :: kw_at_if
96  enumerator :: kw_at_return
97  enumerator :: kw_at_while
98  ! Special function to query the shapes
99  enumerator :: kw_shape_get_distance
100  enumerator :: kw_shape_is_inside
101  enumerator :: kw_shape_ray_trace
102  enumerator :: kw_ray_get_distance
103  enumerator :: kw_ray_get_intersection
104  enumerator :: kw_ray_get_normal
105  ! Test case keywords
106  enumerator :: kw_tc_bubble_rise
107  enumerator :: kw_tc_channel_3d
108  enumerator :: kw_tc_backward_facing_step_axisymmetric
109  enumerator :: kw_tc_jet_buckling
110  enumerator :: kw_tc_lagrangian_particles
111  enumerator :: kw_tc_linear_system_test
112  enumerator :: kw_tc_plane_turbulent_channel
113  enumerator :: kw_tc_poiseuille_rayleigh_benard
114  enumerator :: kw_tc_poiseuille_viscosity
115  enumerator :: kw_tc_solitary_wave_periodic
116  enumerator :: kw_tc_solitary_wave_wall
117  enumerator :: kw_tc_standing_wave
118  enumerator :: kw_tc_species_transport
119  enumerator :: kw_tc_thermal_contact_resistance
120  ! Other keywords
121 #ifdef __GFORTRAN__
122 #define keyword(kwname) enumerator :: kw_/**/kwname
123 #else
124 #define keyword(kwname) enumerator :: kw_##kwname
125 #endif
126 #include "keywords.inc"
127 #undef keyword
128  enumerator :: kw_zzzzzzzzzzzz ! /!\ DO NOT REMOVE!!!
129  end enum
130 
131  type(t_keyword_name), dimension(kw_zzzzzzzzzzzz-1) :: ui_keywords
132 
133 contains
134 
135  subroutine ui_keyword_list_initialize()
136  use mod_convert_integer_to_string
137 
138  integer :: i
139 
140  ! List of keywords
141  ! ** Please keep it in alphabetical order **
142 
143  ! Related to variable declaration
144  ui_keywords(kw_double )%name = "double"
145  ui_keywords(kw_integer )%name = "integer"
146  ui_keywords(kw_string )%name = "string"
147  ui_keywords(kw_boolean )%name = "boolean"
148  ui_keywords(kw_no_redefine )%name = "no_redefine"
149  ! Numerical constants
150  ui_keywords(kw_pi )%name = "pi"
151  ui_keywords(kw_tau )%name = "tau"
152  ! Related to declaration
153  ui_keywords(kw_abs )%name = "abs"
154  ui_keywords(kw_acos )%name = "acos"
155  ui_keywords(kw_acosh )%name = "acosh"
156  ui_keywords(kw_asin )%name = "asin"
157  ui_keywords(kw_asinh )%name = "asinh"
158  ui_keywords(kw_atan )%name = "atan"
159  ui_keywords(kw_atan2 )%name = "atan2"
160  ui_keywords(kw_atanh )%name = "atanh"
161  ui_keywords(kw_ceil )%name = "ceil"
162  ui_keywords(kw_cos )%name = "cos"
163  ui_keywords(kw_cosh )%name = "cosh"
164  ui_keywords(kw_erf )%name = "erf"
165  ui_keywords(kw_erfc )%name = "erfc"
166  ui_keywords(kw_exp )%name = "exp"
167  ui_keywords(kw_floor )%name = "floor"
168  ui_keywords(kw_i2s )%name = "i2s"
169  ui_keywords(kw_log )%name = "log"
170  ui_keywords(kw_max )%name = "max"
171  ui_keywords(kw_min )%name = "min"
172  ui_keywords(kw_modulo )%name = "modulo"
173  ui_keywords(kw_pow )%name = "pow"
174  ui_keywords(kw_sin )%name = "sin"
175  ui_keywords(kw_sinh )%name = "sinh"
176  ui_keywords(kw_sqrt )%name = "sqrt"
177  ui_keywords(kw_tan )%name = "tan"
178  ui_keywords(kw_tanh )%name = "tanh"
179  ! Control structure
180  ui_keywords(kw_else )%name = "else"
181  ui_keywords(kw_exit )%name = "exit"
182  ui_keywords(kw_if )%name = "if"
183  ui_keywords(kw_while )%name = "while"
184  ! Input
185  ui_keywords(kw_eval )%name = "eval"
186  ui_keywords(kw_include )%name = "include"
187  ! Output
188  ui_keywords(kw_export )%name = "export"
189  ui_keywords(kw_print )%name = "print"
190  ! Internal language
191  ui_keywords(kw_at_boolean )%name = "@boolean"
192  ui_keywords(kw_at_integer )%name = "@integer"
193  ui_keywords(kw_at_double )%name = "@double"
194  ui_keywords(kw_at_elseif )%name = "@elseif"
195  ui_keywords(kw_at_else )%name = "@else"
196  ui_keywords(kw_at_exit )%name = "@exit"
197  ui_keywords(kw_at_if )%name = "@if"
198  ui_keywords(kw_at_return )%name = "@return"
199  ui_keywords(kw_at_while )%name = "@while"
200  ! Special function to query the shapes
201  ui_keywords(kw_shape_get_distance )%name = "shape_get_distance"
202  ui_keywords(kw_shape_is_inside )%name = "shape_is_inside"
203  ui_keywords(kw_shape_ray_trace )%name = "shape_ray_trace"
204  ui_keywords(kw_ray_get_distance )%name = "ray_get_distance"
205  ui_keywords(kw_ray_get_intersection )%name = "ray_get_intersection"
206  ui_keywords(kw_ray_get_normal )%name = "ray_get_normal"
207  ! Test case keywords
208  ui_keywords(kw_tc_bubble_rise )%name = "tc_bubble_rise"
209  ui_keywords(kw_tc_channel_3d )%name = "tc_channel_3d"
210  ui_keywords(kw_tc_backward_facing_step_axisymmetric)%name = "tc_backward_facing_step_axisymmetric"
211  ui_keywords(kw_tc_jet_buckling )%name = "tc_jet_buckling"
212  ui_keywords(kw_tc_lagrangian_particles )%name = "tc_lagrangian_particles"
213  ui_keywords(kw_tc_linear_system_test )%name = "tc_linear_system_test"
214  ui_keywords(kw_tc_plane_turbulent_channel )%name = "tc_plane_turbulent_channel"
215  ui_keywords(kw_tc_poiseuille_rayleigh_benard )%name = "tc_poiseuille_rayleigh_benard"
216  ui_keywords(kw_tc_poiseuille_viscosity )%name = "tc_poiseuille_viscosity"
217  ui_keywords(kw_tc_solitary_wave_periodic )%name = "tc_solitary_wave_periodic"
218  ui_keywords(kw_tc_solitary_wave_wall )%name = "tc_solitary_wave_wall"
219  ui_keywords(kw_tc_standing_wave )%name = "tc_standing_wave"
220  ui_keywords(kw_tc_species_transport )%name = "tc_species_transport"
221  ui_keywords(kw_tc_thermal_contact_resistance )%name = "tc_thermal_contact_resistance"
222  ! Other keywords
223 #ifdef __GFORTRAN__
224 #define keyword(kwname) ui_keywords(kw_/**/kwname)%name = "kwname"
225 #else
226 #define keyword(kwname) ui_keywords(kw_##kwname)%name = #kwname
227 #endif
228 #include "keywords.inc"
229 #undef keyword
230 
231  ! Sanity check: verify if all keywords are defined
232  do i = 1, size(ui_keywords)
233  if (.not. allocated(ui_keywords(i)%name)) then
234  call stop_notus("Keyword "//trim(convert_integer_to_string(i,1))//" undefined in keywords.f90")
235  end if
236  if (len_trim(ui_keywords(i)%name) == 0) then
237  call stop_notus("Keyword "//trim(convert_integer_to_string(i,1))//" has length 0 in keywords.f90")
238  end if
239  end do
240  end subroutine ui_keyword_list_initialize
241 
242  subroutine ui_keyword_list_finalize()
243  integer :: i
244 
245  do i = 1, size(ui_keywords)
246  if (allocated(ui_keywords(i)%name)) deallocate(ui_keywords(i)%name)
247  end do
248  end subroutine ui_keyword_list_finalize
249 
250 end module mod_ui_keywords
subroutine stop_notus(message)
Stop Notus execution printing a message.
Definition: stop_notus.f90:45
character(len=16) function convert_integer_to_string(i, length)
Convert an integer into a character string.