Block-Structured AMR Software Framework
AMReX_Parser_Y.H
Go to the documentation of this file.
1 #ifndef AMREX_PARSER_Y_H_
2 #define AMREX_PARSER_Y_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_GpuQualifiers.H>
6 #include <AMReX_GpuPrint.H>
7 #include <AMReX_Math.H>
8 #include <AMReX_Print.H>
9 #include <AMReX_REAL.H>
10 
11 #include <cstddef>
12 #include <cstdio>
13 #include <cstdlib>
14 #include <cstring>
15 #include <set>
16 #include <string>
17 #include <string_view>
18 #include <type_traits>
19 
20 void amrex_parsererror (char const *s, ...);
21 
22 namespace amrex {
23 
24 enum parser_f1_t { // Built-in functions with one argument
47 };
48 
49 static
50 #if defined(__INTEL_COMPILER) && defined(__EDG__)
51  const
52 #else
53  constexpr
54 #endif
55 std::string_view parser_f1_s[] =
56 {
57  "sqrt",
58  "exp",
59  "log",
60  "log10",
61  "sin",
62  "cos",
63  "tan",
64  "asin",
65  "acos",
66  "atan",
67  "sinh",
68  "cosh",
69  "tanh",
70  "asinh",
71  "acosh",
72  "atanh",
73  "abs",
74  "floor",
75  "ceil",
76  "comp_ellint_1",
77  "comp_ellint_2",
78  "erf"
79 };
80 
81 enum parser_f2_t { // Built-in functions with two arguments
98 };
99 
100 static
101 #if defined(__INTEL_COMPILER) && defined(__EDG__)
102  const
103 #else
104  constexpr
105 #endif
106 std::string_view parser_f2_s[] =
107 {
108  "pow",
109  "atan2",
110  "gt",
111  "lt",
112  "geq",
113  "leq",
114  "eq",
115  "neq",
116  "and",
117  "or",
118  "heaviside",
119  "jn",
120  "yn",
121  "min",
122  "max",
123  "fmod"
124 };
125 
126 enum parser_f3_t { // functions with three arguments
127  PARSER_IF
128 };
129 
130 static
131 #if defined(__INTEL_COMPILER) && defined(__EDG__)
132  const
133 #else
134  constexpr
135 #endif
136 std::string_view parser_f3_s[] =
137 {
138  "if"
139 };
140 
153 };
154 
155 static
156 #if defined(__INTEL_COMPILER) && defined(__EDG__)
157  const
158 #else
159  constexpr
160 #endif
161 std::string_view parser_node_s[] =
162 {
163  "number",
164  "symbol",
165  "add",
166  "sub",
167  "mul",
168  "div",
169  "f1",
170  "f2",
171  "f3",
172  "assign",
173  "list"
174 };
175 
176 /* In C, the address of the first member of a struct is the same as
177  * the address of the struct itself. Because of this, all struct parser_*
178  * pointers can be passed around as struct parser_node pointer and enum
179  * parser_node_t type can be safely checked to determine their real type.
180  */
181 
182 struct parser_node {
183  enum parser_node_t type;
184  enum parser_node_t padding;
185  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
186  struct parser_node* r;
188 };
189 
190 struct alignas(parser_node) parser_number {
191  enum parser_node_t type;
192  double value;
193 };
194 
195 struct alignas(parser_node) parser_symbol {
196  enum parser_node_t type;
197  char* name;
198  int ip;
199 };
200 
201 struct alignas(parser_node) parser_f1 { /* Builtin functions with one argument */
202  enum parser_node_t type;
203  enum parser_f1_t ftype;
204  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
206  struct parser_node* padding2;
207 };
208 
209 struct alignas(parser_node) parser_f2 { /* Builtin functions with two arguments */
210  enum parser_node_t type;
211  enum parser_f2_t ftype;
212  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
213  struct parser_node* r;
214  struct parser_node* padding;
215 };
216 
217 struct alignas(parser_node) parser_f3 { /* Builtin functions with three arguments */
218  enum parser_node_t type;
219  enum parser_f3_t ftype;
220  struct parser_node* n1;
221  struct parser_node* n2;
222  struct parser_node* n3;
223 };
224 
225 struct alignas(parser_node) parser_assign {
226  enum parser_node_t type;
227  struct parser_symbol* s;
228  struct parser_node* v;
229 };
230 
231 static_assert(sizeof(parser_f3) <= sizeof(parser_node), "amrex parser: sizeof parser_node too small");
232 
233 /*******************************************************************/
234 
235 /* These functions are used in bison rules to generate the original AST. */
236 void parser_defexpr (struct parser_node* body);
237 struct parser_symbol* parser_makesymbol (char* name);
238 struct parser_node* parser_newnode (enum parser_node_t type, struct parser_node* l,
239  struct parser_node* r);
240 struct parser_node* parser_newneg (struct parser_node* n);
241 struct parser_node* parser_newnumber (double d);
242 struct parser_node* parser_newsymbol (struct parser_symbol* sym);
243 struct parser_node* parser_newf1 (enum parser_f1_t ftype, struct parser_node* l);
244 struct parser_node* parser_newf2 (enum parser_f2_t ftype, struct parser_node* l,
245  struct parser_node* r);
246 struct parser_node* parser_newf3 (enum parser_f3_t ftype, struct parser_node* n1,
247  struct parser_node* n2, struct parser_node* n3);
248 struct parser_node* parser_newassign (struct parser_symbol* s, struct parser_node* v);
249 struct parser_node* parser_newlist (struct parser_node* nl, struct parser_node* nr);
250 
251 /*******************************************************************/
252 
253 /* This is our struct for storing AST in a more packed way. The whole
254  * tree is stored in a contiguous chunk of memory starting from void*
255  * p_root with a size of sz_mempool.
256  */
257 struct amrex_parser {
258  void* p_root;
259  void* p_free;
260  struct parser_node* ast;
261  std::size_t sz_mempool;
262 };
263 
264 struct amrex_parser* amrex_parser_new ();
265 void amrex_parser_delete (struct amrex_parser* parser);
266 
267 struct amrex_parser* parser_dup (struct amrex_parser* source);
268 struct parser_node* parser_ast_dup (struct amrex_parser* parser, struct parser_node* node, int move);
269 
270 void parser_regvar (struct amrex_parser* parser, char const* name, int i);
271 void parser_setconst (struct amrex_parser* parser, char const* name, double c);
272 void parser_print (struct amrex_parser* parser);
273 std::set<std::string> parser_get_symbols (struct amrex_parser* parser);
274 int parser_depth (struct amrex_parser* parser);
275 
276 /* We need to walk the tree in these functions */
277 void parser_ast_optimize (struct parser_node* node);
278 std::size_t parser_ast_size (struct parser_node* node);
279 void parser_ast_print (struct parser_node* node, std::string const& space, std::ostream& printer);
280 void parser_ast_regvar (struct parser_node* node, char const* name, int i);
281 void parser_ast_setconst (struct parser_node* node, char const* name, double c);
282 void parser_ast_get_symbols (struct parser_node* node, std::set<std::string>& symbols,
283  std::set<std::string>& local_symbols);
284 int parser_ast_depth (struct parser_node* node);
285 void parser_ast_sort (struct parser_node* node);
286 
287 /*******************************************************************/
288 double parser_get_number (struct parser_node* node);
289 void parser_set_number (struct parser_node* node, double v);
290 bool parser_node_equal (struct parser_node* a, struct parser_node* b);
291 /*******************************************************************/
292 
293 template <typename T>
295 T parser_math_exp (T a) { return std::exp(a); }
296 
297 template <typename T>
299 T parser_math_log (T a) { return std::log(a); }
300 
301 template <typename T>
303 T parser_math_log10 (T a) { return std::log10(a); }
304 
305 template <typename T>
307 T parser_math_sin (T a) { return std::sin(a); }
308 
309 template <typename T>
311 T parser_math_cos (T a) { return std::cos(a); }
312 
313 template <typename T>
315 T parser_math_tan (T a) { return std::tan(a); }
316 
317 template <typename T>
319 T parser_math_asin (T a) { return std::asin(a); }
320 
321 template <typename T>
323 T parser_math_acos (T a) { return std::acos(a); }
324 
325 template <typename T>
327 T parser_math_atan (T a) { return std::atan(a); }
328 
329 template <typename T>
331 T parser_math_sinh (T a) { return std::sinh(a); }
332 
333 template <typename T>
335 T parser_math_cosh (T a) { return std::cosh(a); }
336 
337 template <typename T>
339 T parser_math_tanh (T a) { return std::tanh(a); }
340 
341 template <typename T>
343 T parser_math_asinh (T a) { return std::asinh(a); }
344 
345 template <typename T>
347 T parser_math_acosh (T a) { return std::acosh(a); }
348 
349 template <typename T>
351 T parser_math_atanh (T a) { return std::atanh(a); }
352 
353 template <typename T>
356 {
357 #if defined(__GNUC__) && !defined(__clang__) && !defined(__CUDA_ARCH__) && !defined(__NVCOMPILER)
358  return std::comp_ellint_1(k);
359 #else
360  return amrex::Math::comp_ellint_1<T>(k);
361 #endif
362 }
363 
364 template <typename T>
367 {
368 #if defined(__GNUC__) && !defined(__clang__) && !defined(__CUDA_ARCH__) && !defined(__NVCOMPILER)
369  return std::comp_ellint_2(k);
370 #else
371  return amrex::Math::comp_ellint_2<T>(k);
372 #endif
373 }
374 
375 template <typename T>
378 {
379  return std::erf(a);
380 }
381 
382 template <typename T>
384 T parser_math_pow (T a, T b) { return std::pow(a,b); }
385 
386 template <typename T>
388 T parser_math_atan2 (T a, T b) { return std::atan2(a,b); }
389 
390 template <typename T>
392 T parser_math_jn (int a, T b)
393 {
394 #if defined AMREX_USE_SYCL || defined __MINGW32__
396  // neither jn(f) nor std::cyl_bessel_j work yet
397  // https://github.com/oneapi-src/oneAPI-spec/issues/308
398  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, "parser: jn in SYCL not supported yet");
399  return 0.0;
400 #else
401  return jn(a, b);
402 #endif
403 }
404 
405 template <typename T>
407 T parser_math_yn (int a, T b)
408 {
409 #if defined AMREX_USE_SYCL || defined __MINGW32__
411  // neither yn(f) nor std::cyl_bessel_y work yet
412  // https://github.com/oneapi-src/oneAPI-spec/issues/308
413  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, "parser: yn in SYCL not supported yet");
414  return 0.0;
415 #else
416  return yn(a, b);
417 #endif
418 }
419 
421 parser_call_f1 (enum parser_f1_t type, double a)
422 {
423  switch (type) {
424  case PARSER_SQRT: return std::sqrt(a);
425  case PARSER_EXP: return parser_math_exp<double>(a);
426  case PARSER_LOG: return parser_math_log<double>(a);
427  case PARSER_LOG10: return parser_math_log10<double>(a);
428  case PARSER_SIN: return parser_math_sin<double>(a);
429  case PARSER_COS: return parser_math_cos<double>(a);
430  case PARSER_TAN: return parser_math_tan<double>(a);
431  case PARSER_ASIN: return parser_math_asin<double>(a);
432  case PARSER_ACOS: return parser_math_acos<double>(a);
433  case PARSER_ATAN: return parser_math_atan<double>(a);
434  case PARSER_SINH: return parser_math_sinh<double>(a);
435  case PARSER_COSH: return parser_math_cosh<double>(a);
436  case PARSER_TANH: return parser_math_tanh<double>(a);
437  case PARSER_ASINH: return parser_math_asinh<double>(a);
438  case PARSER_ACOSH: return parser_math_acosh<double>(a);
439  case PARSER_ATANH: return parser_math_atanh<double>(a);
440  case PARSER_ABS: return std::abs(a);
441  case PARSER_FLOOR: return std::floor(a);
442  case PARSER_CEIL: return std::ceil(a);
443  case PARSER_COMP_ELLINT_1: return parser_math_comp_ellint_1<double>(a);
444  case PARSER_COMP_ELLINT_2: return parser_math_comp_ellint_2<double>(a);
445  case PARSER_ERF: return parser_math_erf<double>(a);
446  default:
447  amrex::Abort("parser_call_f1: Unknown function ");
448  return 0.0;
449  }
450 }
451 
453 parser_call_f2 (enum parser_f2_t type, double a, double b)
454 {
455  switch (type) {
456  case PARSER_POW:
457  return parser_math_pow<double>(a,b);
458  case PARSER_ATAN2:
459  return parser_math_atan2<double>(a,b);
460  case PARSER_GT:
461  return (a > b) ? 1.0 : 0.0;
462  case PARSER_LT:
463  return (a < b) ? 1.0 : 0.0;
464  case PARSER_GEQ:
465  return (a >= b) ? 1.0 : 0.0;
466  case PARSER_LEQ:
467  return (a <= b) ? 1.0 : 0.0;
468  case PARSER_EQ:
469  return (a == b) ? 1.0 : 0.0;
470  case PARSER_NEQ:
471  return (a != b) ? 1.0 : 0.0;
472  case PARSER_AND:
473  return ((a != 0.0) && (b != 0.0)) ? 1.0 : 0.0;
474  case PARSER_OR:
475  return ((a != 0.0) || (b != 0.0)) ? 1.0 : 0.0;
476  case PARSER_HEAVISIDE:
477  return (a < 0.0) ? 0.0 : ((a > 0.0) ? 1.0 : b);
478  case PARSER_JN:
479  return parser_math_jn<double>(int(a),b);
480  case PARSER_YN:
481  return parser_math_yn<double>(int(a),b);
482  case PARSER_MIN:
483  return (a < b) ? a : b;
484  case PARSER_MAX:
485  return (a > b) ? a : b;
486  case PARSER_FMOD:
487  return std::fmod(a,b);
488  default:
489  amrex::Abort("parser_call_f2: Unknown function");
490  return 0.0;
491  }
492 }
493 
495 parser_call_f3 (enum parser_f3_t /*type*/, double a, double b, double c)
496 {
497  // There is only one type currently
498  return (a != 0.0) ? b : c;
499 }
500 
501 }
502 
503 #endif
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition: AMReX_BLassert.H:49
#define AMREX_NO_INLINE
Definition: AMReX_Extension.H:136
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
void amrex_parsererror(char const *s,...)
Definition: AMReX_Parser_Y.cpp:10
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T comp_ellint_1(T k)
Definition: AMReX_Math.H:231
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T comp_ellint_2(T k)
Definition: AMReX_Math.H:256
Definition: AMReX_Amr.cpp:49
parser_f2_t
Definition: AMReX_Parser_Y.H:81
@ PARSER_LT
Definition: AMReX_Parser_Y.H:85
@ PARSER_AND
Definition: AMReX_Parser_Y.H:90
@ PARSER_NEQ
Definition: AMReX_Parser_Y.H:89
@ PARSER_OR
Definition: AMReX_Parser_Y.H:91
@ PARSER_ATAN2
Definition: AMReX_Parser_Y.H:83
@ PARSER_LEQ
Definition: AMReX_Parser_Y.H:87
@ PARSER_YN
Definition: AMReX_Parser_Y.H:94
@ PARSER_GEQ
Definition: AMReX_Parser_Y.H:86
@ PARSER_POW
Definition: AMReX_Parser_Y.H:82
@ PARSER_JN
Definition: AMReX_Parser_Y.H:93
@ PARSER_MIN
Definition: AMReX_Parser_Y.H:95
@ PARSER_GT
Definition: AMReX_Parser_Y.H:84
@ PARSER_MAX
Definition: AMReX_Parser_Y.H:96
@ PARSER_FMOD
Definition: AMReX_Parser_Y.H:97
@ PARSER_HEAVISIDE
Definition: AMReX_Parser_Y.H:92
@ PARSER_EQ
Definition: AMReX_Parser_Y.H:88
void parser_set_number(struct parser_node *node, double v)
Definition: AMReX_Parser_Y.cpp:1665
struct parser_node * parser_newf2(enum parser_f2_t ftype, struct parser_node *l, struct parser_node *r)
Definition: AMReX_Parser_Y.cpp:99
void parser_regvar(struct amrex_parser *parser, char const *name, int i)
Definition: AMReX_Parser_Y.cpp:1619
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_cosh(T a)
Definition: AMReX_Parser_Y.H:335
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_sinh(T a)
Definition: AMReX_Parser_Y.H:331
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_yn(int a, T b)
Definition: AMReX_Parser_Y.H:407
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_call_f1(enum parser_f1_t type, double a)
Definition: AMReX_Parser_Y.H:421
parser_f3_t
Definition: AMReX_Parser_Y.H:126
@ PARSER_IF
Definition: AMReX_Parser_Y.H:127
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atan(T a)
Definition: AMReX_Parser_Y.H:327
void amrex_parser_delete(struct amrex_parser *parser)
Definition: AMReX_Parser_Y.cpp:170
void parser_ast_sort(struct parser_node *node)
Definition: AMReX_Parser_Y.cpp:1456
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > log(const GpuComplex< T > &a_z) noexcept
Complex natural logarithm function.
Definition: AMReX_GpuComplex.H:408
parser_f1_t
Definition: AMReX_Parser_Y.H:24
@ PARSER_ASINH
Definition: AMReX_Parser_Y.H:38
@ PARSER_TANH
Definition: AMReX_Parser_Y.H:37
@ PARSER_COS
Definition: AMReX_Parser_Y.H:30
@ PARSER_COSH
Definition: AMReX_Parser_Y.H:36
@ PARSER_COMP_ELLINT_1
Definition: AMReX_Parser_Y.H:44
@ PARSER_SQRT
Definition: AMReX_Parser_Y.H:25
@ PARSER_COMP_ELLINT_2
Definition: AMReX_Parser_Y.H:45
@ PARSER_TAN
Definition: AMReX_Parser_Y.H:31
@ PARSER_ACOS
Definition: AMReX_Parser_Y.H:33
@ PARSER_ATANH
Definition: AMReX_Parser_Y.H:40
@ PARSER_EXP
Definition: AMReX_Parser_Y.H:26
@ PARSER_LOG
Definition: AMReX_Parser_Y.H:27
@ PARSER_SIN
Definition: AMReX_Parser_Y.H:29
@ PARSER_ERF
Definition: AMReX_Parser_Y.H:46
@ PARSER_ASIN
Definition: AMReX_Parser_Y.H:32
@ PARSER_CEIL
Definition: AMReX_Parser_Y.H:43
@ PARSER_ATAN
Definition: AMReX_Parser_Y.H:34
@ PARSER_ABS
Definition: AMReX_Parser_Y.H:41
@ PARSER_ACOSH
Definition: AMReX_Parser_Y.H:39
@ PARSER_LOG10
Definition: AMReX_Parser_Y.H:28
@ PARSER_FLOOR
Definition: AMReX_Parser_Y.H:42
@ PARSER_SINH
Definition: AMReX_Parser_Y.H:35
void parser_setconst(struct amrex_parser *parser, char const *name, double c)
Definition: AMReX_Parser_Y.cpp:1625
void parser_ast_setconst(struct parser_node *node, char const *name, double c)
Definition: AMReX_Parser_Y.cpp:1539
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_jn(int a, T b)
Definition: AMReX_Parser_Y.H:392
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition: AMReX_GpuComplex.H:356
int parser_depth(struct amrex_parser *parser)
Definition: AMReX_Parser_Y.cpp:1654
void parser_print(struct amrex_parser *parser)
Definition: AMReX_Parser_Y.cpp:1633
struct parser_node * parser_newnode(enum parser_node_t type, struct parser_node *l, struct parser_node *r)
Definition: AMReX_Parser_Y.cpp:46
struct parser_node * parser_newneg(struct parser_node *n)
Definition: AMReX_Parser_Y.cpp:62
void parser_ast_optimize(struct parser_node *node)
Definition: AMReX_Parser_Y.cpp:678
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_tan(T a)
Definition: AMReX_Parser_Y.H:315
struct parser_node * parser_newassign(struct parser_symbol *sym, struct parser_node *v)
Definition: AMReX_Parser_Y.cpp:123
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_sin(T a)
Definition: AMReX_Parser_Y.H:307
struct parser_node * parser_newf3(enum parser_f3_t ftype, struct parser_node *n1, struct parser_node *n2, struct parser_node *n3)
Definition: AMReX_Parser_Y.cpp:110
int parser_ast_depth(struct parser_node *node)
Definition: AMReX_Parser_Y.cpp:1413
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T parser_math_comp_ellint_1(T k)
Definition: AMReX_Parser_Y.H:355
static constexpr std::string_view parser_f3_s[]
Definition: AMReX_Parser_Y.H:136
std::size_t parser_ast_size(struct parser_node *node)
Definition: AMReX_Parser_Y.cpp:211
void parser_ast_print(struct parser_node *node, std::string const &space, std::ostream &printer)
Definition: AMReX_Parser_Y.cpp:1371
static constexpr std::string_view parser_node_s[]
Definition: AMReX_Parser_Y.H:161
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_exp(T a)
Definition: AMReX_Parser_Y.H:295
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_asin(T a)
Definition: AMReX_Parser_Y.H:319
double parser_get_number(struct parser_node *node)
Definition: AMReX_Parser_Y.cpp:1659
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: AMReX.H:111
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_call_f2(enum parser_f2_t type, double a, double b)
Definition: AMReX_Parser_Y.H:453
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T parser_math_comp_ellint_2(T k)
Definition: AMReX_Parser_Y.H:366
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_tanh(T a)
Definition: AMReX_Parser_Y.H:339
std::set< std::string > parser_get_symbols(struct amrex_parser *parser)
Definition: AMReX_Parser_Y.cpp:1642
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_pow(T a, T b)
Definition: AMReX_Parser_Y.H:384
bool parser_node_equal(struct parser_node *a, struct parser_node *b)
Definition: AMReX_Parser_Y.cpp:636
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_log10(T a)
Definition: AMReX_Parser_Y.H:303
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > pow(const GpuComplex< T > &a_z, const T &a_y) noexcept
Raise a complex number to a (real) power.
Definition: AMReX_GpuComplex.H:418
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_log(T a)
Definition: AMReX_Parser_Y.H:299
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_call_f3(enum parser_f3_t, double a, double b, double c)
Definition: AMReX_Parser_Y.H:495
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atanh(T a)
Definition: AMReX_Parser_Y.H:351
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
struct parser_node * parser_ast_dup(struct amrex_parser *my_parser, struct parser_node *node, int move)
Definition: AMReX_Parser_Y.cpp:260
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_asinh(T a)
Definition: AMReX_Parser_Y.H:343
void parser_defexpr(struct parser_node *body)
Definition: AMReX_Parser_Y.cpp:28
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > exp(const GpuComplex< T > &a_z) noexcept
Complex expotential function.
Definition: AMReX_GpuComplex.H:334
struct parser_node * parser_newsymbol(struct parser_symbol *symbol)
Definition: AMReX_Parser_Y.cpp:83
parser_node_t
Definition: AMReX_Parser_Y.H:141
@ PARSER_SYMBOL
Definition: AMReX_Parser_Y.H:143
@ PARSER_MUL
Definition: AMReX_Parser_Y.H:146
@ PARSER_SUB
Definition: AMReX_Parser_Y.H:145
@ PARSER_F1
Definition: AMReX_Parser_Y.H:148
@ PARSER_LIST
Definition: AMReX_Parser_Y.H:152
@ PARSER_DIV
Definition: AMReX_Parser_Y.H:147
@ PARSER_ADD
Definition: AMReX_Parser_Y.H:144
@ PARSER_ASSIGN
Definition: AMReX_Parser_Y.H:151
@ PARSER_F3
Definition: AMReX_Parser_Y.H:150
@ PARSER_NUMBER
Definition: AMReX_Parser_Y.H:142
@ PARSER_F2
Definition: AMReX_Parser_Y.H:149
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_erf(T a)
Definition: AMReX_Parser_Y.H:377
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_cos(T a)
Definition: AMReX_Parser_Y.H:311
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_acosh(T a)
Definition: AMReX_Parser_Y.H:347
void parser_ast_get_symbols(struct parser_node *node, std::set< std::string > &symbols, std::set< std::string > &local_symbols)
Definition: AMReX_Parser_Y.cpp:1579
struct parser_symbol * parser_makesymbol(char *name)
Definition: AMReX_Parser_Y.cpp:34
static constexpr std::string_view parser_f2_s[]
Definition: AMReX_Parser_Y.H:106
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atan2(T a, T b)
Definition: AMReX_Parser_Y.H:388
struct amrex_parser * amrex_parser_new()
Definition: AMReX_Parser_Y.cpp:149
static constexpr std::string_view parser_f1_s[]
Definition: AMReX_Parser_Y.H:55
void parser_ast_regvar(struct parser_node *node, char const *name, int i)
Definition: AMReX_Parser_Y.cpp:1500
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_acos(T a)
Definition: AMReX_Parser_Y.H:323
struct amrex_parser * parser_dup(struct amrex_parser *source)
Definition: AMReX_Parser_Y.cpp:198
struct parser_node * parser_newnumber(double d)
Definition: AMReX_Parser_Y.cpp:72
struct parser_node * parser_newf1(enum parser_f1_t ftype, struct parser_node *l)
Definition: AMReX_Parser_Y.cpp:89
struct parser_node * parser_newlist(struct parser_node *nl, struct parser_node *nr)
Definition: AMReX_Parser_Y.cpp:133
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
Return the square root of a complex number.
Definition: AMReX_GpuComplex.H:373
Definition: AMReX_Parser_Y.H:257
void * p_root
Definition: AMReX_Parser_Y.H:258
void * p_free
Definition: AMReX_Parser_Y.H:259
std::size_t sz_mempool
Definition: AMReX_Parser_Y.H:261
struct parser_node * ast
Definition: AMReX_Parser_Y.H:260
Definition: AMReX_Parser_Y.H:225
struct parser_node * v
Definition: AMReX_Parser_Y.H:228
struct parser_symbol * s
Definition: AMReX_Parser_Y.H:227
Definition: AMReX_Parser_Y.H:201
struct parser_node * padding1
Definition: AMReX_Parser_Y.H:205
struct parser_node * l
Definition: AMReX_Parser_Y.H:204
Definition: AMReX_Parser_Y.H:209
struct parser_node * l
Definition: AMReX_Parser_Y.H:212
struct parser_node * r
Definition: AMReX_Parser_Y.H:213
Definition: AMReX_Parser_Y.H:217
struct parser_node * n3
Definition: AMReX_Parser_Y.H:222
struct parser_node * n1
Definition: AMReX_Parser_Y.H:220
struct parser_node * n2
Definition: AMReX_Parser_Y.H:221
Definition: AMReX_Parser_Y.H:182
struct parser_node * l
Definition: AMReX_Parser_Y.H:185
struct parser_node * padding2
Definition: AMReX_Parser_Y.H:187
enum parser_node_t padding
Definition: AMReX_Parser_Y.H:184
struct parser_node * r
Definition: AMReX_Parser_Y.H:186
enum parser_node_t type
Definition: AMReX_Parser_Y.H:183
Definition: AMReX_Parser_Y.H:190
Definition: AMReX_Parser_Y.H:195
char * name
Definition: AMReX_Parser_Y.H:197