Chombo + EB
3.0
|
An FArrayBox container for storage on the codimensions of a box. More...
#include <CodimBox.H>
Public Types | |
enum | { numCD = SpaceDim + 1, numAI = 1 << SpaceDim } |
Public Member Functions | |
CodimBox () | |
Default constructor. More... | |
CodimBox (const int a_codim, const Box &a_box, const int a_nvar) | |
Full constructor. More... | |
~CodimBox () | |
Destructor. More... | |
void | define (const int a_codim, const Box &a_box, const int a_nvar) |
Full define function. More... | |
void | define (const Box &a_box, int a_nvar) |
Define function. More... | |
void | clear () |
Deallocate. More... | |
int | getCodim () const |
Return the codimension. More... | |
int | nComp () const |
Number of components. More... | |
int | getNumOrient () const |
Number of different orientations of codimensional objects. More... | |
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. More... | |
void | getDirections (const int a_iOrient, int *const a_dir) const |
Get all the orthogonal directions of an orientation. More... | |
const Box & | box () const |
Returns cell-centered box which defines the CodimBox. More... | |
const FArrayBox & | operator() (const Box &a_box) const |
Returns FArrayBox in the directions defined by a Box. More... | |
FArrayBox & | operator() (const Box &a_box) |
Returns FArrayBox in the directions defined by a Box. More... | |
const FArrayBox & | operator() (const IndexType &a_ixType) const |
Returns FArrayBox in the directions defined by an IndexType. More... | |
FArrayBox & | operator() (const IndexType &a_ixType) |
const FArrayBox & | operator() () const |
Returns FArrayBox in the given direction (codimension 0) More... | |
FArrayBox & | operator() () |
const FArrayBox & | operator() (const int a_dir0) const |
Returns FArrayBox in the given direction (codimension 1) More... | |
FArrayBox & | operator() (const int a_dir0) |
const FArrayBox & | operator() (const int a_dir0, const int a_dir1) const |
Returns FArrayBox in the given direction (codimension 2) More... | |
FArrayBox & | operator() (const int a_dir0, const int a_dir1) |
const FArrayBox & | operator() (const int a_dir0, const int a_dir1, const int a_dir2) const |
Returns FArrayBox in the given direction (codimension 3) More... | |
FArrayBox & | operator() (const int a_dir0, const int a_dir1, const int a_dir2) |
const FArrayBox & | 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) More... | |
FArrayBox & | operator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3) |
const FArrayBox & | 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) More... | |
FArrayBox & | operator() (const int a_dir0, const int a_dir1, const int a_dir2, const int a_dir3, const int a_dir4) |
const FArrayBox & | 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) More... | |
FArrayBox & | 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 & | getSequential (const int a_iOrient) const |
Returns FArrayBox from a sequential index. More... | |
FArrayBox & | getSequential (const int a_iOrient) |
void | setVal (const Real a_x) |
Set all values in all FAB. More... | |
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. More... | |
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. More... | |
int | size (const Box &a_R, const Interval &a_comps) const |
Returns size of serialized data. More... | |
void | linearOut (void *a_buf, const Box &a_R, const Interval &a_comps) const |
Writes a serialized representation of this CodimBox. More... | |
void | linearIn (void *a_buf, const Box &a_R, const Interval &a_comps) |
Reads a serialized representation of this CodimBox. More... | |
Static Public Member Functions | |
static void | initialize () |
Initialize static lookup tables. More... | |
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. More... | |
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 &) | |
CodimBox & | operator= (const CodimBox &) |
FArrayBox & | getFArrayBox (const unsigned i) |
Return the FArray box from a bit description of the orientation. More... | |
const FArrayBox & | getFArrayBox (const unsigned i) const |
Return the FArray box from a bit description of the orientation. More... | |
Static Private Member Functions | |
static bool | isInitialized () |
Check that static arrays are initialized. More... | |
static void | genGetDirections (const int a_codim, int a_bOrient, int *const a_dir) |
Get all the orthogonal directions of an orientation (general) More... | |
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. More... | |
Vector< FArrayBox * > | m_FArrayBox |
The FArrayBoxes for each orientation. More... | |
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 *
anonymous enum |
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.
|
private |
|
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.
|
inline |
Return the codimension.
References m_codim.
|
inline |
Number of components.
References m_nvar.
|
inline |
|
inlinestatic |
Number of different orientations of codimensional objects. Used externally for any codimension.
References CH_assert, isInitialized(), and numOrient.
|
inline |
Switch from a bit orientation to a sequential index of the orientation
References indexFAB.
Referenced by getFArrayBox().
|
inline |
Switch from a sequential index to a bit representation of the orientation
References bitOrient, m_codim, and totOrient.
Referenced by getDirections(), and orientBox().
|
inlinestatic |
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.
|
inline |
Get all the orthogonal directions of an orientation.
[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 |
References genGetDirections(), m_codim, and seq2bit().
|
inlinestatic |
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.
[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 |
References CH_assert, genGetDirections(), isInitialized(), and seq2bit().
|
inline |
Returns FArrayBox in the directions defined by a Box.
References Box::ixType(), and operator()().
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 | ||
) |
|
inline |
Returns FArrayBox from a sequential index.
[in] | a_iOrient | A sequential orientation index. |
* bitOrient[totOrient[a_codim] + a_iOrient] *
References CH_assert, m_codim, m_FArrayBox, and numOrient.
|
inline |
References CH_assert, m_codim, m_FArrayBox, and numOrient.
void CodimBox::setVal | ( | const Real | a_x | ) |
Set all values in all FAB.
|
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
[in] | a_bOrient | A bit orientation index. |
References m_box.
Orient a centered box in the othogonal directions of the given orientation
Orient a centered box in the othogonal directions of the given orientation
[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. |
References genOrientBox(), and seq2bit().
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.
[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. |
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.
|
inlinestatic |
Report preallocation capability as non-static but symmetric.
The size of the class is dependent upon the codimension. See BoxLayoutData.H for more info
Returns size of serialized data.
Writes a serialized representation of this CodimBox.
Reads a serialized representation of this CodimBox.
|
inlinestaticprivate |
Check that static arrays are initialized.
Test assumes static arrays have at least been default initialized.
References indexFAB.
Referenced by getDirections(), getNumOrient(), orientBox(), and seq2bit().
|
inlineprivate |
Return the FArray box from a bit description of the orientation.
References bit2seq(), and m_FArrayBox.
|
inlineprivate |
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'
[in] | a_bOrient | Bit description of the orientation |
References bit2seq(), and m_FArrayBox.
|
staticprivate |
Get all the orthogonal directions of an orientation (general)
Referenced by getDirections().
Orient a centered box in the othogonal directions of the given orientation (general)
Referenced by orientBox().
|
staticprotected |
Number of orientations for an object of a given codimension
Referenced by getNumOrient(), and getSequential().
|
staticprotected |
Total of number of orientations for all smaller codimensions
Referenced by seq2bit().
|
staticprotected |
A sequential list of bit representations of possible orientations for each codimension
Referenced by seq2bit().
|
staticprotected |
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().
|
private |
Cell-centered box over which this CodimBox is defined
Referenced by box(), and orientBox().
|
private |
Codimension for which the FArrayBoxes are defined
Referenced by CodimBoxFactory::create(), getCodim(), getDirections(), getNumOrient(), getSequential(), and seq2bit().
The FArrayBoxes for each orientation.
Referenced by getFArrayBox(), and getSequential().