CodimBox Class Reference

#include <CodimBox.H>

List of all members.


Detailed Description

An FArrayBox container for storage on the codimensions of a box.

The orientation of a box is described by specifying the orthogonal directions and internally, this is converted to a bit representation. Direction 'i' is bit 2^i (or via shifting as 1 << i). Directions can be specified in any order. For example, the edges in 3D orthogonal to directions i and j may be specified as (0, 1) or (1, 0). Internally, both are converted to 0x3. Orientations can be described by sequential indices or bit representations. The routines seq2bit and bit2seq can be used to switch between the two using lookup tables.

For example, a 3 dimensional space has the following codimensions, bit representations, and sequential indices of the orientations:

 *         Codim   Bit   Integer   Sequential   numOrient   totOrient
 *   Dir           zyx
 *             0   000         0            0           1           0
 *             1   001         1            0           3           1
 *             1   010         2            1
 *             1   100         4            2
 *             2   011         3            0           3           4
 *             2   101         5            1
 *             2   110         6            2
 *             3   111         7            0           1           7
 *                                                                  
The 'indexFAB' and 'bitOrient' are then defined as follows:
 *     indexFAB:  0 0 1 0 2 1 2 0
 *     bitOrient: 0 1 2 4 3 5 6 7
 *                                                                  
Note:
  • CodimBoxFactory is also defined in this file for use with BoxLayoutData and similar containers
  • A FluxBox is essentially a CodimBox with codimension 1.
  • Not much functionality exists in this class beyond creating and retrieving the FArrayBoxes.
  • Codimension 0 is the original object spanning 'SpaceDim' dimensions. Using this is no different from an FArrayBox itself.
  • Codimension 'SpaceDim' is a vertex. This is also the same as an FArrayBox that surrounds all nodes.

Public Types

enum  { numCD = SpaceDim + 1, numAI = 1 << SpaceDim }

Public Member Functions

 CodimBox ()
 Default constructor.
 CodimBox (const int a_codim, const Box &a_box, const int a_nvar)
 Full constructor.
 ~CodimBox ()
 Destructor.
void define (const int a_codim, const Box &a_box, const int a_nvar)
 Full define function.
void define (const Box &a_box, int a_nvar)
 Define function.
void clear ()
 Deallocate.
int getCodim () const
 Return the codimension.
int nComp () const
 Number of components.
int getNumOrient () const
 Number of different orientations of codimensional objects.
int bit2seq (const unsigned a_bOrient) const
unsigned seq2bit (const int a_iOrient) const
int getDirection (const int a_iOrient, int a_i) const
 Get the 'i'th orthogonal direction of an orientation.
void getDirections (const int a_iOrient, int *const a_dir) const
 Get all the orthogonal directions of an orientation.
const Boxbox () const
 Returns cell-centered box which defines the CodimBox.
const FArrayBoxoperator() (const Box &a_box) const
 Returns FArrayBox in the directions defined by a Box.
FArrayBoxoperator() (const Box &a_box)
 Returns FArrayBox in the directions defined by a Box.
const FArrayBoxoperator() (const IndexType &a_ixType) const
 Returns FArrayBox in the directions defined by an IndexType.
FArrayBoxoperator() (const IndexType &a_ixType)
const FArrayBoxoperator() () const
 Returns FArrayBox in the given direction (codimension 0).
FArrayBoxoperator() ()
const FArrayBoxoperator() (const int a_dir0) const
 Returns FArrayBox in the given direction (codimension 1).
FArrayBoxoperator() (const int a_dir0)
const FArrayBoxoperator() (const int a_dir0, const int a_dir1) const
 Returns FArrayBox in the given direction (codimension 2).
FArrayBoxoperator() (const int a_dir0, const int a_dir1)
const FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2) const
 Returns FArrayBox in the given direction (codimension 3).
FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2)
const FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3) const
 Returns FArrayBox in the given direction (codimension 4).
FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3)
const FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3, const int a_dir4) const
 Returns FArrayBox in the given direction (codimension 5).
FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3, const int a_dir4)
const FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3, const int a_dir4, const int a_dir5) const
 Returns FArrayBox in the given direction (codimension 6).
FArrayBoxoperator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3, const int a_dir4, const int a_dir5)
const FArrayBoxgetSequential (const int a_iOrient) const
 Returns FArrayBox from a sequential index.
FArrayBoxgetSequential (const int a_iOrient)
void setVal (const Real a_x)
 Set all values in all FAB.
Box orientBox (const int a_iOrient) const
Box orientBox (const int a_iOrient, const Box &a_cbox) const
void copy (const Box &a_R, const Interval &a_Cd, const CodimBox &a_src, const Interval &a_Cs)
 Copy from another CodimBox.
void copy (const Box &a_Rs, const Interval &a_Cd, const Box &a_Rd, const CodimBox &a_src, const Interval &a_Cs)
 Copy from another CodimBox but to a different region.
int size (const Box &a_R, const Interval &a_comps) const
 Returns size of serialized data.
void linearOut (void *a_buf, const Box &a_R, const Interval &a_comps) const
 Writes a serialized representation of this CodimBox.
void linearIn (void *a_buf, const Box &a_R, const Interval &a_comps)
 Reads a serialized representation of this CodimBox.

Static Public Member Functions

static void initialize ()
 Initialize static lookup tables.
static int getNumOrient (const int a_codim)
static unsigned seq2bit (const int a_codim, const int a_iOrient)
static void getDirections (const int a_codim, const int a_iOrient, int *const a_dir)
static Box orientBox (const int a_codim, const int a_iOrient, const Box &a_cbox)
static int preAllocatable ()
 Report preallocation capability as non-static but symmetric.

Static Protected Attributes

static int numOrient [numCD]
static int totOrient [numCD]
static unsigned bitOrient [CodimBox::numAI]
static int indexFAB [CodimBox::numAI]

Private Member Functions

 CodimBox (const CodimBox &)
CodimBoxoperator= (const CodimBox &)
FArrayBoxgetFArrayBox (const unsigned i)
 Return the FArray box from a bit description of the orientation.
const FArrayBoxgetFArrayBox (const unsigned i) const
 Return the FArray box from a bit description of the orientation.

Static Private Member Functions

static bool isInitialized ()
 Check that static arrays are initialized.
static void genGetDirections (const int a_codim, int a_bOrient, int *const a_dir)
 Get all the orthogonal directions of an orientation (general).
static Box genOrientBox (int a_bOrient, Box a_cbox)

Private Attributes

Box m_box
int m_codim
int m_nvar
 Number of components in the FArrayBox.
Vector< FArrayBox * > m_FArrayBox
 The FArrayBoxes for each orientation.

Member Enumeration Documentation

anonymous enum

Enumerator:
numCD  Number of codimensions.
numAI  Total orientations (array indices) for all codimensions


Constructor & Destructor Documentation

CodimBox::CodimBox (  ) 

Default constructor.

Referenced by CodimBoxFactory::create().

CodimBox::CodimBox ( const int  a_codim,
const Box a_box,
const int  a_nvar 
)

Full constructor.

CodimBox::~CodimBox (  ) 

Destructor.

CodimBox::CodimBox ( const CodimBox  )  [private]


Member Function Documentation

static void CodimBox::initialize (  )  [static]

Initialize static lookup tables.

void CodimBox::define ( const int  a_codim,
const Box a_box,
const int  a_nvar 
)

Full define function.

void CodimBox::define ( const Box a_box,
int  a_nvar 
)

Define function.

void CodimBox::clear (  ) 

Deallocate.

int CodimBox::getCodim (  )  const [inline]

Return the codimension.

References m_codim.

int CodimBox::nComp (  )  const [inline]

Number of components.

References m_nvar.

int CodimBox::getNumOrient (  )  const [inline]

Number of different orientations of codimensional objects.

References m_codim, and numOrient.

int CodimBox::getNumOrient ( const int  a_codim  )  [inline, static]

Number of different orientations of codimensional objects. Used externally for any codimension.

Number of different orientations of codimensional objects. Used externally for any codimension.

References CH_assert, isInitialized(), and numOrient.

int CodimBox::bit2seq ( const unsigned  a_bOrient  )  const [inline]

Switch from a bit orientation to a sequential index of the orientation

Switch from a bit orientation to a sequential index of the orientation

References indexFAB.

Referenced by getFArrayBox().

unsigned CodimBox::seq2bit ( const int  a_iOrient  )  const [inline]

Switch from a sequential index to a bit representation of the orientation

Switch from a sequential index to a bit representation of the orientation

References bitOrient, m_codim, and totOrient.

Referenced by getDirections(), and orientBox().

unsigned CodimBox::seq2bit ( const int  a_codim,
const int  a_iOrient 
) [inline, static]

Switch from a sequential index to a bit representation of the orientation for any codimension

Switch from a sequential index to a bit representation of the orientation for any codimension

References bitOrient, CH_assert, isInitialized(), and totOrient.

int CodimBox::getDirection ( const int  a_iOrient,
int  a_i 
) const

Get the 'i'th orthogonal direction of an orientation.

void CodimBox::getDirections ( const int  a_iOrient,
int *const   a_dir 
) const [inline]

Get all the orthogonal directions of an orientation.

Parameters:
[in] a_iOrient The sequential orientation index from which to get the directions
[in] a_dir Array with minimum size [m_codim]
[out] a_dir Integers defining the directions 0 <= dir[i] < SpaceDim
Note:
  • The directions are orderd from smallest to largest.

References genGetDirections(), m_codim, and seq2bit().

void CodimBox::getDirections ( const int  a_codim,
const int  a_iOrient,
int *const   a_dir 
) [inline, static]

Get all the orthogonal directions of an orientation. Used externally for any codimension.

Get all the orthogonal directions of an orientation. Used externally for any codimension.

Parameters:
[in] a_codim The codimension
[in] a_iOrient The sequential orientation index from which to get the directions
[in] a_dir Array with minimum size [m_codim]
[out] a_dir Integers defining the directions 0 <= dir[i] < SpaceDim
Note:
  • The directions are orderd from smallest to largest.

References CH_assert, genGetDirections(), isInitialized(), and seq2bit().

const Box & CodimBox::box (  )  const [inline]

Returns cell-centered box which defines the CodimBox.

References m_box.

const FArrayBox& CodimBox::operator() ( const Box a_box  )  const

Returns FArrayBox in the directions defined by a Box.

FArrayBox & CodimBox::operator() ( const Box a_box  )  [inline]

Returns FArrayBox in the directions defined by a Box.

References Box::ixType(), and operator()().

const FArrayBox& CodimBox::operator() ( const IndexType a_ixType  )  const

Returns FArrayBox in the directions defined by an IndexType.

FArrayBox& CodimBox::operator() ( const IndexType a_ixType  ) 

const FArrayBox& CodimBox::operator() (  )  const

Returns FArrayBox in the given direction (codimension 0).

Referenced by operator()().

FArrayBox& CodimBox::operator() (  ) 

const FArrayBox& CodimBox::operator() ( const int  a_dir0  )  const

Returns FArrayBox in the given direction (codimension 1).

FArrayBox& CodimBox::operator() ( const int  a_dir0  ) 

const FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1 
) const

Returns FArrayBox in the given direction (codimension 2).

FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1 
)

const FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2 
) const

Returns FArrayBox in the given direction (codimension 3).

FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2 
)

const FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3 
) const

Returns FArrayBox in the given direction (codimension 4).

FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3 
)

const FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3,
const int  a_dir4 
) const

Returns FArrayBox in the given direction (codimension 5).

FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3,
const int  a_dir4 
)

const FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3,
const int  a_dir4,
const int  a_dir5 
) const

Returns FArrayBox in the given direction (codimension 6).

FArrayBox& CodimBox::operator() ( const int  a_dir0,
const int  a_dir1,
const int  a_dir2,
const int  a_dir3,
const int  a_dir4,
const int  a_dir5 
)

const FArrayBox & CodimBox::getSequential ( const int  a_iOrient  )  const [inline]

Returns FArrayBox from a sequential index.

Parameters:
[in] a_iOrient A sequential orientation index.
Note:
  • A bit description of the orientation can be obtained from
     *            bitOrient[totOrient[a_codim] + a_iOrient]
     *          

References CH_assert, m_codim, m_FArrayBox, and numOrient.

FArrayBox & CodimBox::getSequential ( const int  a_iOrient  )  [inline]

References CH_assert, m_codim, m_FArrayBox, and numOrient.

void CodimBox::setVal ( const Real  a_x  ) 

Set all values in all FAB.

Box CodimBox::orientBox ( const int  a_bOrient  )  const [inline]

Orient the stored box in the othogonal directions of the given orientation

Orient the stored box in the othogonal directions of the given orientation

Parameters:
[in] a_bOrient A bit orientation index.

References m_box.

Box CodimBox::orientBox ( const int  a_iOrient,
const Box a_cbox 
) const [inline]

Orient a centered box in the othogonal directions of the given orientation

Orient a centered box in the othogonal directions of the given orientation

Parameters:
[in] a_iOrient A sequential orientation index. This is converted to a bit orientation for finding the orthogonal directions.
[in] a_cbox A centered box.
Returns:
The orientated box

References genOrientBox(), and seq2bit().

Box CodimBox::orientBox ( const int  a_codim,
const int  a_iOrient,
const Box a_cbox 
) [inline, static]

Orient a centered box in the othogonal directions of the given orientation. Used externally for any codimension.

Orient a centered box in the othogonal directions of the given orientation. Used externally for any codimension.

Parameters:
[in] a_codim The codimension of the box
[in] a_iOrient A sequential orientation index. This is converted to a bit orientation for finding the orthogonal directions.
[in] a_cbox A centered box.
Returns:
The orientated box

References CH_assert, genOrientBox(), isInitialized(), and seq2bit().

void CodimBox::copy ( const Box a_R,
const Interval a_Cd,
const CodimBox a_src,
const Interval a_Cs 
)

Copy from another CodimBox.

void CodimBox::copy ( const Box a_Rs,
const Interval a_Cd,
const Box a_Rd,
const CodimBox a_src,
const Interval a_Cs 
)

Copy from another CodimBox but to a different region.

int CodimBox::preAllocatable (  )  [inline, static]

Report preallocation capability as non-static but symmetric.

The size of the class is dependent upon the codimension. See BoxLayoutData.H for more info

int CodimBox::size ( const Box a_R,
const Interval a_comps 
) const

Returns size of serialized data.

void CodimBox::linearOut ( void *  a_buf,
const Box a_R,
const Interval a_comps 
) const

Writes a serialized representation of this CodimBox.

void CodimBox::linearIn ( void *  a_buf,
const Box a_R,
const Interval a_comps 
)

Reads a serialized representation of this CodimBox.

CodimBox& CodimBox::operator= ( const CodimBox  )  [private]

bool CodimBox::isInitialized (  )  [inline, static, private]

Check that static arrays are initialized.

Test assumes static arrays have at least been default initialized.

Returns:
T - Arrays initialized

References indexFAB.

Referenced by getDirections(), getNumOrient(), orientBox(), and seq2bit().

FArrayBox & CodimBox::getFArrayBox ( const unsigned  i  )  [inline, private]

Return the FArray box from a bit description of the orientation.

References bit2seq(), and m_FArrayBox.

const FArrayBox & CodimBox::getFArrayBox ( const unsigned  a_bOrient  )  const [inline, private]

Return the FArray box from a bit description of the orientation.

The appropriate FArray box for this codimension and orientation is given by a query to 'indexFAB'

Parameters:
[in] a_bOrient Bit description of the orientation

References bit2seq(), and m_FArrayBox.

static void CodimBox::genGetDirections ( const int  a_codim,
int  a_bOrient,
int *const   a_dir 
) [static, private]

Get all the orthogonal directions of an orientation (general).

Referenced by getDirections().

static Box CodimBox::genOrientBox ( int  a_bOrient,
Box  a_cbox 
) [static, private]

Orient a centered box in the othogonal directions of the given orientation (general)

Referenced by orientBox().


Member Data Documentation

int CodimBox::numOrient[numCD] [static, protected]

Number of orientations for an object of a given codimension

Referenced by getNumOrient(), and getSequential().

int CodimBox::totOrient[numCD] [static, protected]

Total of number of orientations for all smaller codimensions

Referenced by seq2bit().

unsigned CodimBox::bitOrient[CodimBox::numAI] [static, protected]

A sequential list of bit representations of possible orientations for each codimension

Referenced by seq2bit().

int CodimBox::indexFAB[CodimBox::numAI] [static, protected]

Returns the index of the FArrayBox for a given codimension and orientation. The input index expresses the orientation as the sum of the orthogonal directions.

Referenced by bit2seq(), and isInitialized().

Box CodimBox::m_box [private]

Cell-centered box over which this CodimBox is defined

Referenced by box(), and orientBox().

int CodimBox::m_codim [private]

Codimension for which the FArrayBoxes are defined

Referenced by CodimBoxFactory::create(), getCodim(), getDirections(), getNumOrient(), getSequential(), and seq2bit().

int CodimBox::m_nvar [private]

Number of components in the FArrayBox.

Referenced by nComp().

The FArrayBoxes for each orientation.

Referenced by getFArrayBox(), and getSequential().


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

Generated on Mon Nov 20 03:42:55 2017 for Chombo + EB by  doxygen 1.5.5