Proto  3.2
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
Proto::BoxData< T, C, MEM, D, E > Class Template Reference

Multidimensional Rectangular Array. More...

#include <Proto_BoxData.H>

Public Types

typedef Var< T, C, MEM, D, E > reference
 

Public Member Functions

 BoxData (const BoxData< T, C, MEM, D, E > &a_src)=delete
 Forbidden Functions. More...
 
BoxDataoperator= (const BoxData< T, C, MEM, D, E > &a_src)=delete
 
size_t size (const Box &a_box, const size_t a_comps) const
 
size_t charsize (const ::Proto::Box &a_bx, unsigned int a_startcomp, unsigned int a_numcomps) const
 
Data Movement
BoxDataoperator= (BoxData< T, C, MEM, D, E > &&a_src)
 Move Assignment Operator. More...
 
template<MemType MEM_DEST>
void copyTo (BoxData< T, C, MEM_DEST, D, E > &a_dest) const
 Copy on Intersection. More...
 
template<MemType MEM_DEST>
void copyTo (BoxData< T, C, MEM_DEST, D, E > &a_dest, const Box &a_srcBox, const Point &a_destShift=Point::Zeros()) const
 Copy Region. More...
 
template<MemType MEM_DEST>
void copyTo (BoxData< T, C, MEM_DEST, D, E > &a_dest, const Box &a_srcBox, const Box &a_destBox) const
 Copy with src and dest boxes. More...
 
template<unsigned int Cdest, MemType MEM_DEST, unsigned int Ddest, unsigned int Edest>
void copyTo (BoxData< T, Cdest, MEM_DEST, 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 copy (const BoxData< T, Csrc, MEM, 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...
 
void copyTo (BoxData< T, C, MEM, D, E > &a_dst, const CoordPermutation &a_rotation) const
 Copy With Rotation. More...
 
BoxData< T, C, MEM, D, E > transpose (int c0, int c1) const
 Create a new BoxData that is transposed relative to this. More...
 
void rotate (Box a_box, const CoordPermutation &a_rotation)
 Rotate Coordinates. More...
 
Utility
void setVal (const T &a_val)
 Initialize All Values. More...
 
void setToZero ()
 Clamp Values. More...
 
void setVal (const T &a_val, const Box &a_box)
 Set All Values in Box. More...
 
void 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 setRandom (T a_low, T a_high)
 Set Random Noise. More...
 
template<Proto::Operation OP>
void reduce (Reduction< T, OP, MEM > &a_Rxn) const
 Generic Reduction (Global) More...
 
template<Proto::Operation OP>
void reduce (Reduction< T, OP, MEM > &a_Rxn, int a_c, int a_d=0, int a_e=0) const
 Generic Reduction (Componentwise) More...
 
absMax () const
 Absolute Maximum Value (Global) More...
 
absMax (int a_c, int a_d=0, int a_e=0) const
 Absolute Maximum Value (Componentwise) More...
 
void absMax (Reduction< T, Abs, MEM > &a_Rxn) const
 Absolute Maximum Value (Global, Reduction) More...
 
void absMax (Reduction< T, Abs, MEM > &a_Rxn, int a_c, int a_d=0, int a_e=0) const
 Absolute Maximum Value (Componentwise, Reduction) More...
 
min () const
 Minimum Value (Global) More...
 
min (int a_c, int a_d=0, int a_e=0) const
 Minimum Value (Componentwise) More...
 
void min (Reduction< T, Min, MEM > &a_rxn) const
 Minimum Value (Global, Reduction) More...
 
void min (Reduction< T, Min, MEM > &a_rxn, int a_c, int a_d=0, int a_e=0) const
 Minimum Value (Componentwise, Reduction) More...
 
max () const
 Maximum Value (Global) More...
 
max (int a_c, int a_d=0, int a_e=0) const
 Maximum Value (Componentwise) More...
 
void max (Reduction< T, Max, MEM > &a_rxn) const
 Max (Global, Reduction) More...
 
void max (Reduction< T, Max, MEM > &a_rxn, int a_c, int a_d=0, int a_e=0) const
 Max (Componentwise, Reduction) More...
 
sum () const
 Sum (Global) More...
 
sum (int a_c, int a_d=0, int a_e=0) const
 Sum (Componentwise) More...
 
void sum (Reduction< T, Sum, MEM > &a_rxn) const
 Sum (Global, Reduction) More...
 
void sum (Reduction< T, Sum, MEM > &a_rxn, int a_c, int a_d=0, int a_e=0) const
 Sum (Componentwise) More...
 
sumAbs () const
 Sum Abs(Global) More...
 
sumAbs (int a_c, int a_d=0, int a_e=0) const
 Sum Abs(Componentwise) More...
 
void sumAbs (Reduction< T, SumAbs, MEM > &a_rxn) const
 Sum Abs (Global, Reduction) More...
 
void sumAbs (Reduction< T, SumAbs, MEM > &a_rxn, int a_c, int a_d=0, int a_e=0) const
 Sum (Componentwise) More...
 
sumSquare () const
 
sumSquare (int a_c, int a_d=0, int a_e=0) const
 
void sumSquare (Reduction< T, SumSquare, MEM > &a_rxn) const
 
void sumSquare (Reduction< T, SumSquare, MEM > &a_rxn, int a_c, int a_d=0, int a_e=0) const
 
integrate (T a_dx, int a_c=0, int a_d=0, int a_e=0) const
 Integrate (Isotropic Grid) More...
 
integrate (Array< T, DIM > a_dx, int a_c=0, int a_d=0, int a_e=0) const
 Integrate (Anisotropic Grid) More...
 
void shift (const Point &a_shift) const
 Shift Domain. More...
 
size_t linearSize () const
 Buffer Size. More...
 
void linearOut (void *a_buffer, const Box &a_box, CInterval a_comps) const
 Buffer Write. More...
 
void linearOut (void *a_buffer, const Box &a_box, unsigned int a_startcomp, unsigned int a_numcomps) const
 Buffer Write (Primitive) More...
 
void linearIn (void *a_buffer, const Box &a_box, CInterval a_comps)
 Buffer Read. More...
 
void linearIn (void *a_buffer, const ::Proto::Box &a_bx, unsigned int a_startcomp, unsigned int a_numcomps)
 Buffer Read. More...
 
bool contains (CInterval a_interval) const
 Contains CInterval. More...
 
template<unsigned int CC, unsigned int DD, unsigned int EE>
bool isAlias (const BoxData< T, CC, MEM, DD, EE > &a_src) const
 Check Aliasing. More...
 
void print () const
 Print. More...
 
void printData (int a_prec=2) const
 Print Data. More...
 
void printData (const Box &a_box, int a_prec=2) const
 Print Data in Box. More...
 
void 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...
 
bool containsInfOrNAN () const
 
bool containsInfOrNAN (Box domain) const
 
bool containsUninitialized () const
 
bool containsUninitialized (Box domain) const
 
bool containsAddress (T *address) const
 

Static Public Member Functions

static int preAllocatable ()
 
static int memTypeAllocation ()
 

Private Attributes

bool m_alias
 was this created as an alias More...
 
bool m_stackAlloc
 
Box m_box
 Box defining the domain of *this. More...
 
::std::shared_ptr< T > m_data
 Data array. More...
 
T * m_rawPtr
 Raw pointer to the data. More...
 

Friends

template<class TT >
class Stencil
 
template<class TT , unsigned int CC, unsigned int DD, unsigned int EE, MemType MM>
BoxData< TT, CC, MM, DD, EE > alias (BoxData< TT, CC, MM, DD, EE > &a_original, const Point &a_shift)
 
template<class TT , unsigned int CC, unsigned int DD, unsigned int EE, MemType MM>
const BoxData< TT, CC, MM, DD, EE > alias (const BoxData< TT, CC, MM, DD, EE > &a_original, const Point &a_shift)
 
template<typename _T , unsigned int _C, MemType _MEM, unsigned int _D, unsigned int _E>
BoxData< _T, 1, _MEM, 1, 1 > slice (const BoxData< _T, _C, _MEM, _D, _E > &a_src, unsigned int a_c, unsigned int a_d, unsigned int a_e)
 
template<typename _T , unsigned int _C, unsigned int _CC, MemType _MEM>
BoxData< _T, _CC, _MEM, 1, 1 > slice (const BoxData< _T, _C, _MEM, 1, 1 > &a_src, unsigned int a_nstart)
 
template<typename _T , unsigned int _C, unsigned int _D, MemType _MEM>
BoxData< _T, _C, _MEM, 1, 1 > plane (const BoxData< _T, _C, _MEM, _D, 1 > &a_src, unsigned int a_d)
 

Constructors and Define

 BoxData ()
 Default Constructor. More...
 
 BoxData (const Box &a_box)
 Box Constructor. More...
 
 BoxData (const Box &a_box, T a_init)
 Box Constructor With Initialization. More...
 
 BoxData (BoxData< T, C, MEM, D, E > &&a_src)
 Move constructor. More...
 
void define (const Box &a_box)
 Box Define. More...
 
 BoxData (const T *a_ptr, const Box &a_box, int a_ncomp=C)
 Raw Pointer Alias Constructor. More...
 
void define (const T *a_ptr, const Box &a_box, int a_ncomp=C)
 Raw Pointer Alias Define. More...
 
 BoxData (LazyInterpStencil< T, C, MEM, D, E > &&a_op)
 
 ~BoxData ()
 Destructor. More...
 
template<unsigned int ncomp>
void define (BoxData< T, ncomp, MEM, 1, 1 > &a_input, unsigned int &a_comp)
 Alias Define. More...
 
 BoxData (LazyStencil< T, C, MEM, D, E > &&a_op)
 LazyStencil Constructor. More...
 
 BoxData (shared_ptr< T > a_data, const T *a_ptr, const Box &a_box)
 Slice Constructor. More...
 

Accessors

ACCEL_DECORATION size_t index (const Point a_pt, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const
 Compute Index. More...
 
ACCEL_DECORATION T & operator() (const Point &a_pt, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const
 Point Accessor. More...
 
ACCEL_DECORATION Array< T, C *D *E > array (const Point &a_pt) const
 Array Accessor. More...
 
const T * operator[] (unsigned int a_index) const
 Index Accessor (Const) More...
 
T * operator[] (unsigned int a_index)
 Index Accessor (Non-Const) More...
 
const T * data (const Point &a_p, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const
 Pointer Accessor (Const) More...
 
T * data (const Point &a_p, unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0)
 Pointer Accessor (Non-Const) More...
 
T * data (unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0)
 Buffer Accessor (Non-Const) More...
 
const T * data (unsigned int a_c=0, unsigned int a_d=0, unsigned int a_e=0) const
 Buffer Accessor (Const) More...
 
inline ::std::shared_ptr< T > aliasData ()
 Shared Buffer Accessor. More...
 
inline ::std::shared_ptr< T > aliasData () const
 Shared Buffer Accessor (Const) More...
 
Box box () const
 
std::size_t size () const
 
std::size_t numValues () const
 
bool defined () const
 Defined Query. More...
 
Var< T, C, MEM, D, E > var (const Point &a_pt)
 Create Pointwise Access Variable (Non-Const) More...
 
Var< T, C, MEM, D, E > var (const Point &a_pt) const
 Create Pointwise Access Variable (Const) More...
 

Algebraic Operations

BoxData< T, C, MEM, D, E > operator+ (const BoxData< T, C, MEM, D, E > &a_rhs) const
 Pointwise Addition on Intersection. More...
 
BoxData< T, C, MEM, D, E > operator- (const BoxData< T, C, MEM, D, E > &a_rhs) const
 Pointwise Subtraction on Intersection. More...
 
BoxData< T, C, MEM, D, E > operator* (const BoxData< T, C, MEM, D, E > &a_rhs) const
 Pointwise Multiplication on Intersection. More...
 
BoxData< T, C, MEM, D, E > operator/ (const BoxData< T, C, MEM, D, E > &a_rhs) const
 Pointwise Division on Intersection. More...
 
BoxData< T, C, MEM, D, E > & operator+= (const BoxData< T, C, MEM, D, E > &a_rhs)
 Pointwise Addition on Intersection. More...
 
BoxData< T, C, MEM, D, E > & operator-= (const BoxData< T, C, MEM, D, E > &a_rhs)
 Pointwise Subtraction on Intersection. More...
 
BoxData< T, C, MEM, D, E > & operator*= (const BoxData< T, C, MEM, D, E > &a_rhs)
 Pointwise Multiplication on Intersection. More...
 
BoxData< T, C, MEM, D, E > & operator/= (const BoxData< T, C, MEM, D, E > &a_rhs)
 Pointwise Division on Intersection. More...
 
BoxData< T, C, MEM, D, E > & operator+= (T a_scale)
 Pointwise Addition by Scalar. More...
 
BoxData< T, C, MEM, D, E > & operator-= (T scale)
 Pointwise Subtraction by Scalar. More...
 
BoxData< T, C, MEM, D, E > & operator*= (T scale)
 Pointwise Multiplication by Scalar. More...
 
BoxData< T, C, MEM, D, E > & operator/= (T scale)
 Pointwise Division by Scalar. More...
 
BoxData< T, C, MEM, D, E > & operator+= (const Array< T, C *D *E > &a_array)
 Pointwise Addition an Array. More...
 
BoxData< T, C, MEM, D, E > & operator-= (const Array< T, C *D *E > &a_array)
 Pointwise Subtraction an Array. More...
 
BoxData< T, C, MEM, D, E > & operator*= (const Array< T, C *D *E > &a_array)
 Pointwise Multiplication an Array. More...
 
BoxData< T, C, MEM, D, E > & operator/= (const Array< T, C *D *E > &a_array)
 Pointwise Division by an Array. More...
 
void increment (const BoxData< T, C, MEM, D, E > &rhs, T scale=1)
 
void incrementProduct (const BoxData< T, C, MEM, D, E > &A, const BoxData< T, C, MEM, D, E > &B, T scale=1)
 
template<BoxDataOp >
void operatorT (const BoxData< T, C, MEM, D, E > &a_src)
 Algebraic Op Helper. More...
 
template<BoxDataOp >
void operatorT (const T a_scale)
 Algebraic Op Helper. More...
 

Detailed Description

template<class T = double, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1>
class Proto::BoxData< T, C, MEM, D, E >

Multidimensional Rectangular Array.

BoxData is the main dataholder class of Proto. It contains an array of data of type T on a domain defined by a Box. Each data point is associated with a Point in the Box. C, D, and E define the tensor structure of the data: C,D,E = 1: Data is scalar (default) C = N, D,E = 1: Data is vector valued with N components C = M, D = N, E = 1: Data is MxN matrix valued

Template Parameters
TType of data in array (bool, int, double, etc.)
C(Optional) Size of first component axis. Defaults to 1.
D(Optional) Size of second component axis. Defaults to 1.
E(Optional) Size of third component axis. Defaults to 1.
MEM(Optional) Where memory is allocated (device or host). Defaults to host.

The documentation for this class was generated from the following file: