1 #ifndef AMREX_IPARSER_Y_H_
2 #define AMREX_IPARSER_Y_H_
3 #include <AMReX_Config.H>
16 #include <type_traits>
128 static_assert(
sizeof(
iparser_f3) <=
sizeof(
iparser_node),
"amrex iparser: sizeof iparser_node too small");
179 std::set<std::string>& local_symbols);
198 if (
r*
b == a || (a < 0 &&
b < 0) || (a > 0 &&
b > 0)) {
215 if (
b > 0) { a *= a; }
221 return (a >
b) ? 1 : 0;
223 return (a <
b) ? 1 : 0;
225 return (a >=
b) ? 1 : 0;
227 return (a <=
b) ? 1 : 0;
229 return (a ==
b) ? 1 : 0;
231 return (a !=
b) ? 1 : 0;
233 return ((a != 0) && (
b != 0)) ? 1 : 0;
235 return ((a != 0) || (
b != 0)) ? 1 : 0;
237 return (a <
b) ? a :
b;
239 return (a >
b) ? a :
b;
250 return (a != 0) ?
b : c;
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
void amrex_iparsererror(char const *s,...)
Definition: AMReX_IParser_Y.cpp:10
Print on all processors of the default communicator.
Definition: AMReX_Print.H:117
Definition: AMReX_Amr.cpp:49
struct iparser_node * iparser_newf3(enum iparser_f3_t ftype, struct iparser_node *n1, struct iparser_node *n2, struct iparser_node *n3)
Definition: AMReX_IParser_Y.cpp:90
struct iparser_node * iparser_newnumber(long long d)
Definition: AMReX_IParser_Y.cpp:54
struct iparser_node * iparser_newf2(enum iparser_f2_t ftype, struct iparser_node *l, struct iparser_node *r)
Definition: AMReX_IParser_Y.cpp:79
struct iparser_node * iparser_newf1(enum iparser_f1_t ftype, struct iparser_node *l)
Definition: AMReX_IParser_Y.cpp:69
void iparser_print(struct amrex_iparser *iparser)
Definition: AMReX_IParser_Y.cpp:1406
void iparser_ast_print(struct iparser_node *node, std::string const &space, AllPrint &printer)
Definition: AMReX_IParser_Y.cpp:1064
std::set< std::string > iparser_get_symbols(struct amrex_iparser *iparser)
Definition: AMReX_IParser_Y.cpp:1413
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE long long iparser_call_f1(enum iparser_f1_t, long long a)
Definition: AMReX_IParser_Y.H:185
long long iparser_atoll(const char *str)
Definition: AMReX_IParser_Y.cpp:1431
struct amrex_iparser * amrex_iparser_new()
Definition: AMReX_IParser_Y.cpp:129
void iparser_ast_setconst(struct iparser_node *node, char const *name, long long c)
Definition: AMReX_IParser_Y.cpp:1283
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 iparser_ast_depth(struct iparser_node *node)
Definition: AMReX_IParser_Y.cpp:1162
iparser_f1_t
Definition: AMReX_IParser_Y.H:22
@ IPARSER_ABS
Definition: AMReX_IParser_Y.H:23
struct iparser_node * iparser_newnode(enum iparser_node_t type, struct iparser_node *l, struct iparser_node *r)
Definition: AMReX_IParser_Y.cpp:44
struct iparser_node * iparser_ast_dup(struct amrex_iparser *my_iparser, struct iparser_node *node, int move)
Definition: AMReX_IParser_Y.cpp:259
void amrex_iparser_delete(struct amrex_iparser *iparser)
Definition: AMReX_IParser_Y.cpp:149
void iparser_ast_optimize(struct iparser_node *node)
Definition: AMReX_IParser_Y.cpp:384
struct iparser_node * iparser_newlist(struct iparser_node *nl, struct iparser_node *nr)
Definition: AMReX_IParser_Y.cpp:113
std::size_t iparser_ast_size(struct iparser_node *node)
Definition: AMReX_IParser_Y.cpp:190
void iparser_ast_get_symbols(struct iparser_node *node, std::set< std::string > &symbols, std::set< std::string > &local_symbols)
Definition: AMReX_IParser_Y.cpp:1338
iparser_f2_t
Definition: AMReX_IParser_Y.H:26
@ IPARSER_LT
Definition: AMReX_IParser_Y.H:30
@ IPARSER_GT
Definition: AMReX_IParser_Y.H:29
@ IPARSER_POW
Definition: AMReX_IParser_Y.H:28
@ IPARSER_FLRDIV
Definition: AMReX_IParser_Y.H:27
@ IPARSER_AND
Definition: AMReX_IParser_Y.H:35
@ IPARSER_OR
Definition: AMReX_IParser_Y.H:36
@ IPARSER_MAX
Definition: AMReX_IParser_Y.H:38
@ IPARSER_EQ
Definition: AMReX_IParser_Y.H:33
@ IPARSER_MIN
Definition: AMReX_IParser_Y.H:37
@ IPARSER_GEQ
Definition: AMReX_IParser_Y.H:31
@ IPARSER_LEQ
Definition: AMReX_IParser_Y.H:32
@ IPARSER_NEQ
Definition: AMReX_IParser_Y.H:34
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE long long iparser_call_f2(enum iparser_f2_t type, long long a, long long b)
Definition: AMReX_IParser_Y.H:192
struct iparser_node * iparser_newassign(struct iparser_symbol *sym, struct iparser_node *v)
Definition: AMReX_IParser_Y.cpp:103
void iparser_regvar(struct amrex_iparser *iparser, char const *name, int i)
Definition: AMReX_IParser_Y.cpp:1393
void iparser_setconst(struct amrex_iparser *iparser, char const *name, long long c)
Definition: AMReX_IParser_Y.cpp:1399
struct iparser_symbol * iparser_makesymbol(char *name)
Definition: AMReX_IParser_Y.cpp:34
void iparser_defexpr(struct iparser_node *body)
Definition: AMReX_IParser_Y.cpp:28
void iparser_ast_regvar(struct iparser_node *node, char const *name, int i)
Definition: AMReX_IParser_Y.cpp:1219
int iparser_depth(struct amrex_iparser *iparser)
Definition: AMReX_IParser_Y.cpp:1425
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE long long iparser_call_f3(enum iparser_f3_t, long long a, long long b, long long c)
Definition: AMReX_IParser_Y.H:247
struct amrex_iparser * iparser_dup(struct amrex_iparser *source)
Definition: AMReX_IParser_Y.cpp:177
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
iparser_node_t
Definition: AMReX_IParser_Y.H:45
@ IPARSER_ADD_PP
Definition: AMReX_IParser_Y.H:59
@ IPARSER_MUL_PP
Definition: AMReX_IParser_Y.H:63
@ IPARSER_NEG_P
Definition: AMReX_IParser_Y.H:67
@ IPARSER_ASSIGN
Definition: AMReX_IParser_Y.H:56
@ IPARSER_SUB
Definition: AMReX_IParser_Y.H:49
@ IPARSER_DIV_VP
Definition: AMReX_IParser_Y.H:64
@ IPARSER_DIV_PV
Definition: AMReX_IParser_Y.H:65
@ IPARSER_F1
Definition: AMReX_IParser_Y.H:53
@ IPARSER_NUMBER
Definition: AMReX_IParser_Y.H:46
@ IPARSER_ADD_VP
Definition: AMReX_IParser_Y.H:58
@ IPARSER_SUB_PP
Definition: AMReX_IParser_Y.H:61
@ IPARSER_F3
Definition: AMReX_IParser_Y.H:55
@ IPARSER_SUB_VP
Definition: AMReX_IParser_Y.H:60
@ IPARSER_LIST
Definition: AMReX_IParser_Y.H:57
@ IPARSER_NEG
Definition: AMReX_IParser_Y.H:52
@ IPARSER_ADD
Definition: AMReX_IParser_Y.H:48
@ IPARSER_DIV_PP
Definition: AMReX_IParser_Y.H:66
@ IPARSER_F2
Definition: AMReX_IParser_Y.H:54
@ IPARSER_MUL_VP
Definition: AMReX_IParser_Y.H:62
@ IPARSER_DIV
Definition: AMReX_IParser_Y.H:51
@ IPARSER_MUL
Definition: AMReX_IParser_Y.H:50
@ IPARSER_SYMBOL
Definition: AMReX_IParser_Y.H:47
struct iparser_node * iparser_newsymbol(struct iparser_symbol *symbol)
Definition: AMReX_IParser_Y.cpp:63
iparser_f3_t
Definition: AMReX_IParser_Y.H:41
@ IPARSER_IF
Definition: AMReX_IParser_Y.H:42
Definition: AMReX_IParser_Y.H:153
struct iparser_node * ast
Definition: AMReX_IParser_Y.H:156
std::size_t sz_mempool
Definition: AMReX_IParser_Y.H:157
void * p_root
Definition: AMReX_IParser_Y.H:154
void * p_free
Definition: AMReX_IParser_Y.H:155
Definition: AMReX_IParser_Y.H:122
struct iparser_node * v
Definition: AMReX_IParser_Y.H:125
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:123
struct iparser_symbol * s
Definition: AMReX_IParser_Y.H:124
Definition: AMReX_IParser_Y.H:101
struct iparser_node * l
Definition: AMReX_IParser_Y.H:103
enum iparser_f1_t ftype
Definition: AMReX_IParser_Y.H:104
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:102
Definition: AMReX_IParser_Y.H:107
struct iparser_node * r
Definition: AMReX_IParser_Y.H:110
struct iparser_node * l
Definition: AMReX_IParser_Y.H:109
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:108
enum iparser_f2_t ftype
Definition: AMReX_IParser_Y.H:111
Definition: AMReX_IParser_Y.H:114
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:115
struct iparser_node * n3
Definition: AMReX_IParser_Y.H:118
enum iparser_f3_t ftype
Definition: AMReX_IParser_Y.H:119
struct iparser_node * n1
Definition: AMReX_IParser_Y.H:116
struct iparser_node * n2
Definition: AMReX_IParser_Y.H:117
Definition: AMReX_IParser_Y.H:82
struct iparser_node * l
Definition: AMReX_IParser_Y.H:84
struct iparser_node * r
Definition: AMReX_IParser_Y.H:85
union iparser_nvp lvp
Definition: AMReX_IParser_Y.H:86
int rip
Definition: AMReX_IParser_Y.H:87
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:83
Definition: AMReX_IParser_Y.H:90
long long value
Definition: AMReX_IParser_Y.H:92
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:91
Definition: AMReX_IParser_Y.H:95
int ip
Definition: AMReX_IParser_Y.H:98
char * name
Definition: AMReX_IParser_Y.H:97
enum iparser_node_t type
Definition: AMReX_IParser_Y.H:96
Definition: AMReX_IParser_Y.H:76
long long v
Definition: AMReX_IParser_Y.H:78
struct iparser_node * n
Definition: AMReX_IParser_Y.H:77
int ip
Definition: AMReX_IParser_Y.H:79