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
97 };
98 
99 static
100 #if defined(__INTEL_COMPILER) && defined(__EDG__)
101  const
102 #else
103  constexpr
104 #endif
105 std::string_view parser_f2_s[] =
106 {
107  "pow",
108  "atan2",
109  "gt",
110  "lt",
111  "geq",
112  "leq",
113  "eq",
114  "neq",
115  "and",
116  "or",
117  "heaviside",
118  "jn",
119  "min",
120  "max",
121  "fmod"
122 };
123 
124 enum parser_f3_t { // functions with three arguments
125  PARSER_IF
126 };
127 
128 static
129 #if defined(__INTEL_COMPILER) && defined(__EDG__)
130  const
131 #else
132  constexpr
133 #endif
134 std::string_view parser_f3_s[] =
135 {
136  "if"
137 };
138 
151 };
152 
153 static
154 #if defined(__INTEL_COMPILER) && defined(__EDG__)
155  const
156 #else
157  constexpr
158 #endif
159 std::string_view parser_node_s[] =
160 {
161  "number",
162  "symbol",
163  "add",
164  "sub",
165  "mul",
166  "div",
167  "f1",
168  "f2",
169  "f3",
170  "assign",
171  "list"
172 };
173 
174 /* In C, the address of the first member of a struct is the same as
175  * the address of the struct itself. Because of this, all struct parser_*
176  * pointers can be passed around as struct parser_node pointer and enum
177  * parser_node_t type can be safely checked to determine their real type.
178  */
179 
180 struct parser_node {
181  enum parser_node_t type;
182  enum parser_node_t padding;
183  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
184  struct parser_node* r;
186 };
187 
188 struct alignas(parser_node) parser_number {
189  enum parser_node_t type;
190  double value;
191 };
192 
193 struct alignas(parser_node) parser_symbol {
194  enum parser_node_t type;
195  char* name;
196  int ip;
197 };
198 
199 struct alignas(parser_node) parser_f1 { /* Builtin functions with one argument */
200  enum parser_node_t type;
201  enum parser_f1_t ftype;
202  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
204  struct parser_node* padding2;
205 };
206 
207 struct alignas(parser_node) parser_f2 { /* Builtin functions with two arguments */
208  enum parser_node_t type;
209  enum parser_f2_t ftype;
210  struct parser_node* l; // NOLINT(misc-confusable-identifiers)
211  struct parser_node* r;
212  struct parser_node* padding;
213 };
214 
215 struct alignas(parser_node) parser_f3 { /* Builtin functions with three arguments */
216  enum parser_node_t type;
217  enum parser_f3_t ftype;
218  struct parser_node* n1;
219  struct parser_node* n2;
220  struct parser_node* n3;
221 };
222 
223 struct alignas(parser_node) parser_assign {
224  enum parser_node_t type;
225  struct parser_symbol* s;
226  struct parser_node* v;
227 };
228 
229 static_assert(sizeof(parser_f3) <= sizeof(parser_node), "amrex parser: sizeof parser_node too small");
230 
231 /*******************************************************************/
232 
233 /* These functions are used in bison rules to generate the original AST. */
234 void parser_defexpr (struct parser_node* body);
235 struct parser_symbol* parser_makesymbol (char* name);
236 struct parser_node* parser_newnode (enum parser_node_t type, struct parser_node* l,
237  struct parser_node* r);
238 struct parser_node* parser_newneg (struct parser_node* n);
239 struct parser_node* parser_newnumber (double d);
240 struct parser_node* parser_newsymbol (struct parser_symbol* sym);
241 struct parser_node* parser_newf1 (enum parser_f1_t ftype, struct parser_node* l);
242 struct parser_node* parser_newf2 (enum parser_f2_t ftype, struct parser_node* l,
243  struct parser_node* r);
244 struct parser_node* parser_newf3 (enum parser_f3_t ftype, struct parser_node* n1,
245  struct parser_node* n2, struct parser_node* n3);
246 struct parser_node* parser_newassign (struct parser_symbol* s, struct parser_node* v);
247 struct parser_node* parser_newlist (struct parser_node* nl, struct parser_node* nr);
248 
249 /*******************************************************************/
250 
251 /* This is our struct for storing AST in a more packed way. The whole
252  * tree is stored in a contiguous chunk of memory starting from void*
253  * p_root with a size of sz_mempool.
254  */
255 struct amrex_parser {
256  void* p_root;
257  void* p_free;
258  struct parser_node* ast;
259  std::size_t sz_mempool;
260 };
261 
262 struct amrex_parser* amrex_parser_new ();
263 void amrex_parser_delete (struct amrex_parser* parser);
264 
265 struct amrex_parser* parser_dup (struct amrex_parser* source);
266 struct parser_node* parser_ast_dup (struct amrex_parser* parser, struct parser_node* node, int move);
267 
268 void parser_regvar (struct amrex_parser* parser, char const* name, int i);
269 void parser_setconst (struct amrex_parser* parser, char const* name, double c);
270 void parser_print (struct amrex_parser* parser);
271 std::set<std::string> parser_get_symbols (struct amrex_parser* parser);
272 int parser_depth (struct amrex_parser* parser);
273 
274 /* We need to walk the tree in these functions */
275 void parser_ast_optimize (struct parser_node* node);
276 std::size_t parser_ast_size (struct parser_node* node);
277 void parser_ast_print (struct parser_node* node, std::string const& space, std::ostream& printer);
278 void parser_ast_regvar (struct parser_node* node, char const* name, int i);
279 void parser_ast_setconst (struct parser_node* node, char const* name, double c);
280 void parser_ast_get_symbols (struct parser_node* node, std::set<std::string>& symbols,
281  std::set<std::string>& local_symbols);
282 int parser_ast_depth (struct parser_node* node);
283 void parser_ast_sort (struct parser_node* node);
284 
285 /*******************************************************************/
286 double parser_get_number (struct parser_node* node);
287 void parser_set_number (struct parser_node* node, double v);
288 bool parser_node_equal (struct parser_node* a, struct parser_node* b);
289 /*******************************************************************/
290 
291 template <typename T>
293 T parser_math_exp (T a) { return std::exp(a); }
294 
295 template <typename T>
297 T parser_math_log (T a) { return std::log(a); }
298 
299 template <typename T>
301 T parser_math_log10 (T a) { return std::log10(a); }
302 
303 template <typename T>
305 T parser_math_sin (T a) { return std::sin(a); }
306 
307 template <typename T>
309 T parser_math_cos (T a) { return std::cos(a); }
310 
311 template <typename T>
313 T parser_math_tan (T a) { return std::tan(a); }
314 
315 template <typename T>
317 T parser_math_asin (T a) { return std::asin(a); }
318 
319 template <typename T>
321 T parser_math_acos (T a) { return std::acos(a); }
322 
323 template <typename T>
325 T parser_math_atan (T a) { return std::atan(a); }
326 
327 template <typename T>
329 T parser_math_sinh (T a) { return std::sinh(a); }
330 
331 template <typename T>
333 T parser_math_cosh (T a) { return std::cosh(a); }
334 
335 template <typename T>
337 T parser_math_tanh (T a) { return std::tanh(a); }
338 
339 template <typename T>
341 T parser_math_asinh (T a) { return std::asinh(a); }
342 
343 template <typename T>
345 T parser_math_acosh (T a) { return std::acosh(a); }
346 
347 template <typename T>
349 T parser_math_atanh (T a) { return std::atanh(a); }
350 
351 template <typename T>
354 {
355 #if defined(__GNUC__) && !defined(__clang__) && !defined(__CUDA_ARCH__) && !defined(__NVCOMPILER)
356  return std::comp_ellint_1(k);
357 #else
358  return amrex::Math::comp_ellint_1<T>(k);
359 #endif
360 }
361 
362 template <typename T>
365 {
366 #if defined(__GNUC__) && !defined(__clang__) && !defined(__CUDA_ARCH__) && !defined(__NVCOMPILER)
367  return std::comp_ellint_2(k);
368 #else
369  return amrex::Math::comp_ellint_2<T>(k);
370 #endif
371 }
372 
373 template <typename T>
376 {
377  return std::erf(a);
378 }
379 
380 template <typename T>
382 T parser_math_pow (T a, T b) { return std::pow(a,b); }
383 
384 template <typename T>
386 T parser_math_atan2 (T a, T b) { return std::atan2(a,b); }
387 
388 template <typename T>
390 T parser_math_jn (int a, T b)
391 {
392 #if defined AMREX_USE_SYCL || defined __MINGW32__
394  // neither jn(f) nor std::cyl_bessel_j work yet
395  // https://github.com/oneapi-src/oneAPI-spec/issues/308
396  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, "parser: jn in SYCL not supported yet");
397  return 0.0;
398 #else
399  return jn(a, b);
400 #endif
401 }
402 
404 parser_call_f1 (enum parser_f1_t type, double a)
405 {
406  switch (type) {
407  case PARSER_SQRT: return std::sqrt(a);
408  case PARSER_EXP: return parser_math_exp<double>(a);
409  case PARSER_LOG: return parser_math_log<double>(a);
410  case PARSER_LOG10: return parser_math_log10<double>(a);
411  case PARSER_SIN: return parser_math_sin<double>(a);
412  case PARSER_COS: return parser_math_cos<double>(a);
413  case PARSER_TAN: return parser_math_tan<double>(a);
414  case PARSER_ASIN: return parser_math_asin<double>(a);
415  case PARSER_ACOS: return parser_math_acos<double>(a);
416  case PARSER_ATAN: return parser_math_atan<double>(a);
417  case PARSER_SINH: return parser_math_sinh<double>(a);
418  case PARSER_COSH: return parser_math_cosh<double>(a);
419  case PARSER_TANH: return parser_math_tanh<double>(a);
420  case PARSER_ASINH: return parser_math_asinh<double>(a);
421  case PARSER_ACOSH: return parser_math_acosh<double>(a);
422  case PARSER_ATANH: return parser_math_atanh<double>(a);
423  case PARSER_ABS: return std::abs(a);
424  case PARSER_FLOOR: return std::floor(a);
425  case PARSER_CEIL: return std::ceil(a);
426  case PARSER_COMP_ELLINT_1: return parser_math_comp_ellint_1<double>(a);
427  case PARSER_COMP_ELLINT_2: return parser_math_comp_ellint_2<double>(a);
428  case PARSER_ERF: return parser_math_erf<double>(a);
429  default:
430  amrex::Abort("parser_call_f1: Unknown function ");
431  return 0.0;
432  }
433 }
434 
436 parser_call_f2 (enum parser_f2_t type, double a, double b)
437 {
438  switch (type) {
439  case PARSER_POW:
440  return parser_math_pow<double>(a,b);
441  case PARSER_ATAN2:
442  return parser_math_atan2<double>(a,b);
443  case PARSER_GT:
444  return (a > b) ? 1.0 : 0.0;
445  case PARSER_LT:
446  return (a < b) ? 1.0 : 0.0;
447  case PARSER_GEQ:
448  return (a >= b) ? 1.0 : 0.0;
449  case PARSER_LEQ:
450  return (a <= b) ? 1.0 : 0.0;
451  case PARSER_EQ:
452  return (a == b) ? 1.0 : 0.0;
453  case PARSER_NEQ:
454  return (a != b) ? 1.0 : 0.0;
455  case PARSER_AND:
456  return ((a != 0.0) && (b != 0.0)) ? 1.0 : 0.0;
457  case PARSER_OR:
458  return ((a != 0.0) || (b != 0.0)) ? 1.0 : 0.0;
459  case PARSER_HEAVISIDE:
460  return (a < 0.0) ? 0.0 : ((a > 0.0) ? 1.0 : b);
461  case PARSER_JN:
462  return parser_math_jn<double>(int(a),b);
463  case PARSER_MIN:
464  return (a < b) ? a : b;
465  case PARSER_MAX:
466  return (a > b) ? a : b;
467  case PARSER_FMOD:
468  return std::fmod(a,b);
469  default:
470  amrex::Abort("parser_call_f2: Unknown function");
471  return 0.0;
472  }
473 }
474 
476 parser_call_f3 (enum parser_f3_t /*type*/, double a, double b, double c)
477 {
478  // There is only one type currently
479  return (a != 0.0) ? b : c;
480 }
481 
482 }
483 
484 #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_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:94
@ PARSER_GT
Definition: AMReX_Parser_Y.H:84
@ PARSER_MAX
Definition: AMReX_Parser_Y.H:95
@ PARSER_FMOD
Definition: AMReX_Parser_Y.H:96
@ 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:333
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_sinh(T a)
Definition: AMReX_Parser_Y.H:329
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_call_f1(enum parser_f1_t type, double a)
Definition: AMReX_Parser_Y.H:404
parser_f3_t
Definition: AMReX_Parser_Y.H:124
@ PARSER_IF
Definition: AMReX_Parser_Y.H:125
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atan(T a)
Definition: AMReX_Parser_Y.H:325
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:390
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:313
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:305
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:353
static constexpr std::string_view parser_f3_s[]
Definition: AMReX_Parser_Y.H:134
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:159
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_exp(T a)
Definition: AMReX_Parser_Y.H:293
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_asin(T a)
Definition: AMReX_Parser_Y.H:317
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:436
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T parser_math_comp_ellint_2(T k)
Definition: AMReX_Parser_Y.H:364
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_tanh(T a)
Definition: AMReX_Parser_Y.H:337
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:382
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:301
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:297
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:476
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atanh(T a)
Definition: AMReX_Parser_Y.H:349
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:341
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:139
@ PARSER_SYMBOL
Definition: AMReX_Parser_Y.H:141
@ PARSER_MUL
Definition: AMReX_Parser_Y.H:144
@ PARSER_SUB
Definition: AMReX_Parser_Y.H:143
@ PARSER_F1
Definition: AMReX_Parser_Y.H:146
@ PARSER_LIST
Definition: AMReX_Parser_Y.H:150
@ PARSER_DIV
Definition: AMReX_Parser_Y.H:145
@ PARSER_ADD
Definition: AMReX_Parser_Y.H:142
@ PARSER_ASSIGN
Definition: AMReX_Parser_Y.H:149
@ PARSER_F3
Definition: AMReX_Parser_Y.H:148
@ PARSER_NUMBER
Definition: AMReX_Parser_Y.H:140
@ PARSER_F2
Definition: AMReX_Parser_Y.H:147
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_erf(T a)
Definition: AMReX_Parser_Y.H:375
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_cos(T a)
Definition: AMReX_Parser_Y.H:309
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_acosh(T a)
Definition: AMReX_Parser_Y.H:345
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:105
AMREX_GPU_HOST_DEVICE AMREX_NO_INLINE T parser_math_atan2(T a, T b)
Definition: AMReX_Parser_Y.H:386
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:321
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:255
void * p_root
Definition: AMReX_Parser_Y.H:256
void * p_free
Definition: AMReX_Parser_Y.H:257
std::size_t sz_mempool
Definition: AMReX_Parser_Y.H:259
struct parser_node * ast
Definition: AMReX_Parser_Y.H:258
Definition: AMReX_Parser_Y.H:223
struct parser_node * v
Definition: AMReX_Parser_Y.H:226
struct parser_symbol * s
Definition: AMReX_Parser_Y.H:225
Definition: AMReX_Parser_Y.H:199
struct parser_node * padding1
Definition: AMReX_Parser_Y.H:203
struct parser_node * l
Definition: AMReX_Parser_Y.H:202
Definition: AMReX_Parser_Y.H:207
struct parser_node * l
Definition: AMReX_Parser_Y.H:210
struct parser_node * r
Definition: AMReX_Parser_Y.H:211
Definition: AMReX_Parser_Y.H:215
struct parser_node * n3
Definition: AMReX_Parser_Y.H:220
struct parser_node * n1
Definition: AMReX_Parser_Y.H:218
struct parser_node * n2
Definition: AMReX_Parser_Y.H:219
Definition: AMReX_Parser_Y.H:180
struct parser_node * l
Definition: AMReX_Parser_Y.H:183
struct parser_node * padding2
Definition: AMReX_Parser_Y.H:185
enum parser_node_t padding
Definition: AMReX_Parser_Y.H:182
struct parser_node * r
Definition: AMReX_Parser_Y.H:184
enum parser_node_t type
Definition: AMReX_Parser_Y.H:181
Definition: AMReX_Parser_Y.H:188
Definition: AMReX_Parser_Y.H:193
char * name
Definition: AMReX_Parser_Y.H:195