Proto
Modules | Data Structures | Functions
Pointwise Operations
Collaboration diagram for Pointwise Operations:

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 alias usage:

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 slice usage:

Box srcBox = Box::Cube(4);
BoxData<double, 1, 2, 3> Src(srcBox);
Src.setVal(17);
// Create an alias to the {1,1,0} component of Src
// Slice and Src are sharing data. slice[srcBox.low(),0,0,0] == Src[srcBox.low(),1,1,0] returns true;
auto Slice = slice(Src, 0, 1);
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)
  • PROTO_KERNEL_START and PROTO_KERNEL_END are required for cross-platform (e.g. GPU compatable) code.
  • The "#_temp" symbols are temporaries; the actual function symbol is the one without "_temp"
  • The template arguments of the first Var argument must match the output BoxData
  • The Point argument in the second signature corresponds to the Point of function application
  • Args... may include any number of Var& or read-only scalars.
  • The elements of Args... may have arbitrary tensor structure and const-ness
  • non-const objects in Args... have input-output semantics
  • The order and template arguments of the Vars in Args... must match the BoxData inputs of forall
  • If F is a member function of a class F MUST BE DECLARED STATIC
  • F or F_p may be an anonymous (lambda) function defined using the PROTO_LAMBDA macro

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.
 
BoxDataProto::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)
 
BoxDataProto::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...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::absMax () const
 Absolute Maximum Value (Global) More...
 
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...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::min () const
 Minimum Value (Global) More...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::min (int a_c, int a_d=0, int a_e=0) const
 Minimum Value (Componentwise) More...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::max () const
 Maximum Value (Global) More...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::max (int a_c, int a_d=0, int a_e=0) const
 Maximum Value (Componentwise) More...
 
Proto::BoxData< T, C, MEMTYPE, D, E >::sum () const
 Sum (Global) More...
 
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...
 

Detailed Description

Function Documentation

◆ __attribute__()

template<typename T, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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.

Parameters
a_cFirst component index
a_dSecond component index (default: 0)
a_eThird component index (default: 0)

◆ absMax() [1/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

◆ absMax() [2/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

◆ absMax() [3/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_cFirst tensor index.
a_dSecond tensor index.
a_eThird tensor index.

◆ alias() [1/2]

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)

Creates a read-write alias to a mutable source BoxData with an optional shift.

◆ alias() [2/2]

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)

Creates a read-only alias to a const source BoxData with an optional shift.

◆ box()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
Box Proto::BoxData< T, C, MEMTYPE, D, E >::box ( ) const
inline

Return's the domain Box of *this . Includes ghost cells if it was built it that way.

◆ BoxData() [1/5]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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;

◆ BoxData() [2/5]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData ( const Box a_box,
bool  a_stackAllocation = DEFAULT_USE_STACK 
)
explicit

Box Constructor.

Creates and allocates an uninitialized array based on a Box input.

Parameters
a_boxBox defining the domain of *this
a_stackAllocationIf true, memory will be allocated with Proto::Stack (default: DEFAULT_USE_STACK);

◆ BoxData() [3/5]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
Proto::BoxData< T, C, MEMTYPE, D, E >::BoxData ( const Box a_box,
a_init 
)

Box Constructor With Initialization.

Identical to calling the Box constructor followed by setVal(a_init). Not recommended in performance-critical code if initialization is unnecessary.

Parameters
a_boxBox defining the domain of *this
a_initT value used to initialize all data values

◆ BoxData() [4/5]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_srcSource data

◆ BoxData() [5/5]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_ptrSource 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_boxBox defining the domain of *this
a_ncomp(Optional) Dummy input for the number of components. Completely unused.

◆ CInterval() [1/2]

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 
)
inline

Bounds Constructor.

Builds the interval: {{a_c0, a_c1},{a_d0, a_d1},{a_e0, a_e1}}

◆ CInterval() [2/2]

Proto::CInterval::CInterval ( std::initializer_list< std::initializer_list< unsigned int >>  a_lst)
inline

List Constructor.

Build a CInterval using the syntax:

CInterval I0{{c0, c1},{d0, d1},{e0, e1}};
// OR
CInterval I1({{c0, c1},{d0, d1},{e0, e1}});
// Or, for a single component index:
CInterval I2{c0, c1};
// OR
CInterval I3({c0, c1});

◆ contains() [1/2]

bool Proto::CInterval::contains ( unsigned int  a_index,
unsigned int  a_comp 
) const
inline

Contains Query.

Query if *this contains index of component comp

Parameters
a_indexAn index
a_compA component axis in [0,3)

◆ contains() [2/2]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
bool Proto::BoxData< T, C, MEMTYPE, D, E >::contains ( CInterval  a_interval) const
inline

Contains CInterval.

Checks if an CInterval object is a subset of the component space of *this. This function is mostly used internally, but it can be useful for checking inputs to CopyTo and the slicing functions

◆ copy()

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

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.

Parameters
a_dsrcSource data
a_srcBoxSource domain to copy from
a_srcCompFirst component to copy from source
a_destBoxDestination domain to copy into
a_destCompFirst component to copy into destiation
a_numcompNumber of components to copy

◆ copyTo() [1/4]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_destDestination data holder

◆ copyTo() [2/4]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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) .

Parameters
a_destDestination data holder
a_srcBoxRegion of data to copy from *this
a_destShift(Optional) Determines region of a_dest to copy data to.

◆ copyTo() [3/4]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

◆ copyTo() [4/4]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

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:

// Defining inputs
Box srcBox = Box::Cube(4); //[(0,..,0), (3,...,3)]
Box destBox = Box::Cube(4).shift(Point::Ones()); //[(1,...,1), (4,...,4)]
BoxData<double, 3, 3> Src(srcBox);
Src.setVal(7); //Initialize data as 7
BoxData<double, 2, 2> Dest(destBox); //Destination data is uninitialized
Point copyShift = Point::Ones(2); //(2,...,2)
Box srcCopyBox = Box::Cube(3); //[(0,...,0), (2,...,2)]
// Call copyTo
// This statement copies the data of components {{1,2},{1,2},{0,0}} of Src within [(0,...,0), (2,...,2)]
// into the components {{0,1},{0,1},{0,0}} of Dest within the Box [(2,...,2), (4,...,4)].
Src.copyTo(Dest, // Destination data
srcCopyBox, // Box to copy out of Src
{{1,2},{1,2},{}}, // Components to copy out of Src defined by an in-place constructed CInterval
copyShift, // Amount to shift srcCopyBox by in the destination
{{0,1},{0,1},{}}); // Components to copy into Dest defined by an in-place constructed CInterval
Parameters
a_destDestination data holder
a_srcBoxRegion of data to copy from *this
a_srcCompsComponents of *this to copy from
a_destShiftDetermines region of a_dest to copy data to (e.g. a_srcBox.shift(a_destShift))
a_destCompsComponents of a_dest to copy into. Must be the same size as a_srcComps.

◆ data() [1/4]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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
inline

Read-Write Accessor (Const)

Return a const pointer to a data point in *this given a Point and tensor indices.

Parameters
a_pPoint in the domain of this
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.

◆ data() [2/4]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
T* Proto::BoxData< T, C, MEMTYPE, D, E >::data ( )
inline

Buffer Accessor (Non-Const)

Return the contiguous data buffer where the data in *this is stored. Not recommended for public use.

◆ data() [3/4]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
const T* Proto::BoxData< T, C, MEMTYPE, D, E >::data ( ) const
inline

Buffer Accessor (Const)

Return the contiguous data buffer where the data in *this is stored. Not recommended for public use.

◆ data() [4/4]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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 
)
inline

Read-Write Accessor (Non-Const)

Return a pointer to a data point in *this given a Point and tensor indices.

Parameters
a_pPoint in the domain of this
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.

◆ dataPtr() [1/2]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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
inline

Read-Write Accessor (Const)

Return a pointer to the region of the data buffer where a given component starts.

Parameters
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.

◆ dataPtr() [2/2]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
T* Proto::BoxData< T, C, MEMTYPE, D, E >::dataPtr ( unsigned int  a_c = 0,
unsigned int  a_d = 0,
unsigned int  a_e = 0 
)
inline

Read-Write Accessor (Non-Const)

Return a pointer to the region of the data buffer where a given component starts.

Parameters
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.

◆ define() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
void Proto::BoxData< T, C, MEMTYPE, D, E >::define ( const Box a_box,
bool  a_stackAllocation = DEFAULT_USE_STACK 
)

Box Define.

Allocates or reallocates memory for a previously declared BoxData. Any existing data in *this is thrown away.

Parameters
a_boxBox defining the domain of *this
a_stackAllocationIf true, memory will be allocated with Proto::Stack (default: DEFAULT_USE_STACK);

◆ define() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_ptrSource 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_boxBox defining the domain of *this
a_ncomp(Optional) Dummy input for the number of components. Completely unused.

◆ defined()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
bool Proto::BoxData< T, C, MEMTYPE, D, E >::defined ( ) const
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

◆ forall() [1/2]

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 
)
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:

// This function is a physical example used in the Proto Euler example.
// The input U contains the independent variables of the Euler equations in conservation form (e.g. rho*v_x)
// The output W contains the corresponding primary variables (e.g. rho, v_x, v_y, etc.)
PROTO_KERNEL_START
void consToPrim_temp(Var<double,DIM+2>& W,
const Var<double, DIM+2>& U,
double gamma)
{
double rho = U(0);
double v2 = 0.0;
W(0) = rho;
for (int i = 1; i <= DIM; i++)
{
double v;
v = U(i) / rho;
W(i) = v;
v2 += v*v;
}
W(DIM+1) = (U(DIM+1) - .5 * rho * v2) * (gamma - 1.0);
}
PROTO_KERNEL_END(consToPrim_temp, consToPrim)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
BoxData<double,DIM+2> U(srcBox);
U.setVal(1);
const double gamma = 1.4;
// Call forall to create and initialize a new BoxData<double, DIM+2> W
auto W1 = forall<double, DIM+2>(consToPrim, U, gamma);
// Equivalent computation but without "auto"
BoxData<double, DIM+2> W2 = forall<double, DIM+2>(consToPrim, U, gamma);
// The Box on which the output is defined is the intersection of all the input BoxData.
// In this case, there is only one BoxData - U - So the output will have the same Box as U.
// The versions of forall that return a new BoxData have MANDATORY template arguments
// which must match those of the output BoxData.
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
Template Parameters
T(Mandatory!) Data type of return BoxData
C(Optional) Size of first component axis of return BoxData. Defaults to 1
D(Optional) Size of second component axis of return BoxData. Defaults to 1
E(Optional) Size of third component axis of return BoxData. Defaults to 1

◆ forall() [2/2]

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 
)
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:

  • Creating and initializing a BoxData without any BoxData inputs
  • Evaluating a pointwise function on a Box that is a proper subset of the intersection of all input BoxData

Example Usage: Input Function:

// This function is a physical example used in the Proto Euler example.
// The input U contains the independent variables of the Euler equations in conservation form (e.g. rho*v_x)
// The output W contains the corresponding primary variables (e.g. rho, v_x, v_y, etc.)
PROTO_KERNEL_START
void consToPrim_temp(Var<double,DIM+2>& W,
const Var<double, DIM+2>& U,
double gamma)
{
double rho = U(0);
double v2 = 0.0;
W(0) = rho;
for (int i = 1; i <= DIM; i++)
{
double v;
v = U(i) / rho;
W(i) = v;
v2 += v*v;
}
W(DIM+1) = (U(DIM+1) - .5 * rho * v2) * (gamma - 1.0);
}
PROTO_KERNEL_END(consToPrim_temp, consToPrim)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3); // Defining the output domain
BoxData<double,DIM+2> U(srcBox);
U.setVal(1);
const double gamma = 1.4;
// Call forall to create and initialize a new BoxData<double, DIM+2> W
auto W1 = forall<double, DIM+2>(consToPrim, destBox, U, gamma);
// Equivalent computation but without "auto"
BoxData<double, DIM+2> W2 = forall<double, DIM+2>(consToPrim, destBox, U, gamma);
// Here, the output will be defined on the input Box destBox.
// The versions of forall that return a new BoxData have MANDATORY template arguments
// which must match those of the output BoxData.
Parameters
a_FPointwise function
a_boxDomain of computation. Must be a subset of the intersection of all input domains.
a_srcsInputs (BoxData and primitive data)
Template Parameters
T(Mandatory!) Data type of return BoxData
C(Optional) Size of first component axis of return BoxData. Defaults to 1
D(Optional) Size of second component axis of return BoxData. Defaults to 1
E(Optional) Size of third component axis of return BoxData. Defaults to 1

◆ forall_p() [1/2]

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 
)
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:

// Sample Function: Y = sine(x_0+phase) + sin(x_1 + phase) + ...
PROTO_KERNEL_START
void sineFunc_temp(Point& a_p,
Var<double>& a_Y,
const Var<double,DIM>& a_X,
double phase)
{
a_Y(0) = 0.0;
for (int ii = 0; ii < DIM; ii++)
{
a_Y(0) += sin(a_X(ii) + phase);
}
}
PROTO_KERNEL_END(sineFunc_temp, sineFunc)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
BoxData<double,DIM> X(srcBox);
X.setVal(1);
const double phase = M_PI/4.0;
// Call forall to create and initialize a new BoxData<double, DIM+2> W
auto Y1 = forall_p<double>(sineFunc, X, phase);
// Equivalent computation but without "auto"
BoxData<double> Y2 = forall_p<double>(sineFunc, X, phase);
// The Box on which the output is defined is the intersection of all the input BoxData.
// In this case, there is only one BoxData - X - So the output will have the same Box as X.
// The versions of forall that return a new BoxData have MANDATORY template arguments
// which must match those of the output BoxData.
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
Template Parameters
T(Mandatory!) Data type of return BoxData
C(Optional) Size of first component axis of return BoxData. Defaults to 1
D(Optional) Size of second component axis of return BoxData. Defaults to 1
E(Optional) Size of third component axis of return BoxData. Defaults to 1

◆ forall_p() [2/2]

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 
)
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:

  • Creating and initializing a BoxData with only spatial dependence(e.g. F = f(x,y,z,dx,dy,dx)
  • Evaluating a pointwise function on a Box that is a proper subset of the intersection of all input BoxData

Example Usage: Input Function:

// Sample Function: Y = sine(x_0+phase) + sin(x_1 + phase) + ...
PROTO_KERNEL_START
void sineFunc_temp(Point& a_p,
Var<double>& a_Y,
const Var<double,DIM>& a_X,
double phase)
{
a_Y(0) = 0.0;
for (int ii = 0; ii < DIM; ii++)
{
a_Y(0) += sin(a_X(ii) + phase);
}
}
PROTO_KERNEL_END(sineFunc_temp, sineFunc)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3);
BoxData<double,DIM> X(srcBox);
X.setVal(1);
const double phase = M_PI/4.0;
// Call forall to create and initialize a new BoxData<double, DIM+2> W
auto Y1 = forall_p<double>(sineFunc, destBox, X, phase);
// Equivalent computation but without "auto"
BoxData<double> Y2 = forall_p<double>(sineFunc, destBox, X, phase);
// Here, the output will be defined on the input Box destBox.
// The versions of forall that return a new BoxData have MANDATORY template arguments
// which must match those of the output BoxData.
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
a_boxDomain of computation. Must be a subset of the intersection of all input domains.
Template Parameters
T(Mandatory!) Data type of return BoxData
C(Optional) Size of first component axis of return BoxData. Defaults to 1
D(Optional) Size of second component axis of return BoxData. Defaults to 1
E(Optional) Size of third component axis of return BoxData. Defaults to 1

◆ forallInPlace() [1/2]

template<typename Func , typename... Srcs>
void Proto::forallInPlace ( const Func &  a_F,
Srcs &&...  a_srcs 
)
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:

// This function is a physical example used in the Proto Euler example.
// The input U contains the independent variables of the Euler equations in conservation form (e.g. rho*v_x)
// The output W contains the corresponding primary variables (e.g. rho, v_x, v_y, etc.)
PROTO_KERNEL_START
void consToPrim_temp(Var<double,DIM+2>& W,
const Var<double, DIM+2>& U,
double gamma)
{
double rho = U(0);
double v2 = 0.0;
W(0) = rho;
for (int i = 1; i <= DIM; i++)
{
double v;
v = U(i) / rho;
W(i) = v;
v2 += v*v;
}
W(DIM+1) = (U(DIM+1) - .5 * rho * v2) * (gamma - 1.0);
}
PROTO_KERNEL_END(consToPrim_temp, consToPrim)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3);
BoxData<double,DIM+2> U(srcBox);
U.setVal(1);
BoxData<double,DIM+2> W(destBox);
const double gamma = 1.4;
// Call forall to initialize W
forallInPlace(consToPrim, W, U, gamma);
// The Box on which the computation will be done is the intersection of all the input BoxData domains
// In this case, the domain will be srcBox & destBox = destBox
// The "InPlace" versions of forall do not require template arguments
// In fact, they may not compile if the template arguments are provided, even if they are correct
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)

◆ forallInPlace() [2/2]

template<typename Func , typename... Srcs>
void Proto::forallInPlace ( const Func &  a_F,
Box  a_box,
Srcs &&...  a_srcs 
)
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:

// This function is a physical example used in the Proto Euler example.
// The input U contains the independent variables of the Euler equations in conservation form (e.g. rho*v_x)
// The output W contains the corresponding primary variables (e.g. rho, v_x, v_y, etc.)
PROTO_KERNEL_START
void consToPrim_temp(Var<double,DIM+2>& W,
const Var<double, DIM+2>& U,
double gamma)
{
double rho = U(0);
double v2 = 0.0;
W(0) = rho;
for (int i = 1; i <= DIM; i++)
{
double v;
v = U(i) / rho;
W(i) = v;
v2 += v*v;
}
W(DIM+1) = (U(DIM+1) - .5 * rho * v2) * (gamma - 1.0);
}
PROTO_KERNEL_END(consToPrim_temp, consToPrim)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3);
Box computeBox = Box::Cube(2);
BoxData<double,DIM+2> U(srcBox);
U.setVal(1);
BoxData<double,DIM+2> W(destBox);
const double gamma = 1.4;
// Call forall to initialize W
forallInPlace(consToPrim, computeBox, W, U, gamma);
// The computation is restricted to the Points in computeBox
// The "InPlace" versions of forall do not require template arguments
// In fact, they may not compile if the template arguments are provided, even if they are correct
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
a_boxDomain of computation. Must be a subset of the intersection of all input domains.

◆ forallInPlace_p() [1/2]

template<typename Func , typename... Srcs>
void Proto::forallInPlace_p ( const Func &  a_F,
Srcs &&...  a_srcs 
)
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:

// Sample Function: Y = sine(x_0+phase) + sin(x_1 + phase) + ...
PROTO_KERNEL_START
void sineFunc_temp(Point& a_p,
Var<double>& a_Y,
const Var<double,DIM>& a_X,
double phase)
{
a_Y(0) = 0.0;
for (int ii = 0; ii < DIM; ii++)
{
a_Y(0) += sin(a_X(ii) + phase);
}
}
PROTO_KERNEL_END(sineFunc_temp, sineFunc)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3);
BoxData<double,DIM> X(srcBox);
X.setVal(1);
BoxData<double> Y(destBox);
const double phase = M_PI/4.0;
// Call forall to create and initialize Y
forallInPlace_p(sineFunc, Y, X, phase);
// The Box on which the output is defined is the intersection of all the input BoxData.
// In this case, the computation is done on srcBox & destBox = destBox.
// The "InPlace" versions of forall do not require template arguments
// In fact, they may not compile if the template arguments are provided, even if they are correct
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)

◆ forallInPlace_p() [2/2]

template<typename Func , typename... Srcs>
void Proto::forallInPlace_p ( const Func &  a_F,
Box  a_box,
Srcs &&...  a_srcs 
)
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:

// Sample Function: Y = sine(x_0+phase) + sin(x_1 + phase) + ...
PROTO_KERNEL_START
void sineFunc_temp(Point& a_p,
Var<double>& a_Y,
const Var<double,DIM>& a_X,
double phase)
{
a_Y(0) = 0.0;
for (int ii = 0; ii < DIM; ii++)
{
a_Y(0) += sin(a_X(ii) + phase);
}
}
PROTO_KERNEL_END(sineFunc_temp, sineFunc)

Calling forall:

// Define inputs
Box srcBox = Box::Cube(4);
Box destBox = Box::Cube(3);
Box computeBox = Box::Cube(2);
BoxData<double,DIM> X(srcBox);
X.setVal(1);
BoxData<double> Y(destBox);
const double phase = M_PI/4.0;
// Call forall to create and initialize Y
forallInPlace_p(sineFunc, computeBox, Y, X, phase);
// The compution is restricted to computeBox
// The "InPlace" versions of forall do not require template arguments
// In fact, they may not compile if the template arguments are provided, even if they are correct
Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
a_boxDomain of computation. Must be a subset of the intersection of all input domains.

◆ getData()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
shared_ptr<T> Proto::BoxData< T, C, MEMTYPE, D, E >::getData ( ) const
inline

Access Shared Pointer.

Used internally. Not recommended for public use.

< Data array

◆ high()

unsigned int Proto::CInterval::high ( unsigned int  a_comp) const
inline

Upper Bound.

Retrieve the upper bound component for component axis a_comp

Parameters
a_compA component axis in [0,3)

◆ index()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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
inline

Compute Index.

Computes the index in [0,this->size()) associated with a given Point and components

Parameters
a_ptA Point in the domain of *this
a_cValue of first tensor index
a_dValue of second tensor index
a_eValue of third tensor index

◆ isAlias()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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
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.

◆ linearIn()

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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:

Parameters
a_bufSource buffer
a_boxDomain to read from
a_compsComponents to read from

◆ linearOut()

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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:

Box srcBox = Box::Cube(4); //[(0,..,0), (3,...,3)]
Box destBox = Box::Cube(4).shift(Point::Ones()); //[(1,...,1), (4,...,4)]
BoxData<double, 3, 3> Src(srcBox);
Src.setVal(7);
BoxData<double, 2, 2> Dest(destBox); //Destination data is uninitialized
Point copyShift = Point::Ones(2); //(2,...,2)
Box srcCopyBox = Box::Cube(3); //[(0,...,0), (2,...,2)]
double buffer[Src.box().size()*2*2];
// Copy data from Src into the buffer
Src.linearOut(buffer, srcCopyBox, {{1,2},{1,2},{}});
// ... Operate on the buffer, send it in an MPI message, etc. ...
// Copy data from buffer into Dest
Dest.linearIn(buffer, srcCopyBox.shift(copyShift), {{0,1},{0,1},{}});
Parameters
a_bufDestination buffer
a_boxDomain to write from
a_compsComponents to write from

◆ low()

unsigned int Proto::CInterval::low ( unsigned int  a_comp) const
inline

Lower Bound.

Retrieve the lower bound along the given component axis

Parameters
a_compA component axis in [0,3)

◆ max() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
T Proto::BoxData< T, C, MEMTYPE, D, E >::max ( ) const

Maximum Value (Global)

Returns the maximum value over the entire data set

◆ max() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_cFirst tensor index.
a_dSecond tensor index.
a_eThird tensor index.

◆ min() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
T Proto::BoxData< T, C, MEMTYPE, D, E >::min ( ) const

Minimum Value (Global)

Returns the minimum value over the entire data set

◆ min() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_cFirst tensor index.
a_dSecond tensor index.
a_eThird tensor index.

◆ operator()()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
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
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.

Parameters
a_ptA Point in the domain of *this
a_cValue of first tensor index
a_dValue of second tensor index
a_eValue of third tensor index

◆ operator*=() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_rhsAnother BoxData

◆ operator*=() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator*= ( scale)

Pointwise Multiplication by Scalar.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_scaleA scalare of type T

◆ operator+=() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_rhsAnother BoxData

◆ operator+=() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator+= ( a_scale)

Pointwise Addition by Scalar.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_scaleA scalare of type T

◆ operator-=() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_rhsAnother BoxData

◆ operator-=() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator-= ( scale)

Pointwise Subtraction by Scalar.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_scaleA scalare of type T

◆ operator/=() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_rhsAnother BoxData

◆ operator/=() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
BoxData< T, C, MEMTYPE, D, E > & Proto::BoxData< T, C, MEMTYPE, D, E >::operator/= ( scale)

Pointwise Division by Scalar.

Not recommended for performance unless necessary. Try to fuse arithmetic operations into forall or Stencil operations if possible.

Parameters
a_scaleA scalare of type T

◆ operator=()

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_srcSource Data

◆ operator[]() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
T * Proto::BoxData< T, C, MEMTYPE, D, E >::operator[] ( unsigned int  a_index)
inline

Index Accessor (Non-Const)

Access *this using a linear index. Useful for interacting with BoxData like a regular buffer, but not recommended.

Parameters
a_indexIndex in [0,this->size() = m_box.size()*C*D*E)

◆ operator[]() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
const T * Proto::BoxData< T, C, MEMTYPE, D, E >::operator[] ( unsigned int  a_index) const
inline

Index Accessor (Const)

Access *this using a linear index. Useful for interacting with BoxData like a regular buffer, but not recommended.

Parameters
a_indexIndex in [0,this->size() = m_box.size()*C*D*E)

◆ print()

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
void Proto::BoxData< T, C, MEMTYPE, D, E >::print ( ) const

Print.

Default Print method. Outputs Domain Box and extrema of *this

◆ printData() [1/3]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_prec(Optional) Desired precision for fixed decimal output. Defaults to 2.

◆ printData() [2/3]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_boxDesired subset for printing
a_prec(Optional) Desired precision for fixed decimal output. Defaults to 2.

◆ printData() [3/3]

template<typename T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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.

Parameters
a_boxDesired subset for printing
a_cFirst tensor index. Defaults to 0.
a_dSecond tensor index. Defaults to 0.
a_eThird tensor index. Defaults to 0.
a_prec(Optional) Desired precision for fixed decimal output. Defaults to 2

◆ setVal() [1/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_valA constant value.

◆ setVal() [2/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_valA constant value.
a_boxDomain to set to a_val

◆ setVal() [3/3]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_valA constant value.
a_boxDomain to set to a_val
a_cFirst index of component to set to a_val.
a_dSecond index of component to set to a_val.
a_eThird index of component to set to a_val.

◆ shift()

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
void Proto::BoxData< T, C, MEMTYPE, D, E >::shift ( const Point  a_pt)
inline

Shift Domain.

Shifts the domain Box of this, moving all data along with it. e.g. data associated with Point p will now be associated with Point p + a_pt.

Parameters
a_ptA Point interpreted as a shift vector.

◆ size() [1/2]

unsigned int Proto::CInterval::size ( unsigned int  a_comp) const
inline

Size Query.

Returns the number of components in *this along the component axis a_comp

Parameters
a_compA component axis in [0,3)

◆ size() [2/2]

template<class T = double, unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned char D = 1, unsigned char E = 1>
std::size_t Proto::BoxData< T, C, MEMTYPE, D, E >::size ( ) const
inline

Returns the number of data points in *this . Return value is equal to m_box.size()*C*D*E

◆ slice() [1/2]

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)

Creates a BoxData<T,1,1,1> read-write alias to a prescribed component.

◆ slice() [2/2]

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)

Creates a BoxData<T,CC,1,1> read-write alias to a prescribed component range

◆ sum() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
T Proto::BoxData< T, C, MEMTYPE, D, E >::sum ( ) const

Sum (Global)

Global Sum.

return the sum of values over the entire data set

◆ sum() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
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

Parameters
a_cFirst tensor index.
a_dSecond tensor index.
a_eThird tensor index.

◆ var() [1/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
Var< T, C, MEMTYPE, D, E > Proto::BoxData< T, C, MEMTYPE, D, E >::var ( const Point a_pt)
inline

Create Pointwise Access Variable (Non-Const)

Not for public use

◆ var() [2/2]

template<class T , unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E>
Var< T, C, MEMTYPE, D, E > Proto::BoxData< T, C, MEMTYPE, D, E >::var ( const Point a_pt) const
inline

Create Pointwise Access Variable (Const)

Not for public use