Chombo + EB  3.2
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
IndexType Class Reference

Cell-Based or Node-Based Indices. More...

#include <Box.H>

Public Types

enum  CellIndex { CELL = 0, NODE = 1 }
 

Public Member Functions

 IndexType ()
 
 IndexType (const IntVect &iv)
 
IndexTypeoperator= (const IndexType &rhs)
 
IndexTypeoperator= (const IntVect &iv)
 
 IndexType (D_DECL6(CellIndex i, CellIndex j, CellIndex k, CellIndex l, CellIndex m, CellIndex n))
 
void set (int dir)
 
void unset (int dir)
 
bool test (int dir) const
 
void setall ()
 
void clear ()
 
bool any () const
 
bool ok () const
 
void flip (int i)
 
bool operator== (const IndexType &t) const
 
bool operator< (const IndexType &t) const
 
bool operator!= (const IndexType &t) const
 
bool cellCentered () const
 
bool nodeCentered () const
 
void setType (int dir, CellIndex t)
 
CellIndex ixType (int dir) const
 
int operator[] (int dir) const
 
IntVect ixType () const
 

Static Public Member Functions

static IndexType TheCellType ()
 
static IndexType TheNodeType ()
 

Static Private Member Functions

static unsigned char mask (int k)
 

Private Attributes

unsigned char itype
 

Friends

std::ostream & operator<< (std::ostream &os, const IndexType &itype)
 
std::istream & operator>> (std::istream &is, IndexType &itype)
 

Detailed Description

Cell-Based or Node-Based Indices.

The class IndexType defines an index as being cell based or node (face) based in each of the CH_SPACEDIM directions. This class defines an enumerated type CellIndex to be either CELL or NODE; i.e. each of the CH_SPACEDIM dimensions must be either CELL or NODE.

Member Enumeration Documentation

◆ CellIndex

The cell index type: one of CELL or NODE.

Enumerator
CELL 
NODE 

Constructor & Destructor Documentation

◆ IndexType() [1/3]

IndexType::IndexType ( )
inline

The default constructor.

Referenced by Box::convert().

◆ IndexType() [2/3]

IndexType::IndexType ( const IntVect iv)
inlineexplicit

The copy constructor. Let compiler build default copy constructor (bvs) Constructs an IndexType identical to an IntVect.

References D_TERM6, and itype.

◆ IndexType() [3/3]

IndexType::IndexType ( D_DECL6(CellIndex i, CellIndex j, CellIndex k, CellIndex l, CellIndex m, CellIndex n)  )
inline

Constructs an IndexType given an explicit CellIndex for each direction. D_DECL6 is a macro that sets the constructor to take BL_SPACEDIM arguments.

References D_TERM6, and itype.

Member Function Documentation

◆ operator=() [1/2]

IndexType & IndexType::operator= ( const IndexType rhs)
inline

The assignment operator.

References itype.

◆ operator=() [2/2]

IndexType & IndexType::operator= ( const IntVect iv)
inline

Another assignment operator.

References D_TERM6, and itype.

◆ set()

void IndexType::set ( int  dir)
inline

Sets this IndexType to be NODE based in direction dir.

References itype, and mask().

◆ unset()

void IndexType::unset ( int  dir)
inline

Sets this IndexType to be CELL based in direction dir.

References itype, and mask().

Referenced by setType().

◆ test()

bool IndexType::test ( int  dir) const
inline

True if this IndexType is NODE based in direction dir.

References itype, and mask().

Referenced by Box::coarsenable(), and operator[]().

◆ setall()

void IndexType::setall ( )
inline

Set this IndexType to be NODE based in all directions.

References CH_SPACEDIM, and itype.

◆ clear()

void IndexType::clear ( )
inline

Set this IndexType to be CELL based in all directions.

References itype.

◆ any()

bool IndexType::any ( ) const
inline

True if this IndexType is NODE based in any direction.

References itype.

◆ ok()

bool IndexType::ok ( ) const
inline

True if this IndexType is valid.

References CH_SPACEDIM, and itype.

Referenced by Box::copy().

◆ flip()

void IndexType::flip ( int  i)
inline

Change this IndexType from CELL to NODE or NODE to CELL in direction dir.

References itype, and mask().

◆ operator==()

bool IndexType::operator== ( const IndexType t) const
inline

True if IndexTypes are identical.

References itype.

Referenced by Box::copy(), and Box::operator!=().

◆ operator<()

bool IndexType::operator< ( const IndexType t) const
inline

IndexTypes comparison.

References itype.

Referenced by Box::copy().

◆ operator!=()

bool IndexType::operator!= ( const IndexType t) const
inline

True if IndexTypes are not identical.

References itype.

Referenced by Box::copy().

◆ cellCentered()

bool IndexType::cellCentered ( ) const
inline

True if this IndexType is CELL based in all directions.

References itype.

Referenced by Box::copy().

◆ nodeCentered()

bool IndexType::nodeCentered ( ) const
inline

True if this IndexType is NODE based in all directions.

References CH_SPACEDIM, and itype.

◆ setType()

void IndexType::setType ( int  dir,
CellIndex  t 
)
inline

Set this IndexType to CellIndex type t in direction dir.

References CELL, and unset().

◆ ixType() [1/2]

IndexType::CellIndex IndexType::ixType ( int  dir) const
inline

Returns the CellIndex of this IndexType in direction dir.

References itype.

◆ operator[]()

int IndexType::operator[] ( int  dir) const
inline

Return an integer representing this IndexType in direction dir.

References test().

◆ ixType() [2/2]

IntVect IndexType::ixType ( ) const
inline

Convert this IndexType to an IntVect via component-wise conversion of enum CellIndex to int.

References D_DECL6, and itype.

Referenced by Box::copy().

◆ TheCellType()

static IndexType IndexType::TheCellType ( )
static

This static member function returns an IndexType object all of whose components are of value IndexType::CELL. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexType::CELL.

◆ TheNodeType()

static IndexType IndexType::TheNodeType ( )
static

This static member function returns an IndexType object all of whose components are of value IndexType::NODE. It is provided as a convenience to our users when defining a Box all of whose faces should be of type IndexType::NODE.

◆ mask()

unsigned char IndexType::mask ( int  k)
inlinestaticprivate

Referenced by flip(), set(), test(), and unset().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const IndexType itype 
)
friend

Write an IndexType to an ostream in ASCII.

Referenced by Box::coarsenable().

◆ operator>>

std::istream& operator>> ( std::istream &  is,
IndexType itype 
)
friend

Read an IndexType from an istream.

Referenced by Box::coarsenable().

Member Data Documentation

◆ itype

unsigned char IndexType::itype
private

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