Proto
|
Modules | |
Macros | |
Data Structures | |
class | Proto::CInterval |
Component-Space Interval. More... | |
class | Proto::Var< T, C, MEMTYPE, D, E > |
Pointwise Variable. More... | |
class | Proto::BoxData< T, C, MEMTYPE, D, E > |
Multidimensional Rectangular Array. More... | |
struct | Proto::boxdataIndexer< Op, T, C > |
struct | Proto::scalarIndexer< Op, T, C > |
struct | Proto::opKernel< T, op > |
struct | Proto::emptyIndexer< FuncStruct > |
struct | Proto::structIndexer< FuncStruct, Srcs > |
struct | Proto::indexer< Func, Srcs > |
struct | Proto::indexer_p< Func, Srcs > |
struct | Proto::indexer_i< Func, Srcs > |
struct | Proto::getMemType< T > |
struct | Proto::getMemType< BoxData< T, C, MEMTYPE, D, E > > |
struct | Proto::getMemType< Var< T, C, MEMTYPE, D, E > > |
Functions | |
Proto::CInterval::CInterval (unsigned int a_c0, unsigned int a_c1, unsigned int a_d0=0, unsigned int a_d1=0, unsigned int a_e0=0, unsigned int a_e1=0) | |
Bounds Constructor. More... | |
Proto::CInterval::CInterval (std::initializer_list< std::initializer_list< unsigned int >> a_lst) | |
List Constructor. More... | |
unsigned int | Proto::CInterval::low (unsigned int a_comp) const |
Lower Bound. More... | |
unsigned int | Proto::CInterval::high (unsigned int a_comp) const |
Upper Bound. More... | |
bool | Proto::CInterval::contains (unsigned int a_index, unsigned int a_comp) const |
Contains Query. More... | |
unsigned int | Proto::CInterval::size (unsigned int a_comp) const |
Size Query. More... | |
void | Proto::CInterval::print () const |
Print. | |
std::ostream & | Proto::operator<< (std::ostream &a_os, const CInterval &a_int) |
CInterval IOStream Operator. | |
CUDA_DECORATION | Proto::Var< T, C, MEMTYPE, D, E >::__attribute__ ((always_inline)) T &operator()(unsigned int a_c |
Pointwise Accessor. More... | |
Alias and Slice Operators | |
The alias and slice operations facilitate BoxData operations while avoiding unnecessary copies. See the sample code below for an explanation of the syntax. Example Box srcBox = Box::Cube(4); BoxData<double, 1, 2, 3> Src(srcBox); Src.setVal(17); // Alias is identical to Src and points to the same data. Changing alias will change Src. auto Alias = alias(Src); // shiftedAlias points to the same buffer as Src, but the domain is shifted by (1,...,1); // (e.g. shiftedAlias[Point::Ones()] == Src[Point::Zeros] will return true.) auto shiftedAlias = alias(Src, Point::Ones()); //shiftedAlias points to the same data, but the associated domain Example | |
template<class T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::alias (BoxData< T, C, MEMTYPE, D, E > &a_original, const Point &shift=Point::Zeros()) |
Alias (Non-Const) More... | |
template<class T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT> | |
const BoxData< T, C, MEMTYPE, D, E > | Proto::alias (const BoxData< T, C, MEMTYPE, D, E > &a_original, const Point &shift=Point::Zeros()) |
Alias (Const) More... | |
template<typename T , unsigned int C, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1> | |
BoxData< T, 1, MEMTYPE, 1, 1 > | Proto::slice (const BoxData< T, C, MEMTYPE, D, E > &a_src, unsigned int a_c, unsigned int a_d=0, unsigned int a_e=0) |
Slice Arbitrary Component (Non-Const) More... | |
template<typename T , unsigned int C, unsigned char CC, MemType MEMTYPE = MEMTYPE_DEFAULT> | |
BoxData< T, CC, MEMTYPE, 1, 1 > | Proto::slice (const BoxData< T, C, MEMTYPE, 1, 1 > &a_src, unsigned int a_nstart) |
Slice Arbitrary Component Range (Non-Const) More... | |
Pointwise Operators | |
The suite of forall functions facilitate writing functions that operate pointwise on BoxData. To this end, the user must write a function with one of the following structures: PROTO_KERNEL_START void F_temp(Var<T,C,MEMTYPE,D,E>&, Args...) { ... } PROTO_KERNEL_END(F_temp, F) // OR PROTO_KERNEL_START void F_p_temp(Point&, Var<T,C,MEMTYPE,D,E>&, Args...) { ... } PROTO_KERNEL_END(F_p_temp, F_p)
Refer to the following code snippet for some sample valid forall input functions: // Valid funcion inputs to forall may be STATIC members of classes: namespace Operator { // Pointwise function with no point dependence PROTO_KERNEL_START // necessary for use with GPU devices static void foo_temp(Var<double, 3, 2>& arg_0, double arg_1, // plain-old-data can be passed by value Var<bool>& arg_2) // any number of Var objects with different types / structures can be passed by reference { // if arg_2 == true at this Point... if (arg_2(0)) { arg_0(1,1) = arg_1; // Access the (1,1,0) component at each point and set it to arg_1 } else { arg_0(1,1) = -arg_1; // Access the (1,1,0) component at each point and se tit to -arg1 } } PROTO_KERNEL_END(foo_temp, foo) // Pointwise function with point dependence PROTO_KERNEL_START static void foo_p_temp(Point& a_p, // If the function depends on the point of evaluation, the Point must be the first argument Var<double, 3, 2>& arg_0, Var<bool>& arg_1) { if (arg_1(0)) { for (int ii = 0; ii < DIM; ii++) { arg_0(1,1) += a_p[ii]; // Set the (1,1,0) component of arg_0 equal to the sum of the components of this Point } } } PROTO_KERNEL_END(foo_p_temp, foo_p) } // globally defined functions are also valid: PROTO_KERNEL_START void bar_temp(Var<double>& arg_0, int arg_1) { arg_0(0) = arg_1; } PROTO_KERNEL_END(bar_temp, bar) // globally defined functions are also valid: PROTO_KERNEL_START void bar_p_temp(Point& a_p, Var<double>& arg_0, int arg_1) { arg_0(0) = a_p[0]*arg_1; } PROTO_KERNEL_END(bar_p_temp, bar_p) | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forall (const Func &a_F, Srcs &&... a_srcs) |
Pointwise Operator. More... | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forallOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forall (const Func &a_F, Box a_box, Srcs &&... a_srcs) |
Pointwise Operator: Overload with Box Argument. More... | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forallOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Box a_box, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forall_p (const Func &a_F, Srcs &&... a_srcs) |
Pointwise Operator with Point Dependence. More... | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forallOp_p (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forall_p (const Func &a_F, Box a_box, Srcs &&... a_srcs) |
Pointwise Operator with Point Dependence: Overload with const Box Argument. More... | |
template<typename T , unsigned int C = 1, unsigned char D = 1, unsigned char E = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, typename Func , typename... Srcs> | |
BoxData< T, C, MEMTYPE, D, E > | Proto::forallOp_p (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Box a_box, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlace (const Func &a_F, Srcs &&... a_srcs) |
In-Place Pointwise Operator. More... | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlaceOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlace (const Func &a_F, Box a_box, Srcs &&... a_srcs) |
In-Place Pointwise Operator on Prescribed Box. More... | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlaceOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Box a_box, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlace_p (const Func &a_F, Srcs &&... a_srcs) |
In-Place Pointwise Operator with Point Dependence. More... | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlaceOp_p (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlace_p (const Func &a_F, Box a_box, Srcs &&... a_srcs) |
In-Place Pointwise Operator with Point Dependence and Prescribed Box. More... | |
template<typename Func , typename... Srcs> | |
void | Proto::forallInPlaceOp_p (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Box a_box, Srcs &&... a_srcs) |
same idea, but with flop counts and a timer name | |
Constructors and Define | |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData (const BoxData< T, C, MEMTYPE, D, E > &a_src)=delete | |
Copy constructor/assignment forbidden for all the usual reasons. | |
BoxData & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator= (const BoxData< T, C, MEMTYPE, D, E > &a_src)=delete |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData () | |
Default Constructor. More... | |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData (const Box &a_box, bool a_stackAllocation=DEFAULT_USE_STACK) | |
Box Constructor. More... | |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData (const Box &a_box, T a_init) | |
Box Constructor With Initialization. More... | |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData (BoxData< T, C, MEMTYPE, D, E > &&a_src) | |
Move constructor. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::define (const Box &a_box, bool a_stackAllocation=DEFAULT_USE_STACK) |
Box Define. More... | |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData (const T *a_ptr, const Box &a_box, int a_ncomp=C) | |
Raw Pointer Constructor. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::define (const T *a_ptr, const Box &a_box, int a_ncomp=C) |
Raw Pointer Define. More... | |
Proto::BoxData< T, C, MEMTYPE, D, E >::~BoxData () | |
Destructor. | |
Data Movement | |
template<BoxDataOp > | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::operatorT (const BoxData< T, C, MEMTYPE, D, E > &a_src) |
template<BoxDataOp > | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::operatorT (const T a_scale) |
BoxData & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator= (BoxData< T, C, MEMTYPE, D, E > &&a_src) |
Move Assignment Operator. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo (BoxData< T, C, MEMTYPE, D, E > &a_dest) const |
Copy on Intersection. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo (BoxData< T, C, MEMTYPE, D, E > &a_dest, const Box &a_srcBox, const Point &a_destShift=Point::Zeros()) const |
Copy Region. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo (BoxData< T, C, MEMTYPE, D, E > &a_dest, const Box &a_srcBox, const Box &a_destBox) const |
Copy with src and dest boxes. More... | |
template<unsigned int Cdest, unsigned char Ddest, unsigned char Edest> | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo (BoxData< T, Cdest, MEMTYPE, Ddest, Edest > &a_dest, const Box &a_srcBox, CInterval a_srcComps, const Point &a_destShift, CInterval a_destComps) const |
General Copy. More... | |
template<unsigned int Csrc> | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::copy (const BoxData< T, Csrc, MEMTYPE, D, E > &a_dsrc, const Box &a_srcBox, unsigned int a_srcComp, const Box &a_destBox, unsigned int a_destComp, unsigned int a_numcomp) |
General Copy From. More... | |
Accessors | |
CUDA_DECORATION T & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator() (const Point &a_pt, unsigned int a_c=0, unsigned char a_d=0, unsigned char a_e=0) const |
Read Only Data Accessor. More... | |
T * | Proto::BoxData< T, C, MEMTYPE, D, E >::operator[] (unsigned int a_index) |
Index Accessor (Non-Const) More... | |
const T * | Proto::BoxData< T, C, MEMTYPE, D, E >::operator[] (unsigned int a_index) const |
Index Accessor (Const) More... | |
const T * | Proto::BoxData< T, C, MEMTYPE, D, E >::data (const Point &a_p, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const |
Read-Write Accessor (Const) More... | |
T * | Proto::BoxData< T, C, MEMTYPE, D, E >::data () |
Buffer Accessor (Non-Const) More... | |
const T * | Proto::BoxData< T, C, MEMTYPE, D, E >::data () const |
Buffer Accessor (Const) More... | |
T * | Proto::BoxData< T, C, MEMTYPE, D, E >::data (const Point &a_p, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) |
Read-Write Accessor (Non-Const) More... | |
const T * | Proto::BoxData< T, C, MEMTYPE, D, E >::dataPtr (unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const |
Read-Write Accessor (Const) More... | |
T * | Proto::BoxData< T, C, MEMTYPE, D, E >::dataPtr (unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) |
Read-Write Accessor (Non-Const) More... | |
shared_ptr< T > | Proto::BoxData< T, C, MEMTYPE, D, E >::getData () const |
Access Shared Pointer. More... | |
CUDA_DECORATION size_t | Proto::BoxData< T, C, MEMTYPE, D, E >::index (const Point a_pt, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const |
Compute Index. More... | |
Box | Proto::BoxData< T, C, MEMTYPE, D, E >::box () const |
std::size_t | Proto::BoxData< T, C, MEMTYPE, D, E >::size () const |
bool | Proto::BoxData< T, C, MEMTYPE, D, E >::defined () const |
Defined Query. More... | |
Var< T, C, MEMTYPE, D, E > | Proto::BoxData< T, C, MEMTYPE, D, E >::var (const Point &a_pt) |
Create Pointwise Access Variable (Non-Const) More... | |
Var< T, C, MEMTYPE, D, E > | Proto::BoxData< T, C, MEMTYPE, D, E >::var (const Point &a_pt) const |
Create Pointwise Access Variable (Const) More... | |
Algebraic Operations | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator+= (const BoxData< T, C, MEMTYPE, D, E > &a_rhs) |
Pointwise Addition on Intersection. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator-= (const BoxData< T, C, MEMTYPE, D, E > &a_rhs) |
Pointwise Subtraction on Intersection. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator*= (const BoxData< T, C, MEMTYPE, D, E > &a_rhs) |
Pointwise Multiplication on Intersection. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator/= (const BoxData< T, C, MEMTYPE, D, E > &a_rhs) |
Pointwise Division on Intersection. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator+= (T a_scale) |
Pointwise Addition by Scalar. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator-= (T scale) |
Pointwise Subtraction by Scalar. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator*= (T scale) |
Pointwise Multiplication by Scalar. More... | |
BoxData< T, C, MEMTYPE, D, E > & | Proto::BoxData< T, C, MEMTYPE, D, E >::operator/= (T scale) |
Pointwise Division by Scalar. More... | |
Utility | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::setVal (const T &a_val) |
Initialize All Values. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::setVal (const T &a_val, const Box &a_box) |
Set All Values in Box. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::setVal (const T &a_val, const Box &a_box, int a_c, int a_d=0, int a_e=0) |
Set All Values of Component in Box. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::absMax (Reduction< T, Abs > &a_Rxn) const |
Absolute Maximum Value (Global) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::absMax () const |
Absolute Maximum Value (Global) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::absMax (int a_c, int a_d=0, int a_e=0) const |
Absolute Maximum Value (Componentwise) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::min () const |
Minimum Value (Global) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::min (int a_c, int a_d=0, int a_e=0) const |
Minimum Value (Componentwise) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::max () const |
Maximum Value (Global) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::max (int a_c, int a_d=0, int a_e=0) const |
Maximum Value (Componentwise) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::sum () const |
Sum (Global) More... | |
T | Proto::BoxData< T, C, MEMTYPE, D, E >::sum (int a_c, int a_d=0, int a_e=0) const |
sum (Componentwise) More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::shift (const Point a_pt) |
Shift Domain. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::linearOut (void *a_buf, const Box &a_box, CInterval a_comps) const |
Buffer Write. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::linearOut (void *a_buf, const ::Proto::Box &a_bx, unsigned int a_startcomp, unsigned int a_numcomps) const |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::linearIn (void *a_buf, const Box &a_box, CInterval a_comps) |
Buffer Read. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::linearIn (void *a_buf, const ::Proto::Box &a_bx, unsigned int a_startcomp, unsigned int a_numcomps) |
bool | Proto::BoxData< T, C, MEMTYPE, D, E >::contains (CInterval a_interval) const |
Contains CInterval. More... | |
template<unsigned int CC, unsigned char DD, unsigned char EE> | |
bool | Proto::BoxData< T, C, MEMTYPE, D, E >::isAlias (const BoxData< T, CC, MEMTYPE, DD, EE > &a_src) const |
Check Aliasing. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::print () const |
Print. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::printData (int a_prec=2) const |
Print Data. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::printData (const Box &a_box, int a_prec=2) const |
Print Data in Box. More... | |
void | Proto::BoxData< T, C, MEMTYPE, D, E >::printData (const Box &a_box, int a_c, int a_d, int a_e, int a_prec=2) const |
Print Component Data in Box. More... | |
CUDA_DECORATION Proto::Var< T, C, MEMTYPE, D, E >::__attribute__ | ( | (always_inline) | ) | & |
Pointwise Accessor.
Access component (c,d,e) of the BoxData<T,C,MEMTYPE,D,E>
associated with *this
.
a_c | First component index |
a_d | Second component index (default: 0) |
a_e | Third component index (default: 0) |
void Proto::BoxData< T, C, MEMTYPE, D, E >::absMax | ( | Reduction< T, Abs > & | a_Rxn | ) | const |
Absolute Maximum Value (Global)
Maximum Absolute Value (Global)
GPU: calculates the maximum absolute value over the entire data set CPU: calls absMax() and updates a_Rxn.host if larger
T Proto::BoxData< T, C, MEMTYPE, D, E >::absMax | ( | ) | const |
Absolute Maximum Value (Global)
Maximum Absolute Value (Global)
Returns the maximum absolute value over the entire data set
T Proto::BoxData< T, C, MEMTYPE, D, E >::absMax | ( | int | a_c, |
int | a_d = 0 , |
||
int | a_e = 0 |
||
) | const |
Absolute Maximum Value (Componentwise)
Maximum Absolute Value (Componentwise)
Returns the maximum absolute value of a given component
a_c | First tensor index. |
a_d | Second tensor index. |
a_e | Third tensor index. |
BoxData< T, C, MEMTYPE, D, E > Proto::alias | ( | BoxData< T, C, MEMTYPE, D, E > & | a_original, |
const Point & | shift = Point::Zeros() |
||
) |
Alias (Non-Const)
Creates a read-write alias to a mutable source BoxData with an optional shift.
const BoxData< T, C, MEMTYPE, D, E > Proto::alias | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_original, |
const Point & | shift = Point::Zeros() |
||
) |
Alias (Const)
Creates a read-only alias to a const source BoxData with an optional shift.
|
inline |
Return's the domain Box of *this
. Includes ghost cells if it was built it that way.
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData | ( | ) |
Default Constructor.
Allocates no space; user must call define on resulting object.
//define PROTO_KERNEL_END(local_name, app_name) \ // device decltype(&local_name) app_name = local_name; define PROTO_KERNEL_END(local_name, app_name) \ typedef struct { \ template <typename... T> \ inline device void operator()(T&... args) const { local_name(args...);} \ const char* myname = #app_name; \ } struct_##local_name; \ static struct_##local_name app_name; define PROTO_KERNEL_START inline //define PROTO_KERNEL_END(local_name, app_name) constexpr decltype(&local_name) app_name = local_name; //define PROTO_KERNEL_END(local_name, app_name) using app_name = local_name; define PROTO_KERNEL_END(local_name, app_name) \ struct struct_##local_name { \ template <typename... T> \ inline void operator()(T&... args) const { local_name(args...);} \ const char* myname = #app_name; \ }; \ static struct_##local_name app_name;
|
explicit |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData | ( | const Box & | a_box, |
T | a_init | ||
) |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData | ( | BoxData< T, C, MEMTYPE, D, E > && | a_src | ) |
Move constructor.
Necessary in cases where we return BoxData by value, but don't want an actual deep copy
a_src | Source data |
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData | ( | const T * | a_ptr, |
const Box & | a_box, | ||
int | a_ncomp = C |
||
) |
Raw Pointer Constructor.
Builds a vector valued BoxData by aliasing a raw pointer to T which should be of size a_box.size()*a_ncomp
. The data in a_ptr
is not copied. This constructor is not recommended for public use, but is provided to facilitate compatability with third party libraries.
a_ptr | Source buffer of type T to which *this will be aliased. The buffer must be allocated based on the same MEMTYPE as this BoxData (e.g. on the CPU if MEMTYPE=MemType::HOST) |
a_box | Box defining the domain of *this |
a_ncomp | (Optional) Dummy input for the number of components. Completely unused. |
|
inline |
Bounds Constructor.
Builds the interval: {{a_c0, a_c1},{a_d0, a_d1},{a_e0, a_e1}}
|
inline |
|
inline |
Contains Query.
Query if *this
contains index
of component comp
a_index | An index |
a_comp | A component axis in [0,3) |
|
inline |
void Proto::BoxData< T, C, MEMTYPE, D, E >::copy | ( | const BoxData< T, Csrc, MEMTYPE, D, E > & | a_dsrc, |
const Box & | a_srcBox, | ||
unsigned int | a_srcComp, | ||
const Box & | a_destBox, | ||
unsigned int | a_destComp, | ||
unsigned int | a_numcomp | ||
) |
General Copy From.
Nearly identical to the most general version of copyTo
except the copy direction is reversed. Only valid for vector valued BoxData. This function is provided to facilitate interoperability with third party libraries, and is not recommended for public use unless necessary.
a_dsrc | Source data |
a_srcBox | Source domain to copy from |
a_srcComp | First component to copy from source |
a_destBox | Destination domain to copy into |
a_destComp | First component to copy into destiation |
a_numcomp | Number of components to copy |
void Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo | ( | BoxData< T, C, MEMTYPE, D, E > & | a_dest | ) | const |
Copy on Intersection.
Copy data from *this
to a_dest
within the domain intersection. Does nothing if the domain intersection is empty.
a_dest | Destination data holder |
void Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo | ( | BoxData< T, C, MEMTYPE, D, E > & | a_dest, |
const Box & | a_srcBox, | ||
const Point & | a_destShift = Point::Zeros() |
||
) | const |
Copy Region.
Copy with a prescribed Box argument and optional shift. Explicitly, this function copies the subset of data from *this
contained in a_srcBox
into the region of a_dest
defined by a_srcBox.shift(a_destShift)
.
This function will fail if a_srcBox
is not contained in both this->box()
and a_dest.box().shift(a_destShift)
.
a_dest | Destination data holder |
a_srcBox | Region of data to copy from *this |
a_destShift | (Optional) Determines region of a_dest to copy data to. |
void Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo | ( | BoxData< T, C, MEMTYPE, D, E > & | a_dest, |
const Box & | a_srcBox, | ||
const Box & | a_destBox | ||
) | const |
Copy with src and dest boxes.
Copies from a a_srcBox
in *this
into a a_destBox
in a_dest
. Used in Proto::Copier.
void Proto::BoxData< T, C, MEMTYPE, D, E >::copyTo | ( | BoxData< T, Cdest, MEMTYPE, Ddest, Edest > & | a_dest, |
const Box & | a_srcBox, | ||
CInterval | a_srcComps, | ||
const Point & | a_destShift, | ||
CInterval | a_destComps | ||
) | const |
General Copy.
The most general form of copyTo. Copies a prescribed set of components from *this
into a_dest
within prescribed region with a possible shift. Note: the MEMTYPE must be the same for src and dest.
Example Usage:
a_dest | Destination data holder |
a_srcBox | Region of data to copy from *this |
a_srcComps | Components of *this to copy from |
a_destShift | Determines region of a_dest to copy data to (e.g. a_srcBox.shift(a_destShift) ) |
a_destComps | Components of a_dest to copy into. Must be the same size as a_srcComps. |
|
inline |
|
inline |
Buffer Accessor (Non-Const)
Return the contiguous data buffer where the data in *this
is stored. Not recommended for public use.
|
inline |
Buffer Accessor (Const)
Return the contiguous data buffer where the data in *this
is stored. Not recommended for public use.
|
inline |
|
inline |
Read-Write Accessor (Const)
Return a pointer to the region of the data buffer where a given component starts.
a_c | (Optional) First tensor index. Defaults to 0. |
a_d | (Optional) Second tensor index. Defaults to 0. |
a_e | (Optional) Third tensor index. Defaults to 0. |
|
inline |
Read-Write Accessor (Non-Const)
Return a pointer to the region of the data buffer where a given component starts.
a_c | (Optional) First tensor index. Defaults to 0. |
a_d | (Optional) Second tensor index. Defaults to 0. |
a_e | (Optional) Third tensor index. Defaults to 0. |
void Proto::BoxData< T, C, MEMTYPE, D, E >::define | ( | const Box & | a_box, |
bool | a_stackAllocation = DEFAULT_USE_STACK |
||
) |
void Proto::BoxData< T, C, MEMTYPE, D, E >::define | ( | const T * | a_ptr, |
const Box & | a_box, | ||
int | a_ncomp = C |
||
) |
Raw Pointer Define.
Defines a vector valued BoxData by aliasing a raw pointer to T which should be of size a_box.size()*a_ncomp
. The data in a_ptr
is not copied. This constructor is not recommended for public use, but is provided to facilitate compatability with third party libraries.
a_ptr | Source buffer of type T to which *this will be aliased. The buffer must be allocated based on the same MEMTYPE as this BoxData (e.g. on the CPU if MEMTYPE=MemType::HOST) |
a_box | Box defining the domain of *this |
a_ncomp | (Optional) Dummy input for the number of components. Completely unused. |
|
inline |
Defined Query.
Returns true if this is defined (e.g., it has memory allocated to it). This will return false for default constructed objects and true otherwise
|
inline |
Pointwise Operator.
Computes the function a_F
at each Point of this BoxData. This version of forall returns a new BoxData corresponding to the first argument of a_F
which must be a Var
. The domain of the created output is equal to the intersection of all other BoxData inputs (the function will fail if there are no other inputs). This function MUST specify the template parameters of the output BoxData. See the example code snippet below.
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
|
inline |
Pointwise Operator: Overload with Box Argument.
Computes the function a_F
at each Point of this BoxData. This version of forall returns a new BoxData corresponding to the first argument of a_F
which must be a Var
. This function MUST specify the template parameters of the output BoxData. See the example code snippet below.
In general, this function should not be used unless absolutely necessary. Some valid use cases are:
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_box | Domain of computation. Must be a subset of the intersection of all input domains. |
a_srcs | Inputs (BoxData and primitive data) |
|
inline |
Pointwise Operator with Point Dependence.
Computes the function a_F
at each Point of this BoxData. This version of forall allows the input function to be dependent on the Point at which it is applied. Hence, the first argument of a_F is a Point&, followed by the Var corresponding to the output BoxData This function MUST specify the template parameters of the output BoxData. See the example code snippet below.
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
|
inline |
Pointwise Operator with Point Dependence: Overload with const Box Argument.
Computes the function a_F
at each Point of this BoxData. This version of forall allows the input function to be dependent on the Point at which it is applied. Hence, the first argument of a_F is a Point&, followed by the Var corresponding to the output BoxData This function MUST specify the template parameters of the output BoxData. See the example code snippet below.
In general, this function should not be used unless absolutely necessary. Some valid use cases are:
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
a_box | Domain of computation. Must be a subset of the intersection of all input domains. |
|
inline |
In-Place Pointwise Operator.
Computes the function a_F
at each Point of this BoxData. The "InPlace" versions of forall execute on existing BoxData and do not produce a new array. The domain of the created output is equal to the intersection of all BoxData inputs.
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
|
inline |
In-Place Pointwise Operator on Prescribed Box.
Computes the function a_F
at each Point of this BoxData. The "InPlace" versions of forall execute on existing BoxData and do not produce a new array. a_F
will be applied at all points of the input a_box
.
In general, this function should not be used unless you want to restrict the domain of a_F's application to be something smaller than the intersection of all the inputs.
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
a_box | Domain of computation. Must be a subset of the intersection of all input domains. |
|
inline |
In-Place Pointwise Operator with Point Dependence.
Computes the function a_F
at each Point of this BoxData. This version of forall allows the input function to be dependent on the Point at which it is applied. Hence, the first argument of a_F
is a Point&
, followed by the normal Var
inputs
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
|
inline |
In-Place Pointwise Operator with Point Dependence and Prescribed Box.
Computes the function a_F
at each Point of this BoxData. This version of forall allows the input function to be dependent on the Point at which it is applied. Hence, the first argument of a_F
is a Point&
, followed by the normal Var
inputs
In general, this function should not be used unless you want to restrict the domain of a_F's application to be something smaller than the intersection of all the inputs.
Example Usage: Input Function:
Calling forall:
a_F | Pointwise function |
a_srcs | Inputs (BoxData and primitive data) |
a_box | Domain of computation. Must be a subset of the intersection of all input domains. |
|
inline |
Access Shared Pointer.
Used internally. Not recommended for public use.
< Data array
|
inline |
Upper Bound.
Retrieve the upper bound component for component axis a_comp
a_comp | A component axis in [0,3) |
|
inline |
|
inline |
Check Aliasing.
Returns true if *this
and a_src
are aliased to the same data buffer. This function also returns true if one array is a slice of another.
void Proto::BoxData< T, C, MEMTYPE, D, E >::linearIn | ( | void * | a_buf, |
const Box & | a_box, | ||
CInterval | a_comps | ||
) |
Buffer Read.
Read data into *this from a C-array buffer populated by BoxData<T,C,MEMTYPE,D,E>::linearOut(...). The Box and components may be shifted with respect to those used for the read operation. (The number of component indices along each axis and the shape and size of the Box must be the same). See the example below.
Example Usage:
a_buf | Source buffer |
a_box | Domain to read from |
a_comps | Components to read from |
void Proto::BoxData< T, C, MEMTYPE, D, E >::linearOut | ( | void * | a_buf, |
const Box & | a_box, | ||
CInterval | a_comps | ||
) | const |
Buffer Write.
Write a subset of data from *this
into a C-array buffer.
Example Usage:
a_buf | Destination buffer |
a_box | Domain to write from |
a_comps | Components to write from |
|
inline |
Lower Bound.
Retrieve the lower bound along the given component axis
a_comp | A component axis in [0,3) |
T Proto::BoxData< T, C, MEMTYPE, D, E >::max | ( | ) | const |
Maximum Value (Global)
Returns the maximum value over the entire data set
T Proto::BoxData< T, C, MEMTYPE, D, E >::max | ( | int | a_c, |
int | a_d = 0 , |
||
int | a_e = 0 |
||
) | const |
Maximum Value (Componentwise)
Returns the maximum value of a given component
a_c | First tensor index. |
a_d | Second tensor index. |
a_e | Third tensor index. |
T Proto::BoxData< T, C, MEMTYPE, D, E >::min | ( | ) | const |
Minimum Value (Global)
Returns the minimum value over the entire data set
T Proto::BoxData< T, C, MEMTYPE, D, E >::min | ( | int | a_c, |
int | a_d = 0 , |
||
int | a_e = 0 |
||
) | const |
Minimum Value (Componentwise)
Returns the minimum value of a given component
a_c | First tensor index. |
a_d | Second tensor index. |
a_e | Third tensor index. |
|
inline |
Read Only Data Accessor.
Read-only access to data stored in *this
. This function is read-only to facilitate cross-platform code (e.g. GPU compatability). This function is for debugging ONLY, and will not work on the device. Pointwise write operations should be done through forall.
a_pt | A Point in the domain of *this |
a_c | Value of first tensor index |
a_d | Value of second tensor index |
a_e | Value of third tensor index |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator*= | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_rhs | ) |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator*= | ( | T | scale | ) |
Pointwise Multiplication by Scalar.
Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.
a_scale | A scalare of type T |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator+= | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_rhs | ) |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator+= | ( | T | a_scale | ) |
Pointwise Addition by Scalar.
Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.
a_scale | A scalare of type T |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator-= | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_rhs | ) |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator-= | ( | T | scale | ) |
Pointwise Subtraction by Scalar.
Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.
a_scale | A scalare of type T |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator/= | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_rhs | ) |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator/= | ( | T | scale | ) |
Pointwise Division by Scalar.
Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.
a_scale | A scalare of type T |
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator= | ( | BoxData< T, C, MEMTYPE, D, E > && | a_src | ) |
Move Assignment Operator.
Moves data in a_src to *this without performing a deep copy.
a_src | Source Data |
|
inline |
|
inline |
void Proto::BoxData< T, C, MEMTYPE, D, E >::print | ( | ) | const |
Print.
Default Print method. Outputs Domain Box and extrema of *this
void Proto::BoxData< T, C, MEMTYPE, D, E >::printData | ( | int | a_prec = 2 | ) | const |
Print Data.
Pretty prints all of the data in *this. Prettiness may vary depending on the domain size. Generally looks best with DIM = 2 and Box edge lengths less than ~16. This function is purely for debugging purposes and should not be used in performance code.
a_prec | (Optional) Desired precision for fixed decimal output. Defaults to 2. |
void Proto::BoxData< T, C, MEMTYPE, D, E >::printData | ( | const Box & | a_box, |
int | a_prec = 2 |
||
) | const |
Print Data in Box.
Pretty prints the data in *this within a given Box for all components. Input Boxes of size 16^DIM or smaller are recommended to maintain prettiness. This function is purely for debugging purposes and should not be used in performance code.
a_box | Desired subset for printing |
a_prec | (Optional) Desired precision for fixed decimal output. Defaults to 2. |
void Proto::BoxData< T, C, MEMTYPE, D, E >::printData | ( | const Box & | a_box, |
int | a_c, | ||
int | a_d, | ||
int | a_e, | ||
int | a_prec = 2 |
||
) | const |
Print Component Data in Box.
Pretty prints the data in *this within a given Box for a single component. Input Boxes of size 16^DIM or smaller are recommended to maintain prettiness. This function is purely for debugging purposes and should not be used in performance code.
a_box | Desired subset for printing |
a_c | First tensor index. Defaults to 0. |
a_d | Second tensor index. Defaults to 0. |
a_e | Third tensor index. Defaults to 0. |
a_prec | (Optional) Desired precision for fixed decimal output. Defaults to 2 |
void Proto::BoxData< T, C, MEMTYPE, D, E >::setVal | ( | const T & | a_val | ) |
Initialize All Values.
Avoid calling this function as much as possible in performance critical code
a_val | A constant value. |
void Proto::BoxData< T, C, MEMTYPE, D, E >::setVal | ( | const T & | a_val, |
const Box & | a_box | ||
) |
Set All Values in Box.
Avoid calling this function as much as possible in performance critical code
a_val | A constant value. |
a_box | Domain to set to a_val |
void Proto::BoxData< T, C, MEMTYPE, D, E >::setVal | ( | const T & | a_val, |
const Box & | a_box, | ||
int | a_c, | ||
int | a_d = 0 , |
||
int | a_e = 0 |
||
) |
Set All Values of Component in Box.
Avoid calling this function as much as possible in performance critical code
a_val | A constant value. |
a_box | Domain to set to a_val |
a_c | First index of component to set to a_val. |
a_d | Second index of component to set to a_val. |
a_e | Third index of component to set to a_val. |
|
inline |
|
inline |
Size Query.
Returns the number of components in *this
along the component axis a_comp
a_comp | A component axis in [0,3) |
|
inline |
Returns the number of data points in *this
. Return value is equal to m_box.size()*C*D*E
BoxData<T,1,MEMTYPE,1,1> Proto::slice | ( | const BoxData< T, C, MEMTYPE, D, E > & | a_src, |
unsigned int | a_c, | ||
unsigned int | a_d = 0 , |
||
unsigned int | a_e = 0 |
||
) |
Slice Arbitrary Component (Non-Const)
Creates a BoxData<T,1,1,1> read-write alias to a prescribed component.
BoxData<T,CC,MEMTYPE,1,1> Proto::slice | ( | const BoxData< T, C, MEMTYPE, 1, 1 > & | a_src, |
unsigned int | a_nstart | ||
) |
Slice Arbitrary Component Range (Non-Const)
Creates a BoxData<T,CC,1,1> read-write alias to a prescribed component range
T Proto::BoxData< T, C, MEMTYPE, D, E >::sum | ( | ) | const |
Sum (Global)
Global Sum.
return the sum of values over the entire data set
T Proto::BoxData< T, C, MEMTYPE, D, E >::sum | ( | int | a_c, |
int | a_d = 0 , |
||
int | a_e = 0 |
||
) | const |
sum (Componentwise)
Return the sum of a particular component
a_c | First tensor index. |
a_d | Second tensor index. |
a_e | Third tensor index. |
|
inline |
Create Pointwise Access Variable (Non-Const)
Not for public use
|
inline |
Create Pointwise Access Variable (Const)
Not for public use