YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
|
Equation node. More...
#include <yc_node_api.hpp>
Public Member Functions | |
virtual yc_var_point_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. | |
virtual yc_bool_node_ptr | get_cond ()=0 |
Get the condition describing the sub-domain. | |
virtual void | set_cond (yc_bool_node_ptr sub_domain_cond)=0 |
Set the condition describing the sub-domain for this equation. | |
virtual void | set_step_cond (yc_bool_node_ptr step_cond)=0 |
Set the condition describing when the equation is valid. | |
virtual yc_equation_node_ptr | clone_ast () const =0 |
Create a deep copy of AST starting with this node. | |
Public Member Functions inherited from yask::yc_expr_node | |
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. | |
Equation node.
Indicates var point on LHS is equivalent to expression on RHS. This is NOT a test for equality. Created via yc_node_factory::new_equation_node().
|
pure virtual |
Get the left-hand-side operand.
|
pure virtual |
Get the right-hand-side operand.
|
pure virtual |
Get the condition describing the sub-domain.
nullptr
if not defined.
|
pure virtual |
Set the condition describing the sub-domain for this equation.
See yc_node_factory::new_equation_node() for an overall description of conditions.
Typical C++ usage to create a sub-domain condition:
Specification of the "interior" part of a 2-D domain could be represented by an expression like (x >= node_fac.new_first_domain_index(x) + 20) && (x <= node_fac.new_last_domain_index(x) - 20) && (y >= node_fac.new_first_domain_index(y) + 20) && (y <= node_fac.new_last_domain_index(y) - 20)
.
(x >= node_fac.new_first_domain_index(x)) && (x <= node_fac.new_last_domain_index(x))
, but that is the default condition so does not need to be specified.x < first_x + 10
instead of merely x < 10
to avoid the assumption that the first index is always zero (0). More importantly, use an expression like x > last_x - 10
instead of hard-coding the last index. [in] | sub_domain_cond | Boolean expression describing where in the sub-domain this expression is valid or nullptr to remove the condition. |
|
pure virtual |
Set the condition describing when the equation is valid.
See yc_node_factory::new_equation_node() for an overall description of conditions.
Typical C++ usage to create a step condition:
Step conditions may also refer to elements in variables including scalars (1-D) and arrays (2-D). For non-scalar variables, indices used in a step condition cannot include domain variables like x
or y
, but constants are allowed. In this way, equations can be enabled or disabled programmatically by setting elements in the tested variables.
[in] | step_cond | Boolean expression describing when the expression is valid or nullptr to remove the condition. |