Chombo + EB  3.2
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Static Protected Attributes | Friends | List of all members
IntVect Class Reference

An integer Vector in SpaceDim-dimensional space. More...

#include <CHArray.H>

Public Member Functions

 IntVect (D_DECL6(const int i0, const int i1, const int i2, const int i3, const int i4, const int i5))
 
 IntVect (const IntVect &iv)
 
int & operator[] (const int i)
 
const int & operator[] (const int i) const
 
int product () const
 
uint64_t hash (const IntVect &origin, const IntVect &blockingFactor) const
 
Constructors and Accessors
 IntVect ()
 
 IntVect (const Vector< int > &vi)
 
 IntVect (D_DECL6(int i, int j, int k, int l, int m, int n))
 
 IntVect (const int *a)
 
 IntVect (const IndexTM< int, CH_SPACEDIM > &a_tm)
 
IntVect copy () const
 
int & operator[] (int i)
 
int operator[] (int i) const
 
void setVal (int i, int val)
 
Data pointer functions
const int * getVect () const
 
const int * dataPtr () const
 
int * dataPtr ()
 
Comparison Operators
bool operator== (const IntVect &p) const
 
bool operator!= (const IntVect &p) const
 
bool operator< (const IntVect &p) const
 
bool operator<= (const IntVect &p) const
 
bool operator> (const IntVect &p) const
 
bool operator>= (const IntVect &p) const
 
bool lexLT (const IntVect &s) const
 
bool lexGT (const IntVect &s) const
 
Unary operators
IntVect operator+ () const
 
IntVect operator- () const
 
int sum () const
 
int product () const
 
Division operators
IntVectoperator/= (int s)
 
IntVectoperator/= (const IntVect &p)
 
IntVect operator/ (const IntVect &p) const
 
IntVect operator/ (int s) const
 

Public Attributes

int vec [SpaceDim]
 

Static Public Attributes

static size_t io_offset
 

Protected Attributes

int vect [CH_SPACEDIM]
 

Static Protected Attributes

static const size_t IntVectSize
 
static const uint32_t morton256_x [256]
 
static const uint32_t morton256_y [256]
 
static const uint32_t morton256_z [256]
 

Friends

class Box
 
class HDF5Handle
 
class VolIndex
 
class FaceIndex
 
class BLfacade::IntVect
 

Addition operators

IntVect operator+ (int s, const IntVect &p)
 
IntVectoperator+= (int s)
 
IntVectoperator+= (const IntVect &p)
 
IntVect operator+ (const IntVect &p) const
 
IntVect operator+ (int s) const
 

Subtraction operators

IntVect operator- (int s, const IntVect &p)
 
IntVectoperator-= (int s)
 
IntVectoperator-= (const IntVect &p)
 
IntVect operator- (const IntVect &p) const
 
IntVect operator- (int s) const
 

Multiplication operators

IntVect operator* (int s, const IntVect &p)
 
IntVectoperator*= (int s)
 
IntVectoperator*= (const IntVect &p)
 
IntVect operator* (const IntVect &p) const
 
IntVect operator* (int s) const
 

Other arithmetic operators

IntVect min (const IntVect &p1, const IntVect &p2)
 
IntVect max (const IntVect &p1, const IntVect &p2)
 
IntVect scale (const IntVect &p, int s)
 
const IntVect absolute (const IntVect &p)
 Returns the componentwise absolute value of the given IntVect. More...
 
IntVect reflect (const IntVect &a, int ref_ix, int idir)
 
IntVect diagShift (const IntVect &p, int s)
 
IntVect coarsen (const IntVect &p, int s)
 
IntVect coarsen (const IntVect &p1, const IntVect &p2)
 
IntVectmin (const IntVect &p)
 
IntVectmax (const IntVect &p)
 
int max () const
 return the maximum value in the intvect More...
 
int min () const
 return the minimum value in the intvect More...
 
IntVectscale (int s)
 
IntVectreflect (int ref_ix, int idir)
 
IntVectshift (int coord, int s)
 
IntVectshift (const IntVect &iv)
 
IntVectdiagShift (int s)
 
IntVectcoarsen (const IntVect &p)
 
IntVectcoarsen (int p)
 

I/O Functions

std::ostream & operator<< (std::ostream &os, const IntVect &iv)
 
std::istream & operator>> (std::istream &os, IntVect &iv)
 
void printOn (std::ostream &os) const
 
void p () const
 
void dumpOn (std::ostream &os) const
 

Constants

static const IntVect Zero
 
static const IntVect Unit
 
IntVect BASISV (int dir)
 
static int InitStatics ()
 

Detailed Description

An integer Vector in SpaceDim-dimensional space.

The class IntVect is an implementation of an integer vector in a SpaceDim-dimensional space. It represents a point in a discrete space. IntVect values are accessed using the operator[] function, as for a normal C++ array. In addition, the basic arithmetic operators have been overloaded to implement scaling and translation operations.

Constructor & Destructor Documentation

◆ IntVect() [1/7]

IntVect::IntVect ( D_DECL6(const int i0, const int i1, const int i2, const int i3, const int i4, const int i5)  )
inline

References D_TERM6, and vec.

◆ IntVect() [2/7]

IntVect::IntVect ( const IntVect iv)
inline

References D_TERM6, and vec.

◆ IntVect() [3/7]

IntVect::IntVect ( )
inline

Construct an IntVect whose components are uninitialized.

Referenced by Box::size().

◆ IntVect() [4/7]

IntVect::IntVect ( const Vector< int > &  vi)
inlineexplicit

References D_DECL6.

◆ IntVect() [5/7]

IntVect::IntVect ( D_DECL6(int i, int j, int k, int l, int m, int n)  )
inlineexplicit

Destructor. Let the compiler build the default destructor (bvs) Construct an IntVect given the specific values for its coordinates. D_DECL6 is a macro that sets the constructor to take CH_SPACEDIM arguments.

◆ IntVect() [6/7]

IntVect::IntVect ( const int *  a)
inlineexplicit

Construct an IntVect setting the coordinates to the corresponding values in the integer array a.

References CH_assert, operator[](), and SpaceDim.

◆ IntVect() [7/7]

IntVect::IntVect ( const IndexTM< int, CH_SPACEDIM > &  a_tm)

The copy constructor. let compiler build default copy constructor (bvs)

Member Function Documentation

◆ operator[]() [1/4]

int & IntVect::operator[] ( const int  i)
inline

References vec.

Referenced by IntVect().

◆ operator[]() [2/4]

int IntVect::operator[] ( const int  i) const
inline

References vec.

◆ product() [1/2]

int IntVect::product ( ) const
inline

References SpaceDim, and vec.

Referenced by CHArray< T, Rank, ArConf, Alloc >::define(), and sum().

◆ copy()

IntVect IntVect::copy ( ) const
inline

◆ operator[]() [3/4]

int& IntVect::operator[] ( int  i)
inline

The assignment operator. Let compiler build default assign operator Returns a modifiable lvalue reference to the i'th coordinate of the IntVect.

◆ operator[]() [4/4]

int IntVect::operator[] ( int  i) const
inline

Returns the i'th coordinate of the IntVect.

◆ setVal()

void IntVect::setVal ( int  i,
int  val 
)
inline

Set i'th coordinate of IntVect to val.

References CH_assert, and SpaceDim.

◆ getVect()

const int * IntVect::getVect ( ) const
inline

Returns a const pointer to an array of coordinates of the IntVect. Useful for arguments to FORTRAN calls.

Referenced by IVSFAB< T >::hiVect(), and IVSFAB< T >::loVect().

◆ dataPtr() [1/2]

const int * IntVect::dataPtr ( ) const
inline

Only for sending to Fortran

◆ dataPtr() [2/2]

int * IntVect::dataPtr ( )
inline

Only for sending to Fortran

◆ operator==()

bool IntVect::operator== ( const IntVect p) const
inline

Returns true if this IntVect is equivalent to argument IntVect. All comparisons between analogous components must be satisfied.

References D_TERM6.

◆ operator!=()

bool IntVect::operator!= ( const IntVect p) const
inline

Returns true if this IntVect is different from argument IntVect. All comparisons between analogous components must be satisfied.

References D_TERM6.

◆ operator<()

bool IntVect::operator< ( const IntVect p) const
inline

Returns true if this IntVect is less than argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an IntVect to be neither greater than, less than, nor equal to another.

References D_TERM6.

◆ operator<=()

bool IntVect::operator<= ( const IntVect p) const
inline

Returns true if this IntVect is less than or equal to argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an IntVect to be neither greater than or equal to, less than or equal to, nor equal to another.

References D_TERM6.

◆ operator>()

bool IntVect::operator> ( const IntVect p) const
inline

Returns true if this IntVect is greater than argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an IntVect to be neither greater than, less than, nor equal to another.

References D_TERM6.

◆ operator>=()

bool IntVect::operator>= ( const IntVect p) const
inline

Returns true if this IntVect is greater than or equal to argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is component-wise, it is possible for an IntVect to be neither greater than or equal to, less than or equal to, nor equal to another.

References D_TERM6.

◆ lexLT()

bool IntVect::lexLT ( const IntVect s) const
inline

Returns true if this IntVect is lexically less than the argument. An IntVect MUST BE either lexically less than, lexically greater than, or equal to another IntVect.

iv1 is lexically less than iv2 if:

in 2-D:
(iv1[0] < iv2[0]) || ((iv1[0] == iv2[0]) && (iv1[1] < iv2[1]));

in 3-D:
(iv1[0] < iv2[0]) || (iv1[0]==iv2[0] && ((iv1[1] < iv2[1] || ((iv1[1] == iv2[1]) && (iv1[2] < iv2[2])))));

Referenced by lex_compare_iv::operator()(), VolIndex::operator<(), and operator<().

◆ lexGT()

bool IntVect::lexGT ( const IntVect s) const
inline

Returns true if this IntVect is lexically greater than the argument. An IntVect MUST BE either lexically less than, lexically greater than, or equal to another IntVect.

iv1 is lexically less than iv2 if:

in 2-D:
(iv1[0] > iv2[0]) || ((iv1[0] == iv2[0]) && (iv1[1] > iv2[1]));

in 3-D:
(iv1[0] > iv2[0]) || (iv1[0]==iv2[0] && ((iv1[1] > iv2[1] || ((iv1[1] == iv2[1]) && (iv1[2] > iv2[2])))));

◆ operator+() [1/3]

IntVect IntVect::operator+ ( ) const
inline

Unary plus – for completeness.

◆ operator-() [1/3]

IntVect IntVect::operator- ( ) const
inline

Unary minus – negates all components of this IntVect.

References D_DECL6.

◆ sum()

int IntVect::sum ( ) const
inline

Sum of all components of this IntVect.

References D_TERM6, and product().

◆ product() [2/2]

int IntVect::product ( ) const

Product of all components of this IntVect.

◆ operator+=() [1/2]

IntVect & IntVect::operator+= ( int  s)
inline

Modifies this IntVect by addition of a scalar to each component.

◆ operator+=() [2/2]

IntVect & IntVect::operator+= ( const IntVect p)
inline

Modifies this IntVect by component-wise addition with argument.

◆ operator+() [2/3]

IntVect IntVect::operator+ ( const IntVect p) const
inline

Returns component-wise sum of this IntVect and argument.

References D_DECL6.

◆ operator+() [3/3]

IntVect IntVect::operator+ ( int  s) const
inline

Return an IntVect that is this IntVect with a scalar added to each component.

References D_DECL6.

◆ operator-=() [1/2]

IntVect & IntVect::operator-= ( int  s)
inline

Modifies this IntVect by subtraction of a scalar from each component.

◆ operator-=() [2/2]

IntVect & IntVect::operator-= ( const IntVect p)
inline

Modifies this IntVect by component-wise subtraction by argument.

◆ operator-() [2/3]

IntVect IntVect::operator- ( const IntVect p) const
inline

Returns an IntVect that is this IntVect with p subtracted from it component-wise.

References D_DECL6.

◆ operator-() [3/3]

IntVect IntVect::operator- ( int  s) const
inline

Returns an IntVect that is this IntVect with a scalar s subtracted from each component.

References D_DECL6.

◆ operator*=() [1/2]

IntVect & IntVect::operator*= ( int  s)
inline

Modifies this IntVect by multiplication of each component by a scalar.

◆ operator*=() [2/2]

IntVect & IntVect::operator*= ( const IntVect p)
inline

Modifies this IntVect by component-wise multiplication by argument.

◆ operator*() [1/2]

IntVect IntVect::operator* ( const IntVect p) const
inline

Returns component-wise product of this IntVect with argument.

References D_DECL6.

◆ operator*() [2/2]

IntVect IntVect::operator* ( int  s) const
inline

Returns an IntVect that is this IntVect with each component multiplied by a scalar.

References D_DECL6.

◆ operator/=() [1/2]

IntVect & IntVect::operator/= ( int  s)
inline

Modifies this IntVect by division of each component by a scalar.

◆ operator/=() [2/2]

IntVect & IntVect::operator/= ( const IntVect p)
inline

Modifies this IntVect by component-wise division by IntVect argument.

◆ operator/() [1/2]

IntVect IntVect::operator/ ( const IntVect p) const
inline

Returns component-wise quotient of this IntVect by argument.

References D_DECL6.

◆ operator/() [2/2]

IntVect IntVect::operator/ ( int  s) const
inline

Returns an IntVect that is this IntVect with each component divided by a scalar.

References D_DECL6.

◆ min() [1/2]

IntVect & IntVect::min ( const IntVect p)
inline

Modifies this IntVect by taking component-wise min with IntVect argument.

References Min(), and vect.

Referenced by blockWrite(), min(), and write().

◆ max() [1/2]

IntVect & IntVect::max ( const IntVect p)
inline

Modifies this IntVect by taking component-wise max with IntVect argument.

References Max(), and vect.

Referenced by max().

◆ max() [2/2]

int IntVect::max ( ) const
inline

return the maximum value in the intvect

References Max(), and SpaceDim.

◆ min() [2/2]

int IntVect::min ( ) const
inline

return the minimum value in the intvect

References absolute(), BASISV(), coarsen(), diagShift(), max(), Min(), operator<<(), operator>>(), reflect(), scale(), and SpaceDim.

◆ scale()

IntVect & IntVect::scale ( int  s)
inline

Modifies this IntVect by multiplying each component by a scalar.

◆ reflect()

IntVect & IntVect::reflect ( int  ref_ix,
int  idir 
)
inline

Modifies IntVect by reflecting it in the plane defined by the index ref_ix and with normal in the direction of idir. Directions are based at zero.

References CH_assert, and SpaceDim.

◆ shift() [1/2]

IntVect & IntVect::shift ( int  coord,
int  s 
)
inline

Modifies this IntVect by adding s to component in given coordinate direction.

References CH_assert, and SpaceDim.

◆ shift() [2/2]

IntVect & IntVect::shift ( const IntVect iv)
inline

Modifies this IntVect by component-wise addition with IntVect argument.

◆ diagShift()

IntVect & IntVect::diagShift ( int  s)
inline

Modifies this IntVect by adding a scalar s to each component.

◆ coarsen() [1/2]

IntVect & IntVect::coarsen ( const IntVect p)
inline

Modify IntVect by component-wise integer projection.

References CH_assert, SpaceDim, vect, and Zero.

◆ coarsen() [2/2]

IntVect & IntVect::coarsen ( int  p)
inline

Modify IntVect by component-wise integer projection.

References CH_assert, and SpaceDim.

◆ printOn()

void IntVect::printOn ( std::ostream &  os) const

Print an IntVect to the ostream.

◆ p()

void IntVect::p ( ) const

◆ dumpOn()

void IntVect::dumpOn ( std::ostream &  os) const

Print an IntVect to the ostream a bit more verbosely.

◆ InitStatics()

static int IntVect::InitStatics ( )
static

Initializes Zero and Unit.

◆ hash()

uint64_t IntVect::hash ( const IntVect origin,
const IntVect blockingFactor 
) const
inline

References CH_SPACEDIM.

Friends And Related Function Documentation

◆ Box

friend class Box
friend

◆ HDF5Handle

friend class HDF5Handle
friend

◆ VolIndex

friend class VolIndex
friend

◆ FaceIndex

friend class FaceIndex
friend

◆ BLfacade::IntVect

friend class BLfacade::IntVect
friend

◆ operator+

IntVect operator+ ( int  s,
const IntVect p 
)
friend

Returns an IntVect that is an IntVect p with a scalar s added to each component.

◆ operator-

IntVect operator- ( int  s,
const IntVect p 
)
friend

Returns s - p.

◆ operator*

IntVect operator* ( int  s,
const IntVect p 
)
friend

Returns an IntVect that is an IntVect p with each component multiplied by a scalar s.

◆ min

IntVect min ( const IntVect p1,
const IntVect p2 
)
friend

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

◆ max

IntVect max ( const IntVect p1,
const IntVect p2 
)
friend

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

◆ scale

IntVect scale ( const IntVect p,
int  s 
)
friend

Returns an IntVect obtained by multiplying each of the components of the given IntVect by a scalar.

◆ absolute

const IntVect absolute ( const IntVect p)
friend

Returns the componentwise absolute value of the given IntVect.

◆ reflect

IntVect reflect ( const IntVect a,
int  ref_ix,
int  idir 
)
friend

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

◆ diagShift

IntVect diagShift ( const IntVect p,
int  s 
)
friend

Returns IntVect obtained by adding a scalar to each of the components of the given IntVect.

◆ coarsen [1/2]

IntVect coarsen ( const IntVect p,
int  s 
)
friend

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

◆ coarsen [2/2]

IntVect coarsen ( const IntVect p1,
const IntVect p2 
)
friend

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

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const IntVect iv 
)
friend

Print the IntVect to given output stream in ASCII.

◆ operator>>

std::istream& operator>> ( std::istream &  os,
IntVect iv 
)
friend

Read next IntVect from given input stream.

◆ BASISV

IntVect BASISV ( int  dir)
friend

Returns a basis vector in the given coordinate direction.
In 3-D: BASISV(0) == (1,0,0); BASISV(1) == (0,1,0); BASISV(2) == (0,0,1).
In 2-D: BASISV(0) == (1,0); BASISV(1) == (0,1).
Note that the coordinate directions are based at zero.

Member Data Documentation

◆ vec

int IntVect::vec[SpaceDim]

Referenced by IntVect(), operator[](), and product().

◆ Zero

const IntVect IntVect::Zero
static

◆ Unit

const IntVect IntVect::Unit
static

◆ io_offset

size_t IntVect::io_offset
static

◆ vect

int IntVect::vect[CH_SPACEDIM]
protected

The individual components of this IntVect.

Referenced by BASISV(), coarsen(), coarsen(), Box::index(), max(), min(), and reflect().

◆ IntVectSize

const size_t IntVect::IntVectSize
staticprotected

Number of bytes of storage used by this IntVect.

◆ morton256_x

const uint32_t IntVect::morton256_x[256]
staticprotected

◆ morton256_y

const uint32_t IntVect::morton256_y[256]
staticprotected

◆ morton256_z

const uint32_t IntVect::morton256_z[256]
staticprotected

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