YASK
Yet Another Stencil Kit: a software framework for creating HPC stencil code. Copyright 2014-2023 Intel Corporation.
|
A wrapper or "proxy" class around a yc_var pointer. More...
#include <yask_compiler_api.hpp>
Public Member Functions | |
yc_var_proxy (const std::string &name, yc_solution_ptr soln, const std::vector< yc_index_node_ptr > &dims, bool is_scratch=false) | |
Contructor taking a vector of index vars. | |
yc_var_proxy (const std::string &name, yc_solution_ptr soln, const std::initializer_list< yc_index_node_ptr > &dims, bool is_scratch=false) | |
Contructor taking an initializer_list of index vars. | |
yc_var_proxy (const std::string &name, yc_solution_ptr soln) | |
Contructor for a simple scalar YASK variable. | |
yc_var_proxy (yc_var_ptr &var) | |
Contructor taking an existing YASK variable. | |
yc_var_proxy (yc_var_proxy &proxy) | |
Contructor taking an existing proxy. | |
virtual | ~yc_var_proxy () |
Provide a virtual destructor. | |
virtual yc_var_ptr | get_var () |
Get the underlying yc_var pointer. | |
virtual yc_var_ptr | get_var () const |
Get the underlying yc_var pointer. | |
virtual yc_var_point_node_ptr | operator() (const std::vector< yc_number_node_ptr > &index_exprs) |
Create an expression for a point in a YASK variable. | |
virtual yc_var_point_node_ptr | operator() (const std::initializer_list< yc_number_node_ptr > &index_exprs) |
Create an expression for a point in a var. | |
virtual yc_var_point_node_ptr | operator() (const yc_number_any_arg i1=nullptr, const yc_number_any_arg i2=nullptr, const yc_number_any_arg i3=nullptr, const yc_number_any_arg i4=nullptr, const yc_number_any_arg i5=nullptr, const yc_number_any_arg i6=nullptr) |
Create an expression for a point in a 1-6 dim var. | |
virtual | operator yc_number_ptr_arg () |
Create an expression for a point in a zero-dim (scalar) var using implicit conversion. | |
virtual yc_var_point_node_ptr | operator[] (const yc_number_any_arg i1) |
Create an expression for a point in a one-dim (array) var. | |
A wrapper or "proxy" class around a yc_var pointer.
Using this class provides a syntactic alternative to calling yc_solution::new_var() (or yc_solution::new_scratch_var()) followed by yc_var::new_var_point().
To use this wrapper class, construct an object of type yc_var_proxy by passing a yc_solution pointer to it. Then, expressions for points in the var can be created with a more intuitive syntax.
Example code to create a solution with an equation for a variable named "A":
Compare to the example shown in yc_solution::new_var().
Scoping and lifetime: Since the yc_var pointer in a yc_var_proxy object is a shared pointer also owned by the yc_solution object used to construct the yc_var_proxy object, the underlying YASK var will not be destroyed until both the yc_var_proxy object and the yc_solution object are destroyed. A yc_var_proxy object created from an existing yc_var object will have the same properties.
|
inline |
Contructor taking a vector of index vars.
A wrapper around yc_solution::new_var() and yc_solution::new_scratch_var().
[in] | name | Name of the new var; must be a valid C++ identifier and unique across vars. |
[in] | soln | Shared pointer to solution that will share ownership of the yc_var object. |
[in] | dims | Dimensions of the var. Each dimension is identified by an associated index. |
[in] | is_scratch | Whether to make a scratch var. |
|
inline |
Contructor taking an initializer_list of index vars.
A wrapper around yc_solution::new_var() and yc_solution::new_scratch_var().
[in] | name | Name of the new var; must be a valid C++ identifier and unique across vars. |
[in] | soln | Pointer to solution that will own the var. |
[in] | dims | Dimensions of the var. Each dimension is identified by an associated index. |
[in] | is_scratch | Whether to make a scratch var. |
|
inline |
Contructor for a simple scalar YASK variable.
A wrapper around yc_solution::new_var().
[in] | name | Name of the new var; must be a valid C++ identifier and unique across vars. |
[in] | soln | Pointer to solution that will own the var. |
|
inline |
Contructor taking an existing YASK variable.
Creates a new yc_var_proxy wrapper around an existing var.
|
inline |
Contructor taking an existing proxy.
Creates a new yc_var_proxy wrapper around a var from an existing proxy.
|
inlinevirtual |
Create an expression for a point in a YASK variable.
A wrapper around yc_var::new_var_point(). The number of arguments must match the dimensionality of the var.
Example w/2D var B
: A(t+1, x) EQUALS A(t, x) + B(vec)
,
|
inlinevirtual |
Create an expression for a point in a var.
A wrapper around yc_var::new_var_point(). The number of arguments must match the dimensionality of the var.
Example w/2D var B
: A(t+1, x) EQUALS A(t, x) + B({x, 3})
.
|
inlinevirtual |
Create an expression for a point in a 1-6 dim var.
A wrapper around yc_var::new_var_point(). The number of non-null arguments must match the dimensionality of the var. For more than 6 dims, use the vector or initializer-list version.
Example w/2D var B
: A(t+1, x) EQUALS A(t, x) + B(x, 3)
.
|
inlinevirtual |
Create an expression for a point in a zero-dim (scalar) var using implicit conversion.
A wrapper around yc_var::new_var_point().
Example w/0D var B
: A(t+1, x) EQUALS A(t, x) + B
.
|
inlinevirtual |
Create an expression for a point in a one-dim (array) var.
A wrapper around yc_var::new_var_point().
Example w/1D var B
: A(t+1, x) EQUALS A(t, x) + B[x]
.