43 class yc_const_number_node;
277 virtual const std::string&
353 virtual std::vector<yc_number_node_ptr>
700 return std::move(arg);
920 #define UNARY_MATH_EXPR(fn_name) \
921 yc_number_node_ptr fn_name(const yc_number_node_ptr rhs)
941 #undef UNARY_MATH_EXPR
944 #define BINARY_MATH_EXPR(fn_name) \
945 yc_number_node_ptr fn_name(const yc_number_node_ptr arg1, const yc_number_node_ptr arg2); \
946 yc_number_node_ptr fn_name(double arg1, const yc_number_node_ptr arg2); \
947 yc_number_node_ptr fn_name(const yc_number_node_ptr arg1, double arg2)
971 #undef BINARY_MATH_EXPR
1059 #define BOOL_OPER(oper, fn) \
1060 inline yc_bool_node_ptr operator oper(const yc_number_node_ptr lhs, const yc_number_node_ptr rhs) { \
1061 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1062 inline yc_bool_node_ptr operator oper(const yc_number_node_ptr lhs, const yc_index_node_ptr rhs) { \
1063 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1064 inline yc_bool_node_ptr operator oper(const yc_number_node_ptr lhs, const yc_var_point_node_ptr rhs) { \
1065 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1066 inline yc_bool_node_ptr operator oper(const yc_index_node_ptr lhs, const yc_number_node_ptr rhs) { \
1067 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1068 inline yc_bool_node_ptr operator oper(const yc_index_node_ptr lhs, const yc_index_node_ptr rhs) { \
1069 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1070 inline yc_bool_node_ptr operator oper(const yc_index_node_ptr lhs, const yc_var_point_node_ptr rhs) { \
1071 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1072 inline yc_bool_node_ptr operator oper(const yc_var_point_node_ptr lhs, const yc_number_node_ptr rhs) { \
1073 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1074 inline yc_bool_node_ptr operator oper(const yc_var_point_node_ptr lhs, const yc_index_node_ptr rhs) { \
1075 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1076 inline yc_bool_node_ptr operator oper(const yc_var_point_node_ptr lhs, const yc_var_point_node_ptr rhs) { \
1077 yc_node_factory nfac; return nfac.fn(lhs, rhs); } \
1078 inline yc_bool_node_ptr operator oper(const yc_number_node_ptr lhs, double rhs) { \
1079 yc_node_factory nfac; return nfac.fn(lhs, nfac.new_number_node(rhs)); } \
1080 inline yc_bool_node_ptr operator oper(const yc_index_node_ptr lhs, double rhs) { \
1081 yc_node_factory nfac; return nfac.fn(lhs, nfac.new_number_node(rhs)); } \
1082 inline yc_bool_node_ptr operator oper(const yc_var_point_node_ptr lhs, double rhs) { \
1083 yc_node_factory nfac; return nfac.fn(lhs, nfac.new_number_node(rhs)); }
1089 BOOL_OPER(<=, new_not_greater_than_node)
1112 #define IF_DOMAIN ^=
An addition node.
Definition yc_node_api.hpp:363
A boolean 'and' operator.
Definition yc_node_api.hpp:426
Base class for boolean binary operators that take boolean inputs.
Definition yc_node_api.hpp:410
virtual yc_bool_node_ptr get_lhs()=0
Get the left-hand-side operand.
virtual yc_bool_node_ptr get_rhs()=0
Get the right-hand-side operand.
Base class for boolean binary operators that take numerical inputs.
Definition yc_node_api.hpp:435
virtual yc_number_node_ptr get_lhs()=0
Get the left-hand-side operand.
virtual yc_number_node_ptr get_rhs()=0
Get the right-hand-side operand.
Base class for numerical binary operators.
Definition yc_node_api.hpp:372
virtual yc_number_node_ptr get_lhs()=0
Get the left-hand-side operand.
virtual yc_number_node_ptr get_rhs()=0
Get the right-hand-side operand.
Base class for all boolean AST nodes.
Definition yc_node_api.hpp:256
virtual yc_bool_node_ptr clone_ast() const =0
Create a deep copy of AST starting with this node.
Base class for commutative numerical operators.
Definition yc_node_api.hpp:339
virtual void add_operand(yc_number_node_ptr node)=0
Add an operand.
virtual int get_num_operands()=0
Get the number of operands.
virtual std::vector< yc_number_node_ptr > get_operands()=0
Get a list of the operands.
A constant numerical value.
Definition yc_node_api.hpp:306
virtual double get_value() const =0
Get the stored value.
virtual void set_value(double val)=0
Set the value.
A division node.
Definition yc_node_api.hpp:390
A numerical-comparison 'equals' operator.
Definition yc_node_api.hpp:453
Equation node.
Definition yc_node_api.hpp:149
virtual yc_equation_node_ptr clone_ast() const =0
Create a deep copy of AST starting with this node.
virtual yc_bool_node_ptr get_cond()=0
Get the condition describing the sub-domain.
virtual yc_number_node_ptr get_rhs()=0
Get the right-hand-side operand.
virtual yc_var_point_node_ptr get_lhs()=0
Get the left-hand-side operand.
virtual void set_step_cond(yc_bool_node_ptr step_cond)=0
Set the condition describing when the equation is valid.
virtual void set_cond(yc_bool_node_ptr sub_domain_cond)=0
Set the condition describing the sub-domain for this equation.
Base class for all AST nodes.
Definition yc_node_api.hpp:125
virtual std::string format_simple() const =0
Create a simple human-readable string.
virtual int get_num_nodes() const =0
Count the size of the AST.
A numerical-comparison 'greater_than' operator.
Definition yc_node_api.hpp:471
A dimension or an index in that dimension.
Definition yc_node_api.hpp:272
virtual const std::string & get_name() const =0
Get the dimension's name.
A numerical-comparison 'less_than' operator.
Definition yc_node_api.hpp:465
A modulo node.
Definition yc_node_api.hpp:394
A multiplication node.
Definition yc_node_api.hpp:367
A numerical negation operator.
Definition yc_node_api.hpp:325
virtual yc_number_node_ptr get_rhs()=0
Get the [only] operand.
Factory to create AST nodes.
Definition yc_node_api.hpp:609
virtual yc_number_node_ptr new_multiply_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a multiplication node.
virtual yc_number_node_ptr new_add_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create an addition node.
virtual yc_bool_node_ptr new_not_greater_than_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'less-than or equals' node.
virtual yc_number_node_ptr new_negate_node(yc_number_node_ptr rhs) const
Create a numerical negation operator node.
virtual yc_number_node_ptr new_divide_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a division node.
virtual yc_number_node_ptr new_mod_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a modulo node.
virtual yc_equation_node_ptr new_equation_node(yc_var_point_node_ptr lhs, yc_number_node_ptr rhs, yc_bool_node_ptr sub_domain_cond=nullptr) const
Create an equation node.
virtual yc_bool_node_ptr new_or_node(yc_bool_node_ptr lhs, yc_bool_node_ptr rhs) const
Create a boolean 'or' node.
virtual yc_index_node_ptr new_step_index(const std::string &name) const
Create a step-index node.
virtual yc_number_node_ptr new_const_number_node(double val) const
Create a constant numerical-value node.
virtual yc_bool_node_ptr new_not_less_than_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'greater-than or equals' node.
virtual yc_bool_node_ptr new_not_node(yc_bool_node_ptr rhs) const
Create a binary inverse operator node.
virtual yc_bool_node_ptr new_equals_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'equals' node.
virtual yc_bool_node_ptr new_greater_than_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'greater-than' node.
virtual yc_index_node_ptr new_first_domain_index(yc_index_node_ptr idx) const
Create a symbol for the first index value in a given dimension.
virtual yc_index_node_ptr new_last_domain_index(yc_index_node_ptr idx) const
Create a symbol for the last index value in a given dimension.
virtual yc_bool_node_ptr new_and_node(yc_bool_node_ptr lhs, yc_bool_node_ptr rhs) const
Create a boolean 'and' node.
virtual yc_number_node_ptr new_const_number_node(idx_t val) const
Create a constant numerical value node.
virtual yc_number_node_ptr new_number_node(yc_number_any_arg arg) const
Create a numerical-value expression node.
Definition yc_node_api.hpp:698
virtual yc_index_node_ptr new_misc_index(const std::string &name) const
Create a new miscellaneous index.
virtual yc_bool_node_ptr new_less_than_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'less-than' node.
virtual yc_number_node_ptr new_subtract_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a subtraction node.
virtual yc_index_node_ptr new_domain_index(const std::string &name) const
Create a domain-index node.
virtual yc_bool_node_ptr new_not_equals_node(yc_number_node_ptr lhs, yc_number_node_ptr rhs) const
Create a numerical-comparison 'not-equals' node.
A numerical-comparison 'not_equals' operator.
Definition yc_node_api.hpp:459
A numerical-comparison 'not_greater_than' operator.
Definition yc_node_api.hpp:483
A numerical-comparison 'not_less_than' operator.
Definition yc_node_api.hpp:477
A boolean inversion operator.
Definition yc_node_api.hpp:400
virtual yc_bool_node_ptr get_rhs()=0
Get the [only] operand.
Arguments that may be YASK or non-YASK numeric types.
Definition yc_node_api.hpp:563
yc_number_any_arg(idx_t i)
Arg can be an index type.
Definition yc_node_api.hpp:585
yc_number_any_arg(std::nullptr_t p)
Arg can be a null pointer.
Definition yc_node_api.hpp:601
yc_number_any_arg(int i)
Arg can be an int.
Definition yc_node_api.hpp:589
yc_number_any_arg(yc_index_node_ptr p)
Arg can be an index-node pointer.
Definition yc_node_api.hpp:577
yc_number_node_ptr _convert_const(double val) const
Create an argument from a constant value.
yc_number_any_arg(yc_var_point_node_ptr p)
Arg can be a var-point-node pointer.
Definition yc_node_api.hpp:581
yc_number_any_arg(double f)
Arg can be a double.
Definition yc_node_api.hpp:593
yc_number_any_arg(yc_number_node_ptr p)
Arg can be a number-node pointer.
Definition yc_node_api.hpp:573
yc_number_any_arg(float f)
Arg can be a float.
Definition yc_node_api.hpp:597
Arguments that may be non-YASK numeric types.
Definition yc_node_api.hpp:525
yc_number_node_ptr _convert_const(double val) const
Create an argument from a constant value.
yc_number_const_arg(idx_t i)
Arg can be an index type.
Definition yc_node_api.hpp:535
yc_number_const_arg(float f)
Arg can be a float.
Definition yc_node_api.hpp:547
yc_number_const_arg(int i)
Arg can be an int.
Definition yc_node_api.hpp:539
yc_number_const_arg(double f)
Arg can be a double.
Definition yc_node_api.hpp:543
Base class for all numerical AST nodes.
Definition yc_node_api.hpp:247
virtual yc_number_node_ptr clone_ast() const =0
Create a deep copy of AST starting with this node.
Arguments that may be YASK numeric pointer types.
Definition yc_node_api.hpp:497
yc_number_ptr_arg(yc_index_node_ptr p)
Arg can be an index-node pointer.
Definition yc_node_api.hpp:506
yc_number_ptr_arg(yc_var_point_node_ptr p)
Arg can be a var-point-node pointer.
Definition yc_node_api.hpp:510
yc_number_ptr_arg(yc_number_node_ptr p)
Arg can be a number-node pointer.
Definition yc_node_api.hpp:502
A boolean 'or' operator.
Definition yc_node_api.hpp:432
A subtraction node.
Definition yc_node_api.hpp:386
A reference to a point in a var.
Definition yc_node_api.hpp:285
virtual yc_var_ptr get_var()=0
Get the var this point is in.
YASK_DEPRECATED yc_var_ptr get_grid()
[Deprecated] Use get_var().
Definition yc_node_api.hpp:296
A compile-time data variable.
Definition yask_compiler_api.hpp:765
YASK_INT64_T idx_t
Type to use for indexing grids.
Definition yask_common_api.hpp:86
std::shared_ptr< yc_const_number_node > yc_const_number_node_ptr
Shared pointer to yc_const_number_node.
Definition yc_node_api.hpp:45
std::shared_ptr< yc_commutative_number_node > yc_commutative_number_node_ptr
Shared pointer to yc_commutative_number_node.
Definition yc_node_api.hpp:53
void operator+=(yc_number_node_ptr &lhs, yc_number_node_ptr rhs)
Shortcut for creating expression A = A + B.
std::shared_ptr< yc_not_node > yc_not_node_ptr
Shared pointer to yc_not_node.
Definition yc_node_api.hpp:89
std::shared_ptr< yc_greater_than_node > yc_greater_than_node_ptr
Shared pointer to yc_greater_than_node.
Definition yc_node_api.hpp:105
#define BOOL_OPER(oper, fn)
Binary numerical-to-boolean operators. Used internally to define ==, <, etc.
Definition yc_node_api.hpp:1059
std::shared_ptr< yc_binary_comparison_node > yc_binary_comparison_node_ptr
Shared pointer to yc_binary_comparison_node.
Definition yc_node_api.hpp:65
std::shared_ptr< yc_not_equals_node > yc_not_equals_node_ptr
Shared pointer to yc_not_equals_node.
Definition yc_node_api.hpp:97
std::shared_ptr< yc_bool_node > yc_bool_node_ptr
Shared pointer to yc_bool_node.
Definition yask_compiler_api.hpp:65
std::shared_ptr< yc_not_less_than_node > yc_not_less_than_node_ptr
Shared pointer to yc_not_less_than_node.
Definition yc_node_api.hpp:109
std::shared_ptr< yc_number_node > yc_number_node_ptr
Shared pointer to yc_number_node.
Definition yask_compiler_api.hpp:69
std::shared_ptr< yc_multiply_node > yc_multiply_node_ptr
Shared pointer to yc_multiply_node.
Definition yc_node_api.hpp:73
std::shared_ptr< yc_binary_number_node > yc_binary_number_node_ptr
Shared pointer to yc_binary_number_node.
Definition yc_node_api.hpp:57
std::shared_ptr< yc_divide_node > yc_divide_node_ptr
Shared pointer to yc_divide_node.
Definition yc_node_api.hpp:81
void operator-=(yc_number_node_ptr &lhs, yc_number_node_ptr rhs)
Shortcut for creating expression A = A - B.
std::shared_ptr< yc_equation_node > yc_equation_node_ptr
Shared pointer to yc_equation_node.
Definition yask_compiler_api.hpp:77
std::shared_ptr< yc_subtract_node > yc_subtract_node_ptr
Shared pointer to yc_subtract_node.
Definition yc_node_api.hpp:77
yc_number_node_ptr operator*(yc_number_ptr_arg lhs, yc_number_ptr_arg rhs)
Operator version of yc_node_factory::new_multiply_node().
void operator*=(yc_number_node_ptr &lhs, yc_number_node_ptr rhs)
Shortcut for creating expression A = A * B.
yc_bool_node_ptr operator!(yc_bool_node_ptr rhs)
Operator version of yc_node_factory::new_not_node().
#define IF_STEP
Recommended macro to make the step-condition operator readable and self-explanatory.
Definition yc_node_api.hpp:1123
std::shared_ptr< yc_and_node > yc_and_node_ptr
Shared pointer to yc_and_node.
Definition yc_node_api.hpp:117
#define UNARY_MATH_EXPR(fn_name)
Unary math functions. Used internally to define sqrt(), sin(), etc.
Definition yc_node_api.hpp:920
std::shared_ptr< yc_less_than_node > yc_less_than_node_ptr
Shared pointer to yc_less_than_node.
Definition yc_node_api.hpp:101
std::shared_ptr< yc_not_greater_than_node > yc_not_greater_than_node_ptr
Shared pointer to yc_not_greater_than_node.
Definition yc_node_api.hpp:113
yc_bool_node_ptr operator&&(yc_bool_node_ptr lhs, yc_bool_node_ptr rhs)
Operator version of yc_node_factory::new_and_node().
std::shared_ptr< yc_add_node > yc_add_node_ptr
Shared pointer to yc_add_node.
Definition yc_node_api.hpp:69
std::shared_ptr< yc_var_point_node > yc_var_point_node_ptr
Shared pointer to yc_var_point_node.
Definition yask_compiler_api.hpp:81
#define BINARY_MATH_EXPR(fn_name)
Binary math functions. Used internally.
Definition yc_node_api.hpp:944
yc_number_node_ptr operator%(yc_number_ptr_arg lhs, yc_number_ptr_arg rhs)
Operator version of yc_node_factory::new_mod_node().
#define EQUALS
Recommended macro to make the "equality" operator readable and self-explanatory.
Definition yc_node_api.hpp:1102
std::shared_ptr< yc_binary_bool_node > yc_binary_bool_node_ptr
Shared pointer to yc_binary_bool_node.
Definition yc_node_api.hpp:61
yc_bool_node_ptr operator||(yc_bool_node_ptr lhs, yc_bool_node_ptr rhs)
Operator version of yc_node_factory::new_or_node().
std::shared_ptr< yc_index_node > yc_index_node_ptr
Shared pointer to yc_index_node.
Definition yask_compiler_api.hpp:73
yc_number_node_ptr operator-(yc_number_ptr_arg rhs)
Operator version of yc_node_factory::new_negate_node().
std::shared_ptr< yc_equals_node > yc_equals_node_ptr
Shared pointer to yc_equals_node.
Definition yc_node_api.hpp:93
yc_number_node_ptr operator+(yc_number_ptr_arg lhs, yc_number_ptr_arg rhs)
Operator version of yc_node_factory::new_add_node().
std::shared_ptr< yc_negate_node > yc_negate_node_ptr
Shared pointer to yc_negate_node.
Definition yc_node_api.hpp:49
#define IF_DOMAIN
Recommended macro to make the domain-condition operator readable and self-explanatory.
Definition yc_node_api.hpp:1112
std::shared_ptr< yc_or_node > yc_or_node_ptr
Shared pointer to yc_or_node.
Definition yc_node_api.hpp:121
void operator/=(yc_number_node_ptr &lhs, yc_number_node_ptr rhs)
Shortcut for creating expression A = A / B.
yc_number_node_ptr operator/(yc_number_ptr_arg lhs, yc_number_ptr_arg rhs)
Operator version of yc_node_factory::new_divide_node().
std::shared_ptr< yc_mod_node > yc_mod_node_ptr
Shared pointer to yc_mod_node.
Definition yc_node_api.hpp:85
#define YASK_DEPRECATED
Deprecated attribute.
Definition yask_common_api.hpp:60