Proto  3.2
Classes | Typedefs | Enumerations | Functions | Variables
Proto Namespace Reference

Classes

class  AMRData
 AMR Data Hierarchy. More...
 
class  AMRGrid
 AMR Grid. More...
 
class  AMROp
 AMR-Scope Operator. More...
 
class  AMRSolver
 AMR Solver. More...
 
class  Array
 A templated constant size array object similar to std::array, but with the ability to be used inside of device kernels. More...
 
class  ArrayIterator
 
class  AutoStart
 
class  AutoStartLeaf
 
struct  BCStencil
 A variation of Stencil used for applying boundary conditions. Consider the diagram below. BCStencil is designed to extrapolate the value of a ghost cell (A) using interior data (C) in addition to an edge centered value on the boundary (B). Note that a different MBStencil is needed to fill ghost cells at different distances from the boundary. The updated value (A) may have different units than the source values (B, C, D, ...); for example, A might be a flux while the source values have units of the associated state. The diagram below corresponds to the case where a ghost cell in the second layer of a low-face is being filled. More...
 
class  BoundaryCondition
 Library of utility functions for assisiting in the application of boundary conditions. More...
 
class  Box
 An interval in DIM dimensional space. More...
 
class  BoxData
 Multidimensional Rectangular Array. More...
 
class  BoxIterator
 Iterator for Boxes. More...
 
class  BoxOp
 Abstract Box-Scope Operator. More...
 
class  BoxPartition
 Box Partition. More...
 
struct  BufferEntry
 
class  CInterval
 Component-Space Interval. More...
 
class  CoarseFineBoundary
 
class  CompositeOp
 
class  ConstArrayIterator
 
class  ConstBC
 Constant Ghost Value. More...
 
class  ConstDirichletBC
 Not Really Dirichlet BC. More...
 
class  CoordPermutation
 Defines discrete rotations in logically rectangular coordinate systems. More...
 
class  Copier
 Abstract Generic Parallel Copier. More...
 
class  CopierIterator
 
class  DataIndex
 Data Index. More...
 
class  DataIterator
 Distributed Data Iterator. More...
 
struct  DataWrapper
 
class  describeInfo
 
class  DisjointBoxLayout
 Disjoint Box Layout. More...
 
class  DistributedSet
 
struct  Face
 
class  FinitePointSet
 
class  FluxBoxData
 
class  FluxRegisterCopier
 Flux Register Copier. More...
 
class  FluxRegisterCopierOp
 Flux Register Copier Op. More...
 
class  InterpStencil
 
class  InterpStencil1D
 Interpolation Stencil. More...
 
struct  LazyInterpStencil
 
struct  LazyStencil
 An Unevaluated Stencil Operation.
 
class  LevelBC
 Storage for the LevelBCOps on each face. More...
 
class  LevelBoxData
 Level Box Data. More...
 
class  LevelCopier
 Level Copier. More...
 
class  LevelCopierOp
 Level Copier Operator. More...
 
class  LevelExchangeCopier
 Exchange Copier. More...
 
class  LevelFluxRegister
 Flux Register. More...
 
class  LevelOp
 Level-Scope Operator. More...
 
class  LevelSolver
 Level Solver. More...
 
class  MayDay
 Error-reporting Functions. More...
 
class  MBAMRBoxPartition
 
class  MBAMRData
 Multiblock AMR Data. More...
 
class  MBAMRLayout
 Multiblock AMR Grid. More...
 
class  MBAMRMap
 
class  MBBoundaryCopier
 Copier. More...
 
class  MBBoundaryCopierOp
 Copier Operator. More...
 
struct  MBBoundaryData
 
class  MBBoundaryRegister
 Boundary Register. More...
 
class  MBBoxOp
 Abstract Box-Scope Operator for Mapped Multiblock. More...
 
class  MBBoxPartition
 
class  MBDataIndex
 
class  MBDataIterator
 
class  MBDataPoint
 
class  MBDisjointBoxLayout
 
class  MBFluxRegisterCopier
 
class  MBFluxRegisterCopierOp
 
class  MBGraph
 Graph of a mapped multiblock domain. Nodes represent blocks and arcs represent boundaries between blocks. Does not contain any information about the size of blocks; that information is provided by MBProblemDomain. More...
 
struct  MBGraphArc
 An internal structure defining an arc in the MBGraph. More...
 
struct  MBGraphNode
 An internal structure defining a node in the MBGraph. More...
 
class  MBInterpLayout
 
class  MBInterpOp
 Mapped Multiblock Block Boundary Interpolation Operator. More...
 
class  MBLevelArgs
 
class  MBLevelBC
 
class  MBLevelBoxData
 Multiblock Level Box Data. More...
 
struct  MBLevelBoxDataWrapper
 
class  MBLevelCopier
 Level Copier. More...
 
class  MBLevelCopierOp
 Level Copier Operator. More...
 
class  MBLevelExchangeCopier
 Exchange Copier. More...
 
class  MBLevelExchangeCopierOp
 Exchange Copier Operator. More...
 
class  MBLevelFluxRegister
 
class  MBLevelFluxRegisterTester
 
class  MBLevelFullCopier
 Full Level Copier (Includes all ghost cells) More...
 
class  MBLevelFullCopierOp
 Full Level Copier Operator (Includes all ghost cells) More...
 
class  MBLevelMap
 Single Level Mapped Multiblock Map. More...
 
class  MBLevelOp
 Level-Scope Operator. More...
 
class  MBMapOp
 
struct  MBPoint
 
class  MBPointID
 
class  MBPointInterpOp
 Mapped Multiblock Block Boundary Interpolation Operator. More...
 
class  MBProblemDomain
 Mapped Multi-Block Problem Domain. More...
 
class  memInfo
 
class  Morton
 Morton Indexer. More...
 
struct  MotionItem
 
class  NeighborIterator
 
class  NullBC
 No Boundary Condition. More...
 
class  PeriodicBC
 Periodic Boundary Condition. More...
 
class  Point
 Integer Valued Vector. More...
 
class  ProblemDomain
 Represents a rectangular domain over which a problem can be defined, including periodic images. More...
 
class  Reduction
 
struct  Register
 
class  Shift
 Stencil Shift. More...
 
class  Side
 Side. More...
 
class  SideIterator
 Side Iterator. More...
 
class  Stack
 
class  Stencil
 A Linear Stencil Operation. More...
 
class  traceInfo
 
class  TraceTimer
 
class  Var
 Pointwise Variable. More...
 

Typedefs

typedef Point PatchID
 
typedef DataIndex< BoxPartitionLevelIndex
 
typedef DataIterator< BoxPartitionLevelIterator
 
typedef MotionItem< BoxPartition, BoxPartitionLevelMotionItem
 
typedef AMRData< short, 1, MEMTYPE_DEFAULT, PR_CELLAMRTagData
 
typedef LevelBoxData< short, 1, MEMTYPE_DEFAULT, PR_CELLLevelTagData
 
typedef LevelBoxData< short, 1, MemType::HOST, PR_CELLLevelTagDataHost
 
typedef BoxData< short, 1, MEMTYPE_DEFAULTTagData
 
typedef BoxData< short, 1, MemType::HOST > TagDataHost
 
typedef std::tuple< Point, BlockIndex, int > MBAMRPatchID_t
 Multiblock AMR Box Partition. More...
 
typedef MotionItem< MBBoxPartition, MBBoxPartitionMBMotionItem
 
typedef DataIndex< MBBoxPartitionMBIndex
 
typedef DataIterator< MBBoxPartitionMBIterator
 
typedef int BlockIndex
 Defines what type is used for indexing block entities. More...
 

Enumerations

enum  BoxDataOp {
  Invalid = -1, Copy = 0, Add = 1, Assign,
  Subtract, Multiply, Divide, NUM_OP_TYPES
}
 
enum  Centering {
  PR_CELL = -1, PR_FACE_0 = 0, PR_FACE_1, PR_FACE_2,
  PR_FACE_3, PR_FACE_4, PR_FACE_5, PR_FACE_6,
  PR_NODE = 7, PR_FACE, PR_EDGE
}
 
enum  MotionType { LOCAL, FROM, TO }
 
enum  MemType { INVALID =0, HOST =1, DEVICE =2, BOTH =3 }
 
enum  Operation {
  Max, Min, Abs, Sum,
  SumAbs, SumSquare
}
 
enum  Atomic { Warp, Block, None }
 

Functions

template<typename T , size_t N>
ACCEL_DECORATION Array< T, N > & operator* (int scale, Array< T, N > &arr)
 Premultiplication by a scalar int. More...
 
template<typename T , size_t N>
ACCEL_DECORATION Array< T, N > & operator* (double scale, Array< T, N > &arr)
 Premultiplication by a scalar double. More...
 
template<typename T , size_t N>
ACCEL_DECORATION Array< T, N > & operator- (Array< T, N > &arr)
 Unary negation. More...
 
template<typename T , size_t N>
std::ostream & operator<< (std::ostream &stream, const Array< T, N > &arr)
 Ostream operator. More...
 
std::ostream & operator<< (std::ostream &a_os, const Box &a_box)
 OStream Operator. More...
 
std::istream & operator>> (std::istream &a_is, Box &a_box)
 OStream Operator. More...
 
template<MemType MEM>
void null_deleter_boxdata (void *ptr)
 
template<typename T , unsigned int CL, unsigned int CR, MemType MEM, unsigned int DL, unsigned int DR, unsigned int E = 1>
BoxData< T, CL, MEM, DR, E > matrixProduct (const BoxData< T, CL, MEM, DL, E > &A, const BoxData< T, CR, MEM, DR, E > &B, T scale=1.0)
 
template<typename T , unsigned int CL, unsigned int CR, MemType MEM, unsigned int DL, unsigned int DR, unsigned int E = 1>
BoxData< T, DL, MEM, DR, E > matrixProductLeftTranspose (const BoxData< T, CL, MEM, DL, E > &A, const BoxData< T, CR, MEM, DR, E > &B, T scale=1.0)
 
template<typename T , unsigned int CL, unsigned int CR, MemType MEM, unsigned int DL, unsigned int DR, unsigned int E = 1>
BoxData< T, CL, MEM, CR, E > matrixProductRightTranspose (const BoxData< T, CL, MEM, DL, E > &A, const BoxData< T, CR, MEM, DR, E > &B, T scale=1.0)
 
std::ostream & operator<< (std::ostream &a_os, const CInterval &a_int)
 CInterval IOStream Operator. More...
 
template<typename T , std::size_t... I>
auto tupleFromVector (const std::vector< T > &v, std::index_sequence< I... >)
 
template<typename T , std::size_t N>
auto tupleFromVector (const std::vector< T > &v)
 
CoordPermutation operator* (const CoordPermutation &a_A, const CoordPermutation &a_B)
 
std::ostream & operator<< (std::ostream &os, const LevelIndex &a_dbl)
 
std::ostream & operator<< (std::ostream &os, const DisjointBoxLayout &a_dbl)
 
Side::LoHiSide flip (const Side::LoHiSide &a_side)
 Flip Side. More...
 
int sign (const Side::LoHiSide &a_side)
 Sign. More...
 
template<typename T , unsigned int C, MemType MEM, unsigned int D, unsigned int E>
BoxData< T, C, MEM, D, E > & operator+= (BoxData< T, C, MEM, D, E > &a_dst, const LazyInterpStencil< T, C, MEM, D, E > &&a_op)
 
template<typename T , unsigned int C, MemType MEM, unsigned int D, unsigned int E>
BoxData< T, C, MEM, D, E > & operator|= (BoxData< T, C, MEM, D, E > &a_dst, const LazyInterpStencil< T, C, MEM, D, E > &&a_op)
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void interpBoundaries (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, InterpStencil< T > &a_interp)
 Interpolate Boundaries. More...
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void interpBoundaries (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, LevelBoxData< T, C, MEM, CTR > &a_crseFine, InterpStencil< T > &a_interp)
 Interpolate Boundaries. More...
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void averageDown (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, Point a_refRatio)
 Average Down. More...
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void averageDown (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, int a_refRatio)
 Average Down (Scalar Refinement Ratio) More...
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void averageDown (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, LevelBoxData< T, C, MEM, CTR > &a_crseFine, Point a_refRatio)
 Average Down. More...
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
void averageDown (LevelBoxData< T, C, MEM, CTR > &a_crse, LevelBoxData< T, C, MEM, CTR > &a_fine, LevelBoxData< T, C, MEM, CTR > &a_crseFine, int a_refRatio)
 Average Down (Scalar Refinement Ratio) More...
 
template<typename T , MemType MEM>
PROTO_KERNEL_START void f_proto_iotaF (Point &a_pt, Var< T, DIM, MEM > &a_X, Array< T, DIM > a_dx, Array< T, DIM > a_offset, int a_ctr)
 
template<typename IN >
const IN & parse_level_arg (LevelIndex &a_index, const IN &a_arg)
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
const BoxData< T, C, MEM > & parse_level_arg (LevelIndex &a_index, const LevelBoxData< T, C, MEM, CTR > &a_arg)
 
template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if< I==sizeof...(LArgs), void >::type call_level_forall (Func &a_func, LevelIndex &a_index, std::tuple< LArgs... > a_args, FArgs &&... a_fargs)
 
template<unsigned int P>
int ipow (int M)
 Template Based Integer Exponentiation. More...
 
template<>
int ipow< 0 > (int M)
 
int ipow (int a_base, unsigned int a_exp)
 
int factorial (int value)
 
template<typename T >
taylor (int index)
 
template<MemType SRC_MEM = MEMTYPE_DEFAULT, MemType DST_MEM = MEMTYPE_DEFAULT>
void proto_memcpy (const void *a_src, void *a_dst, size_t a_nbytes)
 Copy Memory. More...
 
template<MemType MEM = MEMTYPE_DEFAULT>
void * proto_malloc (size_t a_nbytes)
 Allocate Memory. More...
 
template<MemType MEM = MEMTYPE_DEFAULT>
void proto_free (void *a_buffer)
 Free Memory. More...
 
MemType pointerMemType (const void *a_ptr)
 Query Pointer MemType. More...
 
template<typename T >
constexpr T proto_unallocated ()
 
std::string parseMemType (MemType a_mem)
 
std::ostream & pr_out ()
 Use this in place of std::cout for program output. More...
 
void setPoutBaseName (const std::string &a_Name)
 Changes the base part of the filename for pr_out() files. More...
 
const std::string & poutFileName ()
 Accesses the filename for the local pr_out() file. More...
 
template<class T >
int linearSize (const T &inputT)
 
template<class T >
void linearIn (T &a_outputT, const void *const inBuf)
 
template<class T >
void linearOut (void *const a_outBuf, const T &inputT)
 
template<>
void linearIn< std::vector< Point > > (std::vector< Point > &a_outputT, const void *const a_inBuf)
 
template<>
void linearOut< std::vector< Point > > (void *const a_outBuf, const std::vector< Point > &a_inputT)
 
template<>
int linearSize< std::vector< Point > > (const std::vector< Point > &a_input)
 
std::ostream & operator<< (std::ostream &os, const ProblemDomain &a_pd)
 Stream output for ProblemDomain. More...
 
template<typename T , Operation OP>
ACCEL_KERNEL void initKernel (T *ptr)
 
int procID ()
 Get Local Process ID. More...
 
int PRprocID ()
 
unsigned int numProc ()
 Get Number of Ranks. More...
 
void barrier ()
 Parallel Barrier. More...
 
PROTO_KERNEL_START void maxTagFcnF (Var< short, 1 > &a_tag, Var< short, 1 > &a_coarse)
 
std::ostream & operator<< (std::ostream &a_os, const MBDataPoint &a_point)
 
std::ostream & operator<< (std::ostream &os, const DataIndex< MBBoxPartition > &a_index)
 
std::ostream & operator<< (std::ostream &a_os, const MBIndex &a_di)
 
template<typename MAP , typename T , unsigned int C, MemType MEM, Centering CTR>
void interpBoundaries (MBLevelBoxData< T, C, MEM, CTR > &a_data, unsigned int a_order=4)
 
template<typename MAP , typename T , unsigned int C, MemType MEM, Centering CTR>
void interpBoundaries (MBLevelBoxData< T, C, MEM, CTR > &a_data, MBLevelMap< MAP, MEM > &a_map, unsigned int a_order=4)
 
template<typename IN >
const IN & parse_mb_level_arg (MBIndex &a_index, Centering C, const IN &a_arg)
 
template<typename T , unsigned int C, MemType MEM, Centering CTR>
const BoxData< T, C, MEM > & parse_mb_level_arg (MBIndex &a_index, Centering _CTR, const MBLevelBoxData< T, C, MEM, CTR > &a_arg)
 
template<typename Func , typename MAP , MemType MEM>
const BoxData< double, DIM, MEM > parse_mb_level_arg (MBIndex &a_index, Centering C, const MBLevelMap< MAP, MEM > &a_arg)
 
template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if< I==sizeof...(LArgs), void >::type call_mb_level_forall (Func &a_func, MBIndex &a_index, Centering CTR, std::tuple< LArgs... > a_args, FArgs &&... a_fargs)
 
 exchange ()
 
template<typename T , MemType MEM>
PROTO_KERNEL_START void f_binomialPower_tmp (Var< T, 1, MEM > &a_xp, const Var< T, DIM, MEM > &a_x, Point a_p)
 
MBPoint operator+ (const MBPoint &mbpoint, const Point &p)
 
MBPoint operator+ (const Point &p, const MBPoint &mbpoint)
 
MBPoint operator+ (const MBPoint &p1, const MBPoint &p2)
 
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:

Example slice usage:

template<class T , unsigned int C = 1, unsigned int D = 1, unsigned int E = 1, MemType MEM = MEMTYPE_DEFAULT>
BoxData< T, C, MEM, D, E > alias (BoxData< T, C, MEM, D, E > &a_original, const Point &a_shift=Point::Zeros())
 Alias (Non-Const) More...
 
template<class T , unsigned int C = 1, unsigned int D = 1, unsigned int E = 1, MemType MEM = MEMTYPE_DEFAULT>
const BoxData< T, C, MEM, D, E > alias (const BoxData< T, C, MEM, D, E > &a_original, const Point &a_shift=Point::Zeros())
 Alias (Const) More...
 
template<typename T , unsigned int C, MemType MEM = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1>
BoxData< T, 1, MEM, 1, 1 > slice (const BoxData< T, C, MEM, 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 int CC, MemType MEM = MEMTYPE_DEFAULT>
BoxData< T, CC, MEM, 1, 1 > slice (const BoxData< T, C, MEM, 1, 1 > &a_src, unsigned int a_startcomp)
 Vector Slice (Non-Const) More...
 
template<typename T , unsigned int C, unsigned int D, MemType MEM = MEMTYPE_DEFAULT>
BoxData< T, C, MEM, 1, 1 > plane (const BoxData< T, C, MEM, D, 1 > &a_src, unsigned int a_d)
 
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 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 (including Point or Box).
  • 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:

template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forall (const Func &a_F, Srcs &&... a_srcs)
 Pointwise Operator. More...
 
template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forallOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Srcs &&... a_srcs)
 Pointwise Operator (Instrumented) More...
 
template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forall (const Func &a_F, Box a_box, Srcs &&... a_srcs)
 Pointwise Operator (Explicit Range Box) More...
 
template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forallOp (unsigned long long int a_num_flops_point, const char *a_timername, const Func &a_F, Box a_box, Srcs &&... a_srcs)
 Pointwise Operator (Explicit Range Box, Instrumented) More...
 
template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forall_p (const Func &a_F, Srcs &&... a_srcs)
 Pointwise Operator (Pointwise Dependence) More...
 
template<typename T , unsigned int C = 1, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData< T, C, MEMTYPE, D, E > forall_p (const Func &a_F, Box a_box, Srcs &&... a_srcs)
 Pointwise Operator (Pointwise Dependence, Explicit Range Box) More...
 
template<typename Func , typename... Srcs>
void forallInPlace (const Func &a_F, Srcs &&... a_srcs)
 In-Place Pointwise Operator. More...
 
template<typename Func , typename... Srcs>
void forallInPlace (const Func &a_F, Box a_box, Srcs &&... a_srcs)
 In-Place Pointwise Operator (Explicit Range Box) More...
 
template<typename Func , typename... Srcs>
void forallInPlace_p (const Func &a_F, Srcs &&... a_srcs)
 In-Place Pointwise Operator (Pointwise Dependence) More...
 
template<typename Func , typename... Srcs>
void forallInPlace_p (const Func &a_F, Box a_box, Srcs &&... a_srcs)
 In-Place Pointwise Operator (Pointwise Dependence, Explicit Box Range) More...
 
External Operators
std::ostream & operator<< (std::ostream &a_os, const Point &a_pt)
 Stream Operator. More...
 
std::istream & operator>> (std::istream &a_os, Point &a_pt)
 Stream Operator. More...
 
Point operator* (int a_scale, Point a_pt)
 Premultiplication by scalar. More...
 
Point operator- (Point a_pt)
 Unary Negation. More...
 
Point minPoint (Point a_p1, Point a_p2)
 
Point maxPoint (Point a_p1, Point a_p2)
 
Point absMaxPoint (Point a_p1, Point a_p2)
 
Non-Member Functions
template<typename T >
Stencil< T > operator* (T a_coef, Shift a_shift)
 Coefficient Shift Product "Constructor". More...
 
template<typename T >
Stencil< T > operator* (T a_coef, const Stencil< T > a_stencil)
 Scalar Multiplication of Stencil Coefficients. More...
 
template<typename T >
Stencil< T > operator- (Stencil< T > a_stencil)
 Stencil Unary Negation. More...
 
template<typename T , unsigned int C, MemType MEMTYPE, unsigned int D, unsigned int E>
BoxData< T, C, MEMTYPE, D, E > & operator|= (BoxData< T, C, MEMTYPE, D, E > &a_dest, LazyStencil< T, C, MEMTYPE, D, E > &&a_op)
 Application by Replacement. More...
 
template<class T , unsigned int C, MemType MEMTYPE, unsigned int D, unsigned int E>
BoxData< T, C, MEMTYPE, D, E > & operator+= (BoxData< T, C, MEMTYPE, D, E > &a_dest, LazyStencil< T, C, MEMTYPE, D, E > &&a_op)
 Application by Increment. More...
 

Variables

template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if< I< sizeof...(LArgs), void >::typecall_level_forall(Func &a_func, LevelIndex &a_index, std::tuple< LArgs... > a_args, FArgs &&... a_fargs){ auto &arg=parse_level_arg(a_index, std::get< I >a_args));call_level_forall< I+1 >a_func, a_index, a_args, a_fargs..., arg);}template< typename T, unsigned int C, MemType MEM, Centering CTR >template< typename Func, typename... Srcs >void LevelBoxData< T, C, MEM, CTR >::initialize(Func &a_func, Srcs &... a_srcs){ PROTO_ASSERT(m_isDefined, "LevelBoxData::initialize | Error: Object not defined");auto srcs=std::tuple< Srcs &... >a_srcs...);for(auto iter :m_layout) { auto &patch=(*this)[iter];call_level_forall(a_func, iter, srcs, patch);}}template< typename T, unsigned int C, MemType MEM, Centering CTR >BoxLevelBoxData< T, C, MEM, CTR >::patchBox(const DataIndex< BoxPartition > &a_index) const { PROTO_ASSERT(m_isDefined, "LevelBoxData::patchBox | Error: Object not defined");PROTO_ASSERT(DIM<=6, "LevelBoxData::patchBox | Error: This function will fail for DIM > 6");Box B;if(CTR==PR_CELL) { B=layout()[a_index];} else if(CTR==PR_NODE) { B=layout()[a_index].extrude(Point::Ones());} else { int ctr=(int) CTR;B=layout()[a_index].extrude(Point::Basis(ctr, 1));} return B;}template< typename T, unsigned int C, MemType MEM, Centering CTR >unsigned intLevelBoxData< T, C, MEM, CTR >::patchSize() const { PROTO_ASSERT(m_isDefined, "LevelBoxData::patchSize | Error: Object not defined");int size=1;Point boxSize=layout().boxSize()+2 *ghost();switch(CTR) { case PR_NODE:boxSize+=Point::Ones();break;case PR_CELL:break;default:MayDay< void >::Abort("LevelBoxData::patchSize | Specified centering not implemented");} for(int ii=0;ii< DIM;ii++) { size *=boxSize[ii];} return C *size;}template< typename T, unsigned int C, MemType MEM, Centering CTR >unsigned intLevelBoxData< T, C, MEM, CTR >::offset(int a_proc) const { return layout().offset(a_proc) *patchSize();}template< typename T, unsigned int C, MemType MEM, Centering CTR >unsigned int LevelBoxData< T, C, MEM, CTR >::numBoxes() const { return m_layout.size();}template< typename T, unsigned int C, MemType MEM, Centering CTR >void LevelBoxData< T, C, MEM, CTR >::setToZero(int a_comp){ setVal(0, a_comp);}template< typename T, unsigned int C, MemType MEM, Centering CTR >void LevelBoxData< T, C, MEM, CTR >::setVal(T a_value, int a_comp){ PROTO_ASSERT(m_isDefined, "LevelBoxData::setVal | Error: Object not defined");PROTO_ASSERT((a_comp >=-1) &&(a_comp< DIM), "LevelBoxData::setVal | Error: %i is not a valid component specification.", a_comp);for(auto iter :m_layout) { auto &patch=(*this)[iter];if(a_comp==-1) { patch.setVal(a_value);} else { auto patch_i=slice(patch, a_comp);patch_i.setVal(a_value);} }}template< typename T, unsigned int C, MemType MEM, Centering CTR >void LevelBoxData< T, C, MEM, CTR >::setDomainBoundary(T a_value, int a_comp){ PROTO_ASSERT(m_isDefined, "LevelBoxData::setBoundary | Error: Object not defined");PROTO_ASSERT((a_comp >=-1) &&(a_comp< DIM), "LevelBoxData::setBoundary | Error: \%i is not a valid component specification.", a_comp);if(ghost()==Point::Zeros()){ return;} for(auto iter :m_layout) { if(!layout().onLevelBoundary(m_layout.point(iter))) { continue;} auto &patch=(*this)[iter];if(a_comp==-1) { BoxData< T, C, MEM > tmp(layout()[iter]);patch.copyTo(tmp);patch.setVal(a_value);tmp.copyTo(patch);} else { auto patch_i=slice(patch, a_comp);BoxData< T, 1, MEM > tmp(layout()[iter]);patch_i.copyTo(tmp);patch_i.setVal(a_value);tmp.copyTo(patch_i);} } exchange();}template< typename T, unsigned int C, MemType MEM, Centering CTR >void LevelBoxData< T, C, MEM, CTR >::setRandom(T a_low, T a_high){ for(auto iter :m_layout) { auto &patch=(*this)[iter];patch.setRandom(a_low, a_high);} exchange();}template< typename T, unsigned int C, MemType MEM, Centering CTR >void LevelBoxData< T, C, MEM, CTR >::exchange(){ PROTO_ASSERT(m_isDefined, "LevelBoxData::exchange | Error: Object not defined");if(m_ghost==Point::Zeros()) { return;} PR_TIME("LevelBoxData::exchange");PROTO_ASSERT(m_exchangeCopier !=nullptr, "LevelBoxData::exchange | Error: exchange copier is not defined");m_exchangeCopier-> execute ()
 
constexpr int line = 128
 
int num_procs
 
template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if< I< sizeof...(LArgs), void >::typecall_mb_level_forall(Func &a_func, MBIndex &a_index, Centering CTR, std::tuple< LArgs... > a_args, FArgs &&... a_fargs){ auto &arg=parse_mb_level_arg(a_index, CTR, std::get< I >a_args));call_mb_level_forall< I+1 >a_func, a_index, CTR, a_args, a_fargs..., arg);}template< typename T, unsigned int C, MemType MEM, Centering CTR >template< typename Func, typename... Srcs >void MBLevelBoxData< T, C, MEM, CTR >::initialize(Func &a_func, Srcs &... a_srcs){ auto srcs=std::tuple< Srcs &... >a_srcs...);for(auto iter :(m_layout)) { auto &patch=(*this)[iter];auto block=layout().block(iter);call_mb_level_forall(a_func, iter, CTR, srcs, patch, block);} }template< typename T, unsigned int C, MemType MEM, Centering CTR >template< typename Func, typename... Srcs >void MBLevelBoxData< T, C, MEM, CTR >::initConvolve(Func &a_func, Srcs &... a_srcs){ auto g=ghost();g[0]=g[0]+Point::Ones();MBLevelBoxData< T, C, MEM, CTR > tmp(m_layout, g);tmp.initialize(a_func, a_srcs...);for(auto iter :m_layout) { auto &tmp_i=tmp[iter];auto &patch=(*this)[iter];Operator::convolve(patch, tmp_i);}}template< typename T, unsigned int C, MemType MEM, Centering CTR >void MBLevelBoxData< T, C, MEM, CTR >::setVal(T a_value){ for(auto data :m_data) { data-> setVal (a_value)
 

Detailed Description

TraceTimer class is a self-tracing code instrumentation system

TraceTimer class is a self-tracing code instrumentation system for Chombo (or any other package really). The user interface is specified by a small set of macros. The usage model is that you just leave these timers in the code, for good. Initially, your application will have 'main' and a few hewavy functions instrumented, and the lower level Chombo library instrumentation. As your tool or application matures, it will garner a larger set of instrumentation giving clear views of your code performance. After a routine has been cleverly and lovingly optimized, you leave in the timers, to spot when some later bug fix or improvement undoes your previous labors.

Note
You should never need to use or interact with the the classes TraceTimer or AutoStart. Use the macros. They call the right functions and classes for you.

The first macro is what people will use the most:

PR_TIME("label");

This is the simplest interface for timers. you place this macro call in a function you wish to be timed. It handles making the timer, calling 'start' when you enter the function, and calling 'stop' when you leave the function. A good idea is to use a 'label' specific enough to be unambiguous without being overwhelming. for instance:

void AMRLevelPolytropicGas::define(AMRLevel* a_coarserLevelPtr,
const ProblemDomain& a_problemDomain,
int a_level,
int a_refRatio)
{
PR_TIME("AMRLevelPolytropicGas::define");
.
.
}

In this case, we have a class with many constructors and define functions that all funnel into a single general function. We can just call this 'define' and not worry about naming/instrumenting all the different overloaded instances. If you slip up and use the same label twice, that is not a real problem, the two locations will be timed and tracked properly (even if one is a sibling or parent of the other). The only place it will make things a little harder is in the output where you might have the same name show up and look confusing.

In serial, you will see a file called time.table (in parallel, you will get a time.table.n (where n is the rank number) files). If you want fewer files, you can do setenv PR_OUTPUT_INTERVAL nproc and it will only output every nproc processors time.table.n files (where nnproc == 0). I won't go into this file format. It is kind of gprof-ish, with what I consider improvements. The real benefit here is profiling that understands our Chombo context, a smaller information set to observe, and the fact that, so far in my testing, the timers have negligible impact on the run time or memory use of the code.

By default, Chombo compiles in the instructions for the timers wherever the macros appear. If the compiler macro PR_NTIMER is defined, then all the PR_TIME* macros evaluate to empty expressions at compile time.

So, you put some PR_TIME calls in your code and ran it, and nothing happened:
Chombo looks for the environment variable PR_TIMER. If it is set to anything (even if it is set to 'false' or 'no' or whatever) then the timers will be active and reporting will happen. If this environment variable is not set, then all the timers check a bool and return after doing nothing.
One point of interest with using the environment variable: In parallel jobs using mpich, only processor 0 inherits the environment variables from the shell where you invoke 'mpirun', the rest read your .cshrc (.bashrc, etc.) file to get their environment. To time all your processes, you need to make sure the PR_TIMER environment variable gets to all your processes.
Auto hierarchy:
The timers automatically figure out their parent/child relationships. They also can be placed in template code. This has some consequences. First, if you have a low level function instrumented that has no timers near it in the code call stack, you will see it show up as a child of a high level timer. the root timer "main" will catch all orphaned timers. So, even though you might make no call to, say, 'exchange' in your 'main' function, you might very well call a function, that calls a function, that calls 'exchange'. Since no code in between was instrumented, this exchange is accounted for at 'main'. This might look strange, but it should prove very powerful. An expensive orphan is exactly where you should consider some more timers, or reconsidering code design.
For performance reasons, child timers have only one parent. As a consequence each PR_TIME("label") label can show up at multiple places in your output. Each instance has it's own timer. So, each path through the call graph that arrives at a low-level function has a unique lineage, with it's own counter and time. Thus, I can instrument LevelData::copyTo once, but copyTo can appear in many places in the time.table file.

The next level up in complexity is the set of four macros for when you want sub-function resolution in your timers. For instance, in a really huge function that you have not figured out how to re-factor, or built with lots of bad cut n paste code 're-use'.

PR_TIMERS("parent");
PR_TIMER("child1", t1);
PR_TIMER("child2", t2);
PR_STOP(t1);
PR_STOP(t2);
PR_STOP(t1);

PR_TIMERS has the same semantic as PR_TIME, except that you can declare an arbitrary number of children after it in the same function scope. The children here do not autostart and autostop, you have to tell them where to start and stop timing. The children can themselves be parents for timers in called functions, of course. The children obey a set of mutual exclusions. The following generate run time errors:

the following will generate compile time errors:

You do not have to put any calls in your main routine to activate the clocks or generate a report at completion, this is handled with static iniitalization and an atexit function.

There is a larger argument of manual instrumentation being counter to good development. Profiling the code is supposed to tell you where to expend your optimization effort. Manual instrumentation opens the door to people wasting time assuming what parts of the code are going to take up lots of time and instrumenting them, before seeing any real performance data. Good judgement is needed. We have a body of knowledge about Chombo that will inform us about a good minimal first set of functions to instrument.

Typedef Documentation

◆ PatchID

◆ LevelIndex

◆ LevelIterator

◆ LevelMotionItem

◆ AMRTagData

◆ LevelTagData

◆ LevelTagDataHost

typedef LevelBoxData<short, 1, MemType::HOST, PR_CELL> Proto::LevelTagDataHost

◆ TagData

◆ TagDataHost

typedef BoxData<short, 1, MemType::HOST> Proto::TagDataHost

◆ MBAMRPatchID_t

typedef std::tuple<Point, BlockIndex, int> Proto::MBAMRPatchID_t

Multiblock AMR Box Partition.

◆ MBMotionItem

◆ MBIndex

◆ MBIterator

◆ BlockIndex

typedef int Proto::BlockIndex

Defines what type is used for indexing block entities.

Enumeration Type Documentation

◆ BoxDataOp

Enumerator
Invalid 
Copy 
Add 
Assign 
Subtract 
Multiply 
Divide 
NUM_OP_TYPES 

◆ Centering

Enumerator
PR_CELL 
PR_FACE_0 
PR_FACE_1 
PR_FACE_2 
PR_FACE_3 
PR_FACE_4 
PR_FACE_5 
PR_FACE_6 
PR_NODE 
PR_FACE 
PR_EDGE 

◆ MotionType

Enumerator
LOCAL 
FROM 
TO 

◆ MemType

Enumerator
INVALID 
HOST 
DEVICE 
BOTH 

◆ Operation

Enumerator
Max 
Min 
Abs 
Sum 
SumAbs 
SumSquare 

◆ Atomic

Enumerator
Warp 
Block 
None 

Function Documentation

◆ operator*() [1/4]

template<typename T , size_t N>
ACCEL_DECORATION Array<T,N>& Proto::operator* ( int  scale,
Array< T, N > &  arr 
)
inline

◆ operator*() [2/4]

template<typename T , size_t N>
ACCEL_DECORATION Array<T,N>& Proto::operator* ( double  scale,
Array< T, N > &  arr 
)
inline

Premultiplication by a scalar double.

◆ operator-() [1/2]

template<typename T , size_t N>
ACCEL_DECORATION Array<T,N>& Proto::operator- ( Array< T, N > &  arr)
inline

◆ operator<<() [1/10]

template<typename T , size_t N>
std::ostream& Proto::operator<< ( std::ostream &  stream,
const Array< T, N > &  arr 
)
inline

Ostream operator.

Referenced by Proto::Point::unpack().

◆ operator<<() [2/10]

std::ostream& Proto::operator<< ( std::ostream &  a_os,
const Box a_box 
)
inline

OStream Operator.

References Proto::Box::str().

◆ operator>>() [1/2]

std::istream& Proto::operator>> ( std::istream &  a_is,
Box a_box 
)
inline

◆ null_deleter_boxdata()

template<MemType MEM>
void Proto::null_deleter_boxdata ( void *  ptr)
inline

◆ operator<<() [3/10]

std::ostream& Proto::operator<< ( std::ostream &  a_os,
const CInterval a_int 
)
inline

CInterval IOStream Operator.

◆ tupleFromVector() [1/2]

template<typename T , std::size_t... I>
auto Proto::tupleFromVector ( const std::vector< T > &  v,
std::index_sequence< I... >   
)

◆ tupleFromVector() [2/2]

template<typename T , std::size_t N>
auto Proto::tupleFromVector ( const std::vector< T > &  v)

References PROTO_ASSERT.

◆ operator*() [3/4]

CoordPermutation Proto::operator* ( const CoordPermutation a_A,
const CoordPermutation a_B 
)
inline

◆ operator<<() [4/10]

std::ostream & Proto::operator<< ( std::ostream &  os,
const LevelIndex a_dbl 
)
inline

◆ operator<<() [5/10]

std::ostream& Proto::operator<< ( std::ostream &  os,
const DisjointBoxLayout a_dbl 
)
inline

◆ flip()

Side::LoHiSide Proto::flip ( const Side::LoHiSide a_side)
inline

Flip Side.

Utility function for flipping between Side::Lo and Side::Hi

Parameters
a_sideSide::Lo or Side::Hi

References Proto::Side::Hi, and Proto::Side::Lo.

◆ sign()

int Proto::sign ( const Side::LoHiSide a_side)
inline

Sign.

Converts a Side to +1 (Hi) or -1 (Lo);

References Proto::Side::Lo.

◆ forall() [1/2]

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

Calling forall:

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

◆ forallOp() [1/2]

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

Pointwise Operator (Instrumented)

Overload of the pointwise operator with additional instrumentation inputs

Parameters
a_num_flops_pointNumber of flops used to compute a_F at each Point
a_timernameThe name of a timer
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, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, 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 (Explicit Range Box)

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 a_box must be a subset of the union of all input BoxData domains.

Example Usage: Input Function:

Calling forall:

Parameters
a_FPointwise function
a_boxRange on which a_F will be evaluated
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

◆ forallOp() [2/2]

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

Pointwise Operator (Explicit Range Box, Instrumented)

Overload of the pointwise operator with additional instrumentation inputs

Parameters
a_num_flops_pointNumber of flops used to compute a_F at each Point
a_timernameThe name of a timer
a_FPointwise function
a_boxRange on which a_F will be evaluated
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, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, typename Func , typename... Srcs>
BoxData<T,C,MEMTYPE,D,E> Proto::forall_p ( const Func &  a_F,
Srcs &&...  a_srcs 
)
inline

Pointwise Operator (Pointwise 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:

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, MemType MEMTYPE = MEMTYPE_DEFAULT, unsigned int D = 1, unsigned int E = 1, 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 (Pointwise Dependence, Explicit Range 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 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. a_box must be a subset of the union of all input BoxData domains.

Example Usage: Input Function:

Calling forall:

Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
a_boxRange on which a_F will be evaluated
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 range of the function evaluation is equal to the intersection of all BoxData inputs.

Example Usage: Input Function:

Calling forall:

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 (Explicit Range 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 range of a_F's application to be something smaller than the intersection of all the inputs. a_box must be a subset of the union of all input BoxData domains.

Example Usage: Input Function:

Calling forall:

Parameters
a_FPointwise function
a_boxRange of computation.
a_srcsInputs (BoxData and primitive data)

◆ 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 (Pointwise 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:

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 (Pointwise Dependence, Explicit Box Range)

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. a_box must be a subset of the union of all input BoxData domains.

Example Usage: Input Function:

Calling forall:

Parameters
a_FPointwise function
a_srcsInputs (BoxData and primitive data)
a_boxRange of computation

◆ operator+=()

template<typename T , unsigned int C, MemType MEM, unsigned int D, unsigned int E>
BoxData<T,C,MEM,D,E>& Proto::operator+= ( BoxData< T, C, MEM, D, E > &  a_dst,
const LazyInterpStencil< T, C, MEM, D, E > &&  a_op 
)

◆ operator|=()

template<typename T , unsigned int C, MemType MEM, unsigned int D, unsigned int E>
BoxData<T,C,MEM,D,E>& Proto::operator|= ( BoxData< T, C, MEM, D, E > &  a_dst,
const LazyInterpStencil< T, C, MEM, D, E > &&  a_op 
)

Referenced by operator-().

◆ interpBoundaries() [1/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::interpBoundaries ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
InterpStencil< T > &  a_interp 
)

Interpolate Boundaries.

General utility function for interpolating data into coarse-fine boundaries. This version creates a temporary LevelBoxData representing the coarsened fine region.

◆ interpBoundaries() [2/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::interpBoundaries ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
LevelBoxData< T, C, MEM, CTR > &  a_crseFine,
InterpStencil< T > &  a_interp 
)

Interpolate Boundaries.

General utility function for interpolating data into coarse-fine boundaries. This version does not create any temporary LevelBoxData but requires an additional input dataholder representing the coarsened fine region.

◆ averageDown() [1/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::averageDown ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
Point  a_refRatio 
)

Average Down.

General utility function for averaging fine data onto coarse data

◆ averageDown() [2/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::averageDown ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
int  a_refRatio 
)

Average Down (Scalar Refinement Ratio)

General utility function for averaging fine data onto coarse data

◆ averageDown() [3/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::averageDown ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
LevelBoxData< T, C, MEM, CTR > &  a_crseFine,
Point  a_refRatio 
)

Average Down.

General utility function for averaging fine data onto coarse data

◆ averageDown() [4/4]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::averageDown ( LevelBoxData< T, C, MEM, CTR > &  a_crse,
LevelBoxData< T, C, MEM, CTR > &  a_fine,
LevelBoxData< T, C, MEM, CTR > &  a_crseFine,
int  a_refRatio 
)

Average Down (Scalar Refinement Ratio)

General utility function for averaging fine data onto coarse data

◆ f_proto_iotaF()

template<typename T , MemType MEM>
PROTO_KERNEL_START void Proto::f_proto_iotaF ( Point a_pt,
Var< T, DIM, MEM > &  a_X,
Array< T, DIM >  a_dx,
Array< T, DIM >  a_offset,
int  a_ctr 
)

◆ parse_level_arg() [1/2]

template<typename IN >
const IN& Proto::parse_level_arg ( LevelIndex a_index,
const IN &  a_arg 
)

◆ parse_level_arg() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
const BoxData<T,C,MEM>& Proto::parse_level_arg ( LevelIndex a_index,
const LevelBoxData< T, C, MEM, CTR > &  a_arg 
)

◆ call_level_forall()

template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if<I == sizeof...(LArgs), void>::type Proto::call_level_forall ( Func &  a_func,
LevelIndex a_index,
std::tuple< LArgs... >  a_args,
FArgs &&...  a_fargs 
)

◆ ipow() [1/2]

template<unsigned int P>
int Proto::ipow ( int  M)
inline

Template Based Integer Exponentiation.

◆ ipow< 0 >()

template<>
int Proto::ipow< 0 > ( int  M)
inline

◆ ipow() [2/2]

int Proto::ipow ( int  a_base,
unsigned int  a_exp 
)
inline

◆ factorial()

int Proto::factorial ( int  value)
inline

Referenced by taylor().

◆ taylor()

template<typename T >
T Proto::taylor ( int  index)
inline

References factorial().

◆ proto_memcpy()

template<MemType SRC_MEM = MEMTYPE_DEFAULT, MemType DST_MEM = MEMTYPE_DEFAULT>
void Proto::proto_memcpy ( const void *  a_src,
void *  a_dst,
size_t  a_nbytes 
)
inline

Copy Memory.

Executes a low level memory copy between buffers of the specified MemTypes. If both SRC_MEM and DST_MEM are HOST, this is equivalent to std::memcpy. When at least one MemType is DEVICE, this function will call cudaMemcpy or equivalent functions as appropriate.

Template Parameters
SRC_MEMMemType of the source buffer
DST_MEMMemType of the destination buffer
Parameters
a_srcSource buffer
a_dstDestination buffer
a_nbytesNumber of bytes to copy

◆ proto_malloc()

template<MemType MEM = MEMTYPE_DEFAULT>
void* Proto::proto_malloc ( size_t  a_nbytes)
inline

Allocate Memory.

Returns a pointer to a region of allocated memory. If MEM==HOST this function is equivalent to std::malloc. If MEM==DEVICE, this function will call cudaMalloc or other equivalent functions as appropriate.

Template Parameters
MEMMemType of the desired buffer
Parameters
a_nbytesNumber of bytes to allocate

◆ proto_free()

template<MemType MEM = MEMTYPE_DEFAULT>
void Proto::proto_free ( void *  a_buffer)
inline

Free Memory.

Frees a pointer previously allocated using proto_malloc. If MEM==HOST this function is equivalent to std::free. If MEM==DEVICE, this function will call cudaFree or other equivalent functions as appropriate.

Template Parameters
MEMMemType of the buffer.
Parameters
a_bufferA buffer.

◆ pointerMemType()

MemType Proto::pointerMemType ( const void *  a_ptr)
inline

Query Pointer MemType.

This is an EXPERIMENTAL tool for checking the MemType of an arbitrary pointer. Initial testing suggests that this function can distinguish between HOST and DEVICE for cuda pointers. Untested with HIP. Use with healthy skepticism.

Parameters
a_ptrA pointer.

◆ proto_unallocated()

template<typename T >
constexpr T Proto::proto_unallocated ( )
inline

References PR_UNALLOCATED_FLOAT.

◆ parseMemType()

std::string Proto::parseMemType ( MemType  a_mem)
inline

References BOTH, DEVICE, HOST, and INVALID.

◆ pr_out()

std::ostream& Proto::pr_out ( )
inline

Use this in place of std::cout for program output.

Replaces std::cout in most of the Chombo code. In serial this just returns std::cout. In parallel, this creates a separate file for each proc called <basename>.n where n is the procID and <basename> defaults to "pout" but can be set by calling setPoutBaseName(). Output is then directed to these files. This keeps the output from different processors from getting all jumbled up. If you want fewer files, you can do setenv CH_OUTPUT_INTERVAL nproc and it will only output every nproc processors pout.n files (where nnproc == 0).

Referenced by Proto::MBBoundaryData< T, C, MEM >::print().

◆ setPoutBaseName()

void Proto::setPoutBaseName ( const std::string &  a_Name)
inline

Changes the base part of the filename for pr_out() files.

When in parallel, changes the base name of the pr_out() files. If pr_out() has already been called, it closes the current output file and opens a new one (unless the name is the same, in which case it does nothing). In serial, ignores the argument and does nothing.

◆ poutFileName()

const std::string& Proto::poutFileName ( )
inline

Accesses the filename for the local pr_out() file.

Returns the name used for the local pr_out() file. In parallel this is "<pout_basename>.<procID>", where <pout_basename> defaults to "pout" and can be modified by calling setPoutBaseName(), and <procID> is the local proc number. In serial, this always returns the string "cout". It is an error (exit code 111) to call this in parallel before MPI_Initialize().

◆ operator<<() [6/10]

std::ostream& Proto::operator<< ( std::ostream &  a_os,
const Point a_pt 
)
inline

Stream Operator.

◆ operator>>() [2/2]

std::istream& Proto::operator>> ( std::istream &  a_os,
Point a_pt 
)
inline

Stream Operator.

◆ operator*() [4/4]

Point Proto::operator* ( int  a_scale,
Point  a_pt 
)
inline

Premultiplication by scalar.

◆ operator-() [2/2]

Point Proto::operator- ( Point  a_pt)
inline

Unary Negation.

◆ minPoint()

Point Proto::minPoint ( Point  a_p1,
Point  a_p2 
)
inline

◆ maxPoint()

Point Proto::maxPoint ( Point  a_p1,
Point  a_p2 
)
inline

◆ absMaxPoint()

Point Proto::absMaxPoint ( Point  a_p1,
Point  a_p2 
)
inline

References Proto::Point::abs().

◆ linearSize()

template<class T >
int Proto::linearSize ( const T &  inputT)

◆ linearIn()

template<class T >
void Proto::linearIn ( T &  a_outputT,
const void *const  inBuf 
)

◆ linearOut()

template<class T >
void Proto::linearOut ( void *const  a_outBuf,
const T &  inputT 
)

◆ linearIn< std::vector< Point > >()

template<>
void Proto::linearIn< std::vector< Point > > ( std::vector< Point > &  a_outputT,
const void *const  a_inBuf 
)

◆ linearOut< std::vector< Point > >()

template<>
void Proto::linearOut< std::vector< Point > > ( void *const  a_outBuf,
const std::vector< Point > &  a_inputT 
)

◆ linearSize< std::vector< Point > >()

template<>
int Proto::linearSize< std::vector< Point > > ( const std::vector< Point > &  a_input)

◆ operator<<() [7/10]

std::ostream & Proto::operator<< ( std::ostream &  os,
const ProblemDomain a_pd 
)
inline

Stream output for ProblemDomain.

◆ initKernel()

template<typename T , Operation OP>
ACCEL_KERNEL void Proto::initKernel ( T *  ptr)

◆ procID()

int Proto::procID ( )
inline

Get Local Process ID.

Returns the ID of the locally running process in the range 0 <= procID() < numProc(). This has no relation to the operating system pid. There is always a procID() == 0.

Referenced by Proto::memInfo< MEMTYPE >::getMemInfo(), Proto::DataIndex< BoxPartition >::local(), Proto::LevelBoxData< T, C, SRC_MEM, CTR >::offset(), Proto::DisjointBoxLayout::offset(), Proto::memInfo< MEMTYPE >::printInfo(), and PRprocID().

◆ PRprocID()

int Proto::PRprocID ( )
inline

References procID().

◆ numProc()

unsigned int Proto::numProc ( )
inline

Get Number of Ranks.

Returns the number of parallel processes running. Always returns at least 1.

Referenced by Proto::memInfo< MEMTYPE >::getMemInfo(), and Proto::memInfo< MEMTYPE >::printInfo().

◆ barrier()

void Proto::barrier ( )
inline

Parallel Barrier.

All MPI ranks wait here to sync-up. Calls MPI_Barrier(comm). This is a no-op in the non-MPI/serial case.

◆ maxTagFcnF()

PROTO_KERNEL_START void Proto::maxTagFcnF ( Var< short, 1 > &  a_tag,
Var< short, 1 > &  a_coarse 
)

◆ operator<<() [8/10]

std::ostream& Proto::operator<< ( std::ostream &  a_os,
const MBDataPoint a_point 
)
inline

◆ operator<<() [9/10]

std::ostream& Proto::operator<< ( std::ostream &  os,
const DataIndex< MBBoxPartition > &  a_index 
)
inline

◆ operator<<() [10/10]

std::ostream& Proto::operator<< ( std::ostream &  a_os,
const MBIndex a_di 
)

◆ interpBoundaries() [3/4]

template<typename MAP , typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::interpBoundaries ( MBLevelBoxData< T, C, MEM, CTR > &  a_data,
unsigned int  a_order = 4 
)
inline

◆ interpBoundaries() [4/4]

template<typename MAP , typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::interpBoundaries ( MBLevelBoxData< T, C, MEM, CTR > &  a_data,
MBLevelMap< MAP, MEM > &  a_map,
unsigned int  a_order = 4 
)
inline

◆ parse_mb_level_arg() [1/3]

template<typename IN >
const IN& Proto::parse_mb_level_arg ( MBIndex a_index,
Centering  C,
const IN &  a_arg 
)

◆ parse_mb_level_arg() [2/3]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
const BoxData<T,C,MEM>& Proto::parse_mb_level_arg ( MBIndex a_index,
Centering  _CTR,
const MBLevelBoxData< T, C, MEM, CTR > &  a_arg 
)

◆ parse_mb_level_arg() [3/3]

template<typename Func , typename MAP , MemType MEM>
const BoxData<double,DIM,MEM> Proto::parse_mb_level_arg ( MBIndex a_index,
Centering  C,
const MBLevelMap< MAP, MEM > &  a_arg 
)

◆ call_mb_level_forall()

template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if<I == sizeof...(LArgs), void>::type Proto::call_mb_level_forall ( Func &  a_func,
MBIndex a_index,
Centering  CTR,
std::tuple< LArgs... >  a_args,
FArgs &&...  a_fargs 
)

◆ exchange()

Proto::exchange ( )

◆ f_binomialPower_tmp()

template<typename T , MemType MEM>
PROTO_KERNEL_START void Proto::f_binomialPower_tmp ( Var< T, 1, MEM > &  a_xp,
const Var< T, DIM, MEM > &  a_x,
Point  a_p 
)

◆ operator+() [1/3]

MBPoint Proto::operator+ ( const MBPoint mbpoint,
const Point p 
)
inline

◆ operator+() [2/3]

MBPoint Proto::operator+ ( const Point p,
const MBPoint mbpoint 
)
inline

◆ operator+() [3/3]

MBPoint Proto::operator+ ( const MBPoint p1,
const MBPoint p2 
)
inline

Variable Documentation

◆ execute

template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if<I < sizeof...(LArgs), void>::typecall_level_forall(Func& a_func, LevelIndex& a_index, std::tuple<LArgs...> a_args, FArgs&&... a_fargs){ auto& arg = parse_level_arg(a_index, std::get<I>a_args)); call_level_forall<I+1>a_func, a_index, a_args, a_fargs..., arg);}template<typename T, unsigned int C, MemType MEM, Centering CTR>template<typename Func, typename... Srcs>void LevelBoxData<T, C, MEM, CTR>::initialize(Func& a_func, Srcs&... a_srcs){ PROTO_ASSERT(m_isDefined, "LevelBoxData::initialize | Error: Object not defined"); auto srcs = std::tuple<Srcs&...>a_srcs...); for (auto iter : m_layout) { auto& patch = (*this)[iter]; call_level_forall(a_func, iter, srcs, patch); }}template<typename T, unsigned int C, MemType MEM, Centering CTR>BoxLevelBoxData<T, C, MEM, CTR>::patchBox(const DataIndex<BoxPartition>& a_index) const{ PROTO_ASSERT(m_isDefined, "LevelBoxData::patchBox | Error: Object not defined"); PROTO_ASSERT(DIM <= 6, "LevelBoxData::patchBox | Error: This function will fail for DIM > 6"); Box B; if (CTR == PR_CELL) { B = layout()[a_index]; } else if (CTR == PR_NODE) { B = layout()[a_index].extrude(Point::Ones()); } else { int ctr = (int)CTR; B = layout()[a_index].extrude(Point::Basis(ctr,1)); } return B;}template<typename T, unsigned int C, MemType MEM, Centering CTR>unsigned intLevelBoxData<T, C, MEM, CTR>::patchSize() const{ PROTO_ASSERT(m_isDefined, "LevelBoxData::patchSize | Error: Object not defined"); int size = 1; Point boxSize = layout().boxSize() + 2*ghost(); switch (CTR) { case PR_NODE: boxSize += Point::Ones(); break; case PR_CELL: break; default: MayDay<void>::Abort("LevelBoxData::patchSize | Specified centering not implemented"); } for (int ii = 0; ii < DIM; ii++) { size *= boxSize[ii]; } return C*size;}template<typename T, unsigned int C, MemType MEM, Centering CTR>unsigned intLevelBoxData<T, C, MEM, CTR>::offset(int a_proc) const{ return layout().offset(a_proc)*patchSize();}template<typename T, unsigned int C, MemType MEM, Centering CTR>unsigned int LevelBoxData<T, C, MEM, CTR>::numBoxes() const{ return m_layout.size();}template<typename T, unsigned int C, MemType MEM, Centering CTR>void LevelBoxData<T, C, MEM, CTR>::setToZero(int a_comp){ setVal(0, a_comp);}template<typename T, unsigned int C, MemType MEM, Centering CTR>void LevelBoxData<T, C, MEM, CTR>::setVal(T a_value, int a_comp){ PROTO_ASSERT(m_isDefined, "LevelBoxData::setVal | Error: Object not defined"); PROTO_ASSERT((a_comp >= -1) && (a_comp < DIM), "LevelBoxData::setVal | Error: %i is not a valid component specification.", a_comp); for (auto iter : m_layout) { auto& patch = (*this)[iter]; if (a_comp == -1) { patch.setVal(a_value); } else { auto patch_i = slice(patch, a_comp); patch_i.setVal(a_value); } }}template<typename T, unsigned int C, MemType MEM, Centering CTR>void LevelBoxData<T, C, MEM, CTR>::setDomainBoundary(T a_value, int a_comp){ PROTO_ASSERT(m_isDefined, "LevelBoxData::setBoundary | Error: Object not defined"); PROTO_ASSERT((a_comp >= -1) && (a_comp < DIM), "LevelBoxData::setBoundary | Error: \ %i is not a valid component specification.", a_comp); if (ghost() == Point::Zeros()){ return; } for (auto iter : m_layout) { if (!layout().onLevelBoundary(m_layout.point(iter))) { continue; } auto& patch = (*this)[iter]; if (a_comp == -1) { BoxData<T, C, MEM> tmp(layout()[iter]); patch.copyTo(tmp); patch.setVal(a_value); tmp.copyTo(patch); } else { auto patch_i = slice(patch, a_comp); BoxData<T, 1, MEM> tmp(layout()[iter]); patch_i.copyTo(tmp); patch_i.setVal(a_value); tmp.copyTo(patch_i); } } exchange();}template<typename T, unsigned int C, MemType MEM, Centering CTR>void LevelBoxData<T, C, MEM, CTR>::setRandom(T a_low, T a_high){ for (auto iter : m_layout) { auto& patch = (*this)[iter]; patch.setRandom(a_low, a_high); } exchange();}template<typename T, unsigned int C, MemType MEM, Centering CTR>void LevelBoxData<T, C, MEM, CTR>::exchange(){ PROTO_ASSERT(m_isDefined, "LevelBoxData::exchange | Error: Object not defined"); if (m_ghost == Point::Zeros()) { return; } PR_TIME("LevelBoxData::exchange"); PROTO_ASSERT(m_exchangeCopier != nullptr, "LevelBoxData::exchange | Error: exchange copier is not defined"); m_exchangeCopier-> Proto::execute()

◆ line

constexpr int Proto::line = 128

◆ num_procs

int Proto::num_procs

◆ setVal

template<int I = 0, typename Func , typename... LArgs, typename... FArgs>
std::enable_if<I < sizeof...(LArgs), void>::typecall_mb_level_forall(Func& a_func, MBIndex& a_index, Centering CTR, std::tuple<LArgs...> a_args, FArgs&&... a_fargs){ auto& arg = parse_mb_level_arg(a_index, CTR, std::get<I>a_args)); call_mb_level_forall<I+1>a_func, a_index, CTR, a_args, a_fargs..., arg);}template <typename T, unsigned int C, MemType MEM, Centering CTR>template <typename Func, typename... Srcs>void MBLevelBoxData<T, C, MEM, CTR>::initialize(Func &a_func, Srcs&... a_srcs){ auto srcs = std::tuple<Srcs&...>a_srcs...); for (auto iter : (m_layout)) { auto& patch = (*this)[iter]; auto block = layout().block(iter); call_mb_level_forall(a_func, iter, CTR, srcs, patch, block); } }template <typename T, unsigned int C, MemType MEM, Centering CTR>template <typename Func, typename... Srcs>void MBLevelBoxData<T, C, MEM, CTR>::initConvolve(Func &a_func, Srcs&... a_srcs){ auto g = ghost(); g[0] = g[0] + Point::Ones(); MBLevelBoxData<T, C, MEM, CTR> tmp(m_layout, g); tmp.initialize(a_func, a_srcs...); for (auto iter : m_layout) { auto& tmp_i = tmp[iter]; auto& patch = (*this)[iter]; Operator::convolve(patch, tmp_i); }}template <typename T, unsigned int C, MemType MEM, Centering CTR>void MBLevelBoxData<T, C, MEM, CTR>::setVal(T a_value){ for (auto data : m_data) { data-> Proto::setVal(a_value)