BoxLib Namespace Reference

: Error-reporting Functions and Version Number More...


Classes

class  BF_init
class  Time
class  base_Timer
class  mt19937
class  expect

Typedefs

typedef base_Timer
< BoxLib::wsecond > 
WallTimer
typedef base_Timer
< BoxLib::second > 
CPUTimer

Functions

ArenaThe_Arena ()
ArenaResetArena (Arena *)
void Thread_Error (const char *file, int line, const char *call, int status=0)
Box surroundingNodes (const Box &b, int dir)
 Return a Box with NODE based coordinates in direction dir that encloses Box b.
Box surroundingNodes (const Box &b)
 Return a Box with NODE based coordinates in all directions that encloses Box b.
Box enclosedCells (const Box &b, int dir)
 Return a Box with CELL based coordinates in direction dir that is enclosed by b.
Box enclosedCells (const Box &b)
 Return a Box with CELL based coordinates in all directions that is enclosed by b.
Box grow (const Box &b, int i)
 Grow Box in all directions by given amount.
Box grow (const Box &b, const IntVect &v)
 Grow Box in each direction by specified amount.
Box refine (const Box &b, int refinement_ratio)
 Refine Box by given (positive) refinement ratio.
Box refine (const Box &b, const IntVect &refinement_ratio)
 Refine Box by given (positive) refinement ratio.
Box coarsen (const Box &b, int refinement_ratio)
 Coarsen Box by given (positive) refinement ratio.
Box coarsen (const Box &b, const IntVect &refinement_ratio)
 Coarsen Box by given (positive) refinement ratio.
Box minBox (const Box &b1, const Box &b2)
 Modify Box to that of the minimum Box containing both the original Box and the argument.
Box bdryLo (const Box &b, int dir, int len=1)
 Returns the edge-centered Box (in direction dir) defining the low side of Box b.
Box bdryHi (const Box &b, int dir, int len=1)
 Returns the edge-centered Box (in direction dir) defining the high side of Box b.
Box bdryNode (const Box &b, const Orientation &face, int len=1)
 Similar to bdryLo and bdryHi except that it operates on the given face of box b.
Box adjCellLo (const Box &b, int dir, int len=1)
 Return the cell centered Box of length len adjacent to b on the low end along the coordinate direction dir.
Box adjCellHi (const Box &b, int dir, int len=1)
 Similar to adjCellLo but builds an adjacent Box on the high end.
Box adjCell (const Box &b, const Orientation &face, int len=1)
 Similar to adjCellLo and adjCellHi; operates on given face.
BoxArray boxComplement (const Box &b1in, const Box &b2)
 Makes a BoxArray from the the complement of b2 in b1in.
BoxArray complementIn (const Box &b, const BoxArray &ba)
 Makes a BoxArray from the complement of BoxArray ba in Box b.
BoxArray intersect (const BoxArray &ba, const Box &b)
 Makes a BoxArray from the intersection of Box b and BoxArray ba.
BoxArray intersect (const BoxArray &lhs, const BoxArray &rhs)
 Makes a BoxArray from the intersection of two BoxArrays.
void intersect (BoxDomain &dest, const BoxDomain &fin, const Box &b)
 Compute the intersection of BoxDomain fin with Box b and place the result into BoxDomain dest.
void refine (BoxDomain &dest, const BoxDomain &fin, int ratio)
 Refine all Boxes in the domain by the refinement ratio and return the result in dest.
void accrete (BoxDomain &dest, const BoxDomain &fin, int sz=1)
 Grow each Box in BoxDomain fin by size sz and place the result into BoxDomain dest.
void coarsen (BoxDomain &dest, const BoxDomain &fin, int ratio)
 Coarsen all Boxes in the domain by the refinement ratio.
BoxDomain complementIn (const Box &b, const BoxDomain &bl)
 Returns the complement of BoxDomain bl in Box b.
void Error (const char *msg=0)
 Print out message to cerr and exit via BoxLib::Abort().
void Abort (const char *msg=0)
 Print out message to cerr and exit via abort().
void Warning (const char *msg)
 Print out warning message to cerr.
void Assert (const char *EX, const char *file, int line)
 Prints assertion failed messages to cerr and exits via abort().
void OutOfMemory (const char *file, int line)
 Prints out an out-of-memory message and aborts.
void Initialize (int &argc, char **&argv)
void Finalize ()
BoxList intersect (const BoxList &bl, const Box &b)
 Returns a BoxList defining the intersection of bl with b.
BoxList intersect (const BoxList &bl, const BoxList &br)
 Returns a BoxList defining the intersection of bl with br.
BoxList refine (const BoxList &bl, int ratio)
 Returns a new BoxList in which each Box is refined by the given ratio.
BoxList coarsen (const BoxList &bl, int ratio)
 Returns a new BoxList in which each Box is coarsened by the given ratio.
BoxList accrete (const BoxList &bl, int sz)
 Returns a new BoxList in which each Box is grown by the given size.
BoxList complementIn (const Box &b, const BoxList &bl)
 Returns a BoxList defining the complement of BoxList bl in Box b.
BoxList boxDiff (const Box &b1in, const Box &b2)
 Returns BoxList defining the compliment of b2 in b1in.
IntVect scale (const IntVect &p, int s)
 Returns a IntVect obtained by multiplying each of the components of this IntVect by s.
IntVect diagShift (const IntVect &p, int s)
 Returns IntVect obtained by adding s to each of the components of this IntVect.
IntVect min (const IntVect &p1, const IntVect &p2)
 Returns the IntVect that is the component-wise minimum of two argument IntVects.
IntVect max (const IntVect &p1, const IntVect &p2)
 Returns the IntVect that is the component-wise minimum of two argument IntVects.
IntVect BASISV (int dir)
 Returns a basis vector in the given coordinate direction; eg.
IntVect reflect (const IntVect &a, int ref_ix, int idir)
 Returns an IntVect that is the reflection of input in the plane which passes through ref and normal to the coordinate direction idir.
IntVect coarsen (const IntVect &p, int s)
 Returns an IntVect that is the component-wise integer projection of p by s.
IntVect coarsen (const IntVect &p1, const IntVect &p2)
 Returns an IntVect which is the component-wise integer projection of IntVect p1 by IntVect p2.
void linInterpAddBox (MultiFabCopyDescriptor &fabCopyDesc, BoxList *returnUnfilledBoxes, Array< FillBoxId > &returnedFillBoxIds, const Box &subbox, const MultiFabId &faid1, const MultiFabId &faid2, Real t1, Real t2, Real t, int src_comp, int dest_comp, int num_comp, bool extrap)
void linInterpFillFab (MultiFabCopyDescriptor &fabCopyDesc, const Array< FillBoxId > &fillBoxIds, const MultiFabId &faid1, const MultiFabId &faid2, FArrayBox &dest, Real t1, Real t2, Real t, int src_comp, int dest_comp, int num_comp, bool extrap)
double second (double *t=0)
 Returns the total user and system time used by the calling process up to the point of the call.
double wsecond (double *t=0)
 Returns the current time as the number of microseconds relative to program startup.
void ResetWallClockTime ()
 Reset start of Wall Clock Time for wsecond() to NOW.
bool is_integer (const char *str)
 Return true if argument is a non-zero length string of digits.
std::string Concatenate (const std::string &root, int num)
 Returns rootNNNN where NNNN == num.
bool UtilCreateDirectory (const std::string &path, mode_t mode)
 Creates the specified directories.
void CreateDirectoryFailed (const std::string &dir)
 Output a message and abort when couldn't create the directory.
void FileOpenFailed (const std::string &dir)
 Output a message and abort when couldn't open the file.
void UnlinkFile (const std::string &file)
 Attempt to unlink the file. Ignore any errors.
void OutOfMemory ()
 Aborts after printing message indicating out-of-memory; i.e.
pid_t Execute (const char *cmd)
 Try to execute a shell command in a subshell.
void InitRandom (unsigned long seed)
 Set the seed of the random number generator.
double Random ()
 Mersenne Twister pseudo-random number generator.
template<double(*)(double *) FCN>
std::ostream & operator<< (std::ostream &, const base_Timer< FCN > &)
std::istream & operator>> (std::istream &, const expect &exp)

Variables

const bool NDebug = false
const int SpaceDim = BL_SPACEDIM


Detailed Description

: Error-reporting Functions and Version Number

: Useful C++ Utility Functions

The SpaceDim C++ integer constant specifies the dimension of the BoxLib library to be built.

This class consists entirely of static error-reporting functions that are used throughout the BoxLib implementation together with a version string. In the best of all possible worlds we'd use a namespace, but we aren't there, yet :-) Note that all the output functions add a terminating exclamation mark, so there is no need to add any punctuation to sentences that get output explicitly.

It is initialized to the value of the macro BL. Hence it will have one of the values 1, 2, or 3.

C++ code that depends on the dimensionality of the problem that you're trying to solve should be cast in terms of this constant, instead of the BL macro, if possible, as constants are visible to debuggers while macros are not.

This data-less class is a poor-person's namespace of utility functions. Since we can't assume the existence of namespaces, and we don't like global functions, we put them into a data-less class as static member functions.


Typedef Documentation

typedef base_Timer<BoxLib::second> BoxLib::CPUTimer

typedef base_Timer<BoxLib::wsecond> BoxLib::WallTimer


Function Documentation

void BoxLib::Abort ( const char *  msg  ) 

BoxList BoxLib::accrete ( const BoxList bl,
int  sz 
)

Returns a new BoxList in which each Box is grown by the given size.

References BoxList::accrete().

void BoxLib::accrete ( BoxDomain dest,
const BoxDomain fin,
int  sz 
)

Grow each Box in BoxDomain fin by size sz and place the result into BoxDomain dest.

References BoxDomain::accrete().

Box BoxLib::adjCell ( const Box b,
const Orientation face,
int  len 
)

Similar to adjCellLo and adjCellHi; operates on given face.

References Box::bigEnd(), BL_ASSERT, Orientation::coordDir(), Orientation::isLow(), Box::ixType(), IntVect::setVal(), Box::smallEnd(), and Box::type().

Box BoxLib::adjCellHi ( const Box b,
int  dir,
int  len 
)

Similar to adjCellLo but builds an adjacent Box on the high end.

References Box::bigEnd(), BL_ASSERT, Box::ixType(), IntVect::setVal(), Box::smallEnd(), and Box::type().

Box BoxLib::adjCellLo ( const Box b,
int  dir,
int  len = 1 
)

Return the cell centered Box of length len adjacent to b on the low end along the coordinate direction dir.

The return Box is identical to b in the other directions. The return Box and b have an empty intersection. NOTE: len >= 1 NOTE: Box retval = b.adjCellLo(b,dir,len) is equivalent to the following set of operations: Box retval(b); retval.convert(dir,Box::CELL); retval.setrange(dir,retval.smallEnd(dir)-len,len);

References Box::bigEnd(), BL_ASSERT, Box::ixType(), and Box::smallEnd().

void BoxLib::Assert ( const char *  EX,
const char *  file,
int  line 
)

Prints assertion failed messages to cerr and exits via abort().

Intended for use by the BL() macro in <BLassert.H>.

References ParallelDescriptor::Abort(), and write_to_stderr_without_buffering().

Referenced by OutOfMemory().

IntVect BoxLib::BASISV ( int  dir  ) 

Returns a basis vector in the given coordinate direction; eg.

IntVect3d BASISV(1) == (0,1,0). Note that the coordinate directions are zero based.

References BL_ASSERT.

Box BoxLib::bdryHi ( const Box b,
int  dir,
int  len 
)

Returns the edge-centered Box (in direction dir) defining the high side of Box b.

References Box::bigEnd(), Box::ixType(), IntVect::setVal(), Box::smallEnd(), and Box::type().

Box BoxLib::bdryLo ( const Box b,
int  dir,
int  len 
)

Returns the edge-centered Box (in direction dir) defining the low side of Box b.

References Box::bigEnd(), Box::ixType(), and Box::smallEnd().

Box BoxLib::bdryNode ( const Box b,
const Orientation face,
int  len 
)

Similar to bdryLo and bdryHi except that it operates on the given face of box b.

References Box::bigEnd(), Orientation::coordDir(), Orientation::isLow(), Box::ixType(), IntVect::setVal(), Box::smallEnd(), and Box::type().

BoxArray BoxLib::boxComplement ( const Box b1in,
const Box b2 
)

Makes a BoxArray from the the complement of b2 in b1in.

References boxDiff().

BoxList BoxLib::boxDiff ( const Box b1in,
const Box b2 
)

IntVect BoxLib::coarsen ( const IntVect p1,
const IntVect p2 
)

Returns an IntVect which is the component-wise integer projection of IntVect p1 by IntVect p2.

References BL_ASSERT, and IntVect::TheZeroVector().

IntVect BoxLib::coarsen ( const IntVect p,
int  s 
)

Returns an IntVect that is the component-wise integer projection of p by s.

References BL_ASSERT.

BoxList BoxLib::coarsen ( const BoxList bl,
int  ratio 
)

Returns a new BoxList in which each Box is coarsened by the given ratio.

References BoxList::coarsen().

void BoxLib::coarsen ( BoxDomain dest,
const BoxDomain fin,
int  ratio 
)

Coarsen all Boxes in the domain by the refinement ratio.

The result is placed into a new BoxDomain.

References BoxDomain::coarsen().

Box BoxLib::coarsen ( const Box b,
const IntVect refinement_ratio 
)

Coarsen Box by given (positive) refinement ratio.

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio. NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1). That is, refinement of coarsened Box must contain the original Box.

References Box::coarsen().

Box BoxLib::coarsen ( const Box b,
int  refinement_ratio 
)

Coarsen Box by given (positive) refinement ratio.

NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio. NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1). That is, refinement of coarsened Box must contain the original Box.

References Box::coarsen().

BoxList BoxLib::complementIn ( const Box b,
const BoxList bl 
)

Returns a BoxList defining the complement of BoxList bl in Box b.

References BoxList::begin(), boxDiff(), BoxList::end(), and Box::ixType().

BoxDomain BoxLib::complementIn ( const Box b,
const BoxDomain bl 
)

Returns the complement of BoxDomain bl in Box b.

References BoxDomain::complementIn().

BoxArray BoxLib::complementIn ( const Box b,
const BoxArray ba 
)

Makes a BoxArray from the complement of BoxArray ba in Box b.

References BoxArray::boxList().

Referenced by BoxList::contains(), and BoxArray::contains().

std::string BoxLib::Concatenate ( const std::string &  root,
int  num 
)

Returns rootNNNN where NNNN == num.

void BoxLib::CreateDirectoryFailed ( const std::string &  dir  ) 

Output a message and abort when couldn't create the directory.

References Error().

IntVect BoxLib::diagShift ( const IntVect p,
int  s 
)

Returns IntVect obtained by adding s to each of the components of this IntVect.

Box BoxLib::enclosedCells ( const Box b  ) 

Return a Box with CELL based coordinates in all directions that is enclosed by b.

References Box::enclosedCells().

Box BoxLib::enclosedCells ( const Box b,
int  dir 
)

Return a Box with CELL based coordinates in direction dir that is enclosed by b.

NOTE: equivalent to b.convert(dir,CELL) NOTE: error if b.type(dir) == CELL.

References Box::enclosedCells().

void BoxLib::Error ( const char *  msg  ) 

pid_t BoxLib::Execute ( const char *  cmd  ) 

Try to execute a shell command in a subshell.

User is responsible for calling waitpid() on the pid returned from this function.

References Thread::exit(), and fork().

void BoxLib::FileOpenFailed ( const std::string &  file  ) 

Output a message and abort when couldn't open the file.

References Error().

Referenced by VisMF::Read(), VisMF::VisMF(), and VisMF::Write().

void BoxLib::Finalize (  ) 

Box BoxLib::grow ( const Box b,
const IntVect v 
)

Grow Box in each direction by specified amount.

References Box::grow().

Box BoxLib::grow ( const Box b,
int  i 
)

void BoxLib::Initialize ( int &  argc,
char **&  argv 
)

void BoxLib::InitRandom ( unsigned long  seed  ) 

Set the seed of the random number generator.

References the_generator.

Referenced by Initialize().

BoxList BoxLib::intersect ( const BoxList bl,
const BoxList br 
)

Returns a BoxList defining the intersection of bl with br.

References BoxList::intersect().

Referenced by FabArrayCopyDescriptor< FAB >::AddBoxDoIt().

BoxList BoxLib::intersect ( const BoxList bl,
const Box b 
)

Returns a BoxList defining the intersection of bl with b.

References BoxList::intersect().

void BoxLib::intersect ( BoxDomain dest,
const BoxDomain fin,
const Box b 
)

Compute the intersection of BoxDomain fin with Box b and place the result into BoxDomain dest.

References BoxDomain::intersect().

BoxArray BoxLib::intersect ( const BoxArray lhs,
const BoxArray rhs 
)

Makes a BoxArray from the intersection of two BoxArrays.

References BoxArray::boxList(), and intersect().

BoxArray BoxLib::intersect ( const BoxArray ba,
const Box b 
)

Makes a BoxArray from the intersection of Box b and BoxArray ba.

References BoxArray::boxList().

Referenced by intersect().

bool BoxLib::is_integer ( const char *  str  ) 

Return true if argument is a non-zero length string of digits.

void BoxLib::linInterpAddBox ( MultiFabCopyDescriptor fabCopyDesc,
BoxList returnUnfilledBoxes,
Array< FillBoxId > &  returnedFillBoxIds,
const Box subbox,
const MultiFabId faid1,
const MultiFabId faid2,
Real  t1,
Real  t2,
Real  t,
int  src_comp,
int  dest_comp,
int  num_comp,
bool  extrap 
)

void BoxLib::linInterpFillFab ( MultiFabCopyDescriptor fabCopyDesc,
const Array< FillBoxId > &  fillBoxIds,
const MultiFabId faid1,
const MultiFabId faid2,
FArrayBox dest,
Real  t1,
Real  t2,
Real  t,
int  src_comp,
int  dest_comp,
int  num_comp,
bool  extrap 
)

IntVect BoxLib::max ( const IntVect p1,
const IntVect p2 
)

IntVect BoxLib::min ( const IntVect p1,
const IntVect p2 
)

Returns the IntVect that is the component-wise minimum of two argument IntVects.

References IntVect::min().

Referenced by grovel(), MultiFab::min(), IntVect::min(), BaseFab< T >::min(), and BoxLib::base_Timer< FCN >::tick().

Box BoxLib::minBox ( const Box b1,
const Box b2 
)

Modify Box to that of the minimum Box containing both the original Box and the argument.

Both Boxes must have identical type.

References Box::minBox().

template<double(*)(double *) FCN>
std::ostream& BoxLib::operator<< ( std::ostream &  ,
const base_Timer< FCN > &   
) [inline]

std::istream& BoxLib::operator>> ( std::istream &  ,
const expect &  exp 
)

void BoxLib::OutOfMemory (  ) 

Aborts after printing message indicating out-of-memory; i.e.

operator new has failed. This is the "supported" set() function for BoxLib applications.

References Error().

void BoxLib::OutOfMemory ( const char *  file,
int  line 
)

Prints out an out-of-memory message and aborts.

It is called by various BoxLib routines when a call to new fails.

Called as BoxLib::OutOfMemory(, );

References Assert().

Referenced by Initialize().

double BoxLib::Random (  ) 

Mersenne Twister pseudo-random number generator.

Generates one pseudorandom real number (double) which is uniformly distributed on [0,1]-interval for each call.

Accepts any 32-bit integer as a seed -- uses 4357 as the default.

Has a period of 2**19937.

Mersenne Twister Home Page: http://www.math.keio.ac.jp/matumoto/emt.html

There is also an entry point for Fortran callable as:

REAL rn call blutilrand(rn)

References BoxLib::mt19937::d_value(), and the_generator.

BoxList BoxLib::refine ( const BoxList bl,
int  ratio 
)

Returns a new BoxList in which each Box is refined by the given ratio.

References BoxList::refine().

void BoxLib::refine ( BoxDomain dest,
const BoxDomain fin,
int  ratio 
)

Refine all Boxes in the domain by the refinement ratio and return the result in dest.

References BoxDomain::refine().

Box BoxLib::refine ( const Box b,
const IntVect refinement_ratio 
)

Refine Box by given (positive) refinement ratio.

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1. NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

References Box::refine().

Box BoxLib::refine ( const Box b,
int  refinement_ratio 
)

Refine Box by given (positive) refinement ratio.

NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1. NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio.

References Box::refine().

IntVect BoxLib::reflect ( const IntVect a,
int  ref_ix,
int  idir 
)

Returns an IntVect that is the reflection of input in the plane which passes through ref and normal to the coordinate direction idir.

References BL_ASSERT.

Arena * BoxLib::ResetArena ( Arena newarena  ) 

void BoxLib::ResetWallClockTime (  ) 

Reset start of Wall Clock Time for wsecond() to NOW.

defined(BL_ARCH_CRAY) && !defined(WIN32) && !defined(BL_T3E)

References get_initial_wall_clock_time().

IntVect BoxLib::scale ( const IntVect p,
int  s 
)

Returns a IntVect obtained by multiplying each of the components of this IntVect by s.

double BoxLib::second ( double *  t = 0  ) 

Returns the total user and system time used by the calling process up to the point of the call.

If t != 0, it also stores the result in t.

References Error(), and Warning().

Box BoxLib::surroundingNodes ( const Box b  ) 

Return a Box with NODE based coordinates in all directions that encloses Box b.

References Box::surroundingNodes().

Box BoxLib::surroundingNodes ( const Box b,
int  dir 
)

Return a Box with NODE based coordinates in direction dir that encloses Box b.

NOTE: equivalent to b.convert(dir,NODE) NOTE: error if b.type(dir) == NODE.

References Box::surroundingNodes().

Arena * BoxLib::The_Arena (  ) 

void BoxLib::Thread_Error ( const char *  file,
int  line,
const char *  call,
int  status = 0 
)

References Error(), and the_message_string().

void BoxLib::UnlinkFile ( const std::string &  file  ) 

Attempt to unlink the file. Ignore any errors.

Referenced by VisMF::Write().

bool BoxLib::UtilCreateDirectory ( const std::string &  path,
mode_t  mode 
)

Creates the specified directories.

`path' may be either a full pathname or a relative pathname. It will create all the directories in the pathname, if they don't already exist, so that on successful return the pathname refers to an existing directory. Returns true or false depending upon whether or not all it was successful. Also returns if `path' is NULL or "/". `mode' is the mode passed to mkdir() for any directories that must be created.

For example, if it is passed the string "/a/b/c/d/e/f/g", it will return successfully when all the directories in the pathname exist; i.e. when the full pathname is a valid directory.

In a Windows environment, the path separator is a '\', so that if using the example given above you must pass the string "\\a\\b\\c\\d\\e\\f\\g" (Note that you must escape the backslash in a character string),

References path_sep_str.

void BoxLib::Warning ( const char *  msg  ) 

Print out warning message to cerr.

Referenced by DistributionMapping::Initialize(), and second().

double BoxLib::wsecond ( double *  t = 0  ) 

Returns the current time as the number of microseconds relative to program startup.

If t != 0, it also stores the result in t.

References BL_Initial_Wall_Clock_Time, BL_Initial_Wall_Clock_Time_Init, BL_Initial_Wall_Clock_Time_sec, BL_Initial_Wall_Clock_Time_usec, and get_initial_wall_clock_time().

Referenced by BoxLib::Time::get_time(), and ParallelDescriptor::second().


Variable Documentation

const bool BoxLib::NDebug = false

const int BoxLib::SpaceDim = BL_SPACEDIM


Generated on Fri Nov 21 10:11:05 2008 for AMRParticlePaths by  doxygen 1.5.5