YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
|
Factory to create AST nodes. More...
#include <yc_node_api.hpp>
Public Member Functions | |
virtual yc_index_node_ptr | new_step_index (const std::string &name) const |
Create a step-index node. | |
virtual yc_index_node_ptr | new_domain_index (const std::string &name) const |
Create a domain-index node. | |
virtual yc_index_node_ptr | new_misc_index (const std::string &name) const |
Create a new miscellaneous index. | |
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_number_node_ptr | new_number_node (yc_number_any_arg arg) const |
Create a numerical-value expression node. | |
virtual yc_number_node_ptr | new_const_number_node (double val) const |
Create a constant numerical-value 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_negate_node (yc_number_node_ptr rhs) const |
Create a numerical negation operator 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_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_subtract_node (yc_number_node_ptr lhs, yc_number_node_ptr rhs) const |
Create a subtraction 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_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_not_node (yc_bool_node_ptr rhs) const |
Create a binary inverse operator node. | |
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_bool_node_ptr | new_or_node (yc_bool_node_ptr lhs, yc_bool_node_ptr rhs) const |
Create a boolean 'or' 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_not_equals_node (yc_number_node_ptr lhs, yc_number_node_ptr rhs) const |
Create a numerical-comparison 'not-equals' node. | |
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_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_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_greater_than_node (yc_number_node_ptr lhs, yc_number_node_ptr rhs) const |
Create a numerical-comparison 'less-than or equals' node. | |
Factory to create AST nodes.
|
virtual |
Create a step-index node.
Create a variable to be used to index vars in the solution-step dimension. The name usually describes time, e.g. "t".
[in] | name | Step dimension name. |
|
virtual |
Create a domain-index node.
Create a variable to be used to index vars in the solution-domain dimension. The name usually describes spatial dimensions, e.g. "x" or "y", but it can be any dimension that is specified at run-time, such as an index into a number of parallel problems being solved simultaneously.
[in] | name | Domain index name. |
|
virtual |
Create a new miscellaneous index.
Create an variable to be used to index vars in the some dimension that is not the step dimension or a domain dimension. The value of these indices are normally compile-time constants, e.g., a fixed index into an array.
[in] | name | Index name. |
|
virtual |
Create an equation node.
Indicates var point on LHS is equivalent to expression on RHS. This is NOT a test for equality. When an equation is created, it is automatically added to the list of equations for the yc_solution that contains the var that is on the LHS.
An optional domain condition may be provided to define the sub-domain to which this equation applies. Domain conditions are always evaluated with respect to the overall problem domain, i.e., independent of any specific MPI domain decomposition that might occur at run-time. If a domain condition is not provided, the equation applies to the entire problem domain. A domain condition can be added to an equation after its creation via yc_equation_node.set_cond(). See yc_equation_node.set_cond() for more information and an example.
A step condition is similar to a domain condition, but enables or disables the entire equation based on the current step (usually time) and/or other values. A step condition can only be added to an equation after its creation via yc_equation_node.set_step_cond(). See yc_equation_node.set_step_cond() for more information and an example.
[in] | lhs | Var-point before EQUALS operator. |
[in] | rhs | Expression after EQUALS operator. |
[in] | sub_domain_cond | Optional expression defining sub-domain where lhs EQUALS rhs is valid. |
|
inlinevirtual |
Create a numerical-value expression node.
A generic method to create a pointer to a numerical expression from any type supported by yc_number_any_arg constructors.
[in] | arg | Argument to convert to a numerical expression. |
|
virtual |
Create a constant numerical-value node.
Use to add a constant to an expression. The overloaded arithmetic operators allow double
arguments, so in most cases, it is not necessary to call this directly.
[in] | val | Value to store in node. |
|
virtual |
Create a constant numerical value node.
Integer version of new_const_number_node(double). It may be necessary to cast other integer types to idx_t
to avoid ambiguous overloading of this function.
[in] | val | Value to store in node. |
|
virtual |
Create a numerical negation operator node.
This is the explicit form, which is usually not needed because new negation nodes can also be created via the overloaded unary -
operator.
[in] | rhs | Expression after - sign. |
|
virtual |
Create an addition node.
This is the explicit form, which is usually not needed because new addition nodes can also be created via the overloaded +
operator.
rhs
if lhs
is a null node pointer and vice-versa. [in] | lhs | Expression before + sign. |
[in] | rhs | Expression after + sign. |
|
virtual |
Create a multiplication node.
This is the explicit form, which is usually not needed because new multiplication nodes can also be created via the overloaded *
operator.
rhs
if lhs
is a null node pointer and vice-versa. [in] | lhs | Expression before * sign. |
[in] | rhs | Expression after * sign. |
|
virtual |
Create a subtraction node.
This is binary subtraction. Use new_negate_node() for unary -
.
This is the explicit form, which is usually not needed because new subtraction nodes can also be created via the overloaded -
operator.
- rhs
if lhs
is a null node pointer and lhs
if rhs
is null. [in] | lhs | Expression before - sign. |
[in] | rhs | Expression after - sign. |
|
virtual |
Create a division node.
This is the explicit form, which is usually not needed because new division nodes can also be created via the overloaded /
operator.
1.0 / rhs
if lhs
is a null node pointer and lhs
if rhs
is null. [in] | lhs | Expression before / sign. |
[in] | rhs | Expression after / sign. |
|
virtual |
Create a modulo node.
This is the explicit form, which is usually not needed because new modulo nodes can also be created via the overloaded %
operator. The modulo operator converts both operands to integers before performing the operation.
[in] | lhs | Expression before % sign. |
[in] | rhs | Expression after % sign. |
|
virtual |
Create a symbol for the first index value in a given dimension.
Create an expression that indicates the first value in the overall problem domain in dim
dimension. The dim
argument is created via new_domain_index().
See yc_equation_node.set_cond() for more information and an example.
[in] | idx | Domain index. |
|
virtual |
Create a symbol for the last index value in a given dimension.
Create an expression that indicates the last value in the overall problem domain in dim
dimension. The dim
argument is created via new_domain_index().
See yc_equation_node.set_cond() for more information and an example.
[in] | idx | Domain index. |
|
virtual |
Create a binary inverse operator node.
This is the explicit form, which is usually not needed because new "not" nodes can also be created via the overloaded !
operator or the yc_not
function in Python.
[in] | rhs | Expression after ! sign. |
|
virtual |
Create a boolean 'and' node.
This is the explicit form, which is usually not needed because new "and" nodes can also be created via the overloaded &&
operator or the yc_and
function in Python.
[in] | lhs | Expression before && sign. |
[in] | rhs | Expression after && sign. |
|
virtual |
Create a boolean 'or' node.
This is the explicit form, which is usually not needed because new "or" nodes can also be created via the overloaded ||
operator or the yc_or
function in Python.
[in] | lhs | Expression before || sign. |
[in] | rhs | Expression after || sign. |
|
virtual |
Create a numerical-comparison 'equals' node.
This is the explicit form, which is usually not needed because new "equals" nodes can also be created via the overloaded ==
operator.
[in] | lhs | Expression before == sign. |
[in] | rhs | Expression after == sign. |
|
virtual |
Create a numerical-comparison 'not-equals' node.
This is the explicit form, which is usually not needed because new "not-equals" nodes can also be created via the overloaded !=
operator.
[in] | lhs | Expression before != sign. |
[in] | rhs | Expression after != sign. |
|
virtual |
Create a numerical-comparison 'less-than' node.
This is the explicit form, which is usually not needed because new "less-than" nodes can also be created via the overloaded <
operator.
[in] | lhs | Expression before < sign. |
[in] | rhs | Expression after < sign. |
|
virtual |
Create a numerical-comparison 'greater-than' node.
This is the explicit form, which is usually not needed because new "greater-than" nodes can also be created via the overloaded >
operator.
[in] | lhs | Expression before > sign. |
[in] | rhs | Expression after > sign. |
|
virtual |
Create a numerical-comparison 'greater-than or equals' node.
This is the explicit form, which is usually not needed because new "greater-than or equals" nodes can also be created via the overloaded >=
operator.
[in] | lhs | Expression before >= sign. |
[in] | rhs | Expression after >= sign. |
|
virtual |
Create a numerical-comparison 'less-than or equals' node.
This is the explicit form, which is usually not needed because new "less-than or equals" nodes can also be created via the overloaded <=
operator.
[in] | lhs | Expression before <= sign. |
[in] | rhs | Expression after <= sign. |