class IntVect

An Integer Vector in SpaceDim-Dimensional Space

Inheritance:

IntVect


public members:

Constructors and Accessors
IntVect ()
~IntVect()
IntVect (D_DECL(int i, int j, int k))
explicit IntVect (const int* a)
const int* dataPtr() const
int* dataPtr()
IntVect (const IntVect& rhs)
IntVect& operator= (const IntVect& rhs)
inline int& operator[] (int i)
inline int operator[] (int i) const
void setVal (int i, int val)
const int* getVect () const

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

Arithmetic Operators
IntVect operator+ () const
IntVect operator- () const

addition
IntVect& operator+= (int s)
IntVect& operator+= (const IntVect& p)
IntVect operator+ (const IntVect& p) const
IntVect operator+ (int s) const
friend inline IntVect operator+ (int s, const IntVect& p)

subtraction
IntVect& operator-= (int s)
IntVect& operator-= (const IntVect& p)
IntVect operator- (const IntVect& p) const
IntVect operator- (int s) const
friend inline IntVect operator- (int s, const IntVect& p)

multiplication
IntVect& operator*= (int s)
IntVect& operator*= (const IntVect& p)
IntVect operator* (const IntVect& p) const
IntVect operator* (int s) const
friend inline IntVect operator* (int s, const IntVect& p)

division
IntVect& operator/= (int s)
IntVect& operator/= (const IntVect& p)
IntVect operator/ (const IntVect& p) const
IntVect operator/ (int s) const

other
IntVect& min (const IntVect& p)
friend inline IntVect min (const IntVect& p1, const IntVect& p2)
IntVect& max (const IntVect& p)
friend inline IntVect max (const IntVect& p1, const IntVect& p2)
IntVect& scale (int s)
friend inline IntVect scale (const IntVect& p, int s)
IntVect& reflect (int ref_ix, int idir)
friend inline IntVect reflect(const IntVect& a, int ref_ix, int idir)
IntVect& shift (int coord, int s)
IntVect& shift (const IntVect& iv)
IntVect& diagShift (int s)
friend inline IntVect diagShift (const IntVect& p, int s)
IntVect& coarsen (const IntVect& p)
IntVect& coarsen (int p)
friend inline IntVect coarsen (const IntVect& p, int s)
friend inline IntVect coarsen (const IntVect& p1, const IntVect& p2)

I/O Functions
void printOn (std::ostream& os) const
void p() const
void dumpOn (std::ostream& os) const
friend std::ostream& operator<< (std::ostream& os, const IntVect& iv)
friend std::istream& operator>> (std::istream& os, IntVect& iv)

IntVect Constants
friend inline IntVect BASISV (int dir)
static const IntVect Zero
static const IntVect Unit

Documentation

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.
IntVect ()
Construct an IntVect whose components are uninitialized.

~IntVect ()
Destructor

IntVect (D_DECL(int i, int j, int k))
Construct an IntVect given the specific values for its coordinates. D_DECL is a macro that sets the constructor to take CH_SPACEDIM arguments.

explicit IntVect (const int* a)
Construct an IntVect setting the coordinates to the corresponding values in the integer array a.

const int* dataPtr () const
only for sending to fortran

int* dataPtr ()
only for sending to fortran

IntVect (const IntVect& rhs)
The copy constructor.

IntVect& operator= (const IntVect& rhs)
The assignment operator.

inline int& operator[] (int i)
Returns a modifiable lvalue reference to the i'th coordinate of the IntVect.

inline int operator[] (int i) const
Returns the i'th coordinate of the IntVect.

void setVal (int i, int val)
Set i'th coordinate of IntVect to val.

const int* getVect () const
Returns a const pointer to an array of coordinates of the IntVect. Useful for arguments to FORTRAN calls.

bool operator== (const IntVect& p) const
Returns true if this IntVect is equivalent to argument IntVect. All comparisons between analogous components must be satisfied.

bool operator!= (const IntVect& p) const
Returns true if this IntVect is different from argument IntVect. All comparisons between analogous components must be satisfied.

bool operator< (const IntVect& p) const
Returns true if this IntVect is less than argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is componentwise, it is possible for an IntVect to be neither greater than, less than, nor equal to another.

bool operator<= (const IntVect& p) const
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 componentwise, it is possible for an IntVect to be neither greater than or equal to, less than or equal to, nor equal to another.

bool operator> (const IntVect& p) const
Returns true if this IntVect is greater than argument IntVect. All comparisons between analogous components must be satisfied. Note that, since the comparison is componentwise, it is possible for an IntVect to be neither greater than, less than, nor equal to another.

bool operator>= (const IntVect& p) const
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 componentwise, it is possible for an IntVect to be neither greater than or equal to, less than or equal to, nor equal to another.

bool lexLT (const IntVect& s) const
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])))));

bool lexGT (const IntVect& s) const
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]));

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

IntVect operator+ () const
Unary plus -- for completeness.

IntVect operator- () const
Unary Minus -- negates all components of this IntVect.

IntVect& operator+= (int s)
Modifies this IntVect by addition of a scalar to each component.

IntVect& operator+= (const IntVect& p)
Modifies this IntVect by component-wise addition with argument.

IntVect operator+ (const IntVect& p) const
Returns component-wise sum of this IntVect and argument.

IntVect operator+ (int s) const
Return an IntVect that is this IntVect with a scalar added to each component.

friend inline IntVect operator+ (int s, const IntVect& p)
Returns an IntVect that is an IntVect p with a scalar s added to each component.

IntVect& operator-= (int s)
Modifies this IntVect by subtraction of a scalar from each component.

IntVect& operator-= (const IntVect& p)
Modifies this IntVect by component-wise subtraction with argument.

IntVect operator- (const IntVect& p) const
Returns component-wise difference of this IntVect and argument.

IntVect operator- (int s) const
Returns an IntVect that is this IntVect with a scalar s subtracted from each component.

friend inline IntVect operator- (int s, const IntVect& p)
Returns -p + s.

IntVect& operator*= (int s)
Modifies this IntVect by multiplication of a scalar to each component.

IntVect& operator*= (const IntVect& p)
Modifies this IntVect by component-wise multiplication with argument.

IntVect operator* (const IntVect& p) const
Returns component-wise product of this IntVect and argument.

IntVect operator* (int s) const
Returns an IntVect that is this IntVect with each component multiplied by a scalar.

friend inline IntVect operator* (int s, const IntVect& p)
Returns and IntVect that is an IntVect p with each component multiplied by a scalar s.

IntVect& operator/= (int s)
Modifies this IntVect by division by a scalar of each component.

IntVect& operator/= (const IntVect& p)
Modifies this IntVect by component-wise division with IntVect argument.

IntVect operator/ (const IntVect& p) const
Returns component-wise division of this IntVect by IntVect argument.

IntVect operator/ (int s) const
Returns component-wise division of this IntVect by scalar s.

IntVect& min (const IntVect& p)
Modifies this IntVect by taking component-wise min with IntVect argument.

friend inline 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& p)
Modifies this IntVect by taking component-wise max with //IntVect argument.

friend inline IntVect max (const IntVect& p1, const IntVect& p2)
Returns the IntVect that is the component-wise minimum of two argument IntVects.

IntVect& scale (int s)
Modifies this IntVect by multiplying each component by a scalar.

friend inline IntVect scale (const IntVect& p, int s)
Returns an IntVect obtained by multiplying each of the components of the given IntVect by a scalar.

IntVect& reflect (int ref_ix, int idir)
Modifies IntVect by reflecting it in the plane defined by the index ref_ix and with normal in the direction of idir. Directions are zero-based.

friend inline IntVect reflect (const IntVect& a, int ref_ix, int idir)
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.

IntVect& shift (int coord, int s)
Modifies this IntVect by adding s to component in given coordinate direction.

IntVect& shift (const IntVect& iv)
Modifies this IntVect by component-wise addition with IntVect argument.

IntVect& diagShift (int s)
Modifies this IntVect by adding a scalar s to each component.

friend inline IntVect diagShift (const IntVect& p, int s)
Returns IntVect obtained by adding a scalar to each of the components of the given IntVect.

IntVect& coarsen (const IntVect& p)
Modify IntVect by component-wise integer projection.

IntVect& coarsen (int p)
Modify IntVect by component-wise integer projection.

friend inline IntVect coarsen (const IntVect& p, int s)
Returns an IntVect that is the component-wise integer projection of p by s.

friend inline 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 printOn (std::ostream& os) const
Print an IntVect to the ostream.

void p () const
Print an IntVect to the pout().

void dumpOn (std::ostream& os) const
Print an IntVect to the ostream a bit more verbosely.

friend std::ostream& operator<< (std::ostream& os, const IntVect& iv)
Print the IntVect to given output stream in ASCII.

friend std::istream& operator>> (std::istream& os, IntVect& iv)
Read next IntVect from given input stream.

friend inline IntVect 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.

static const IntVect Zero
This is an IntVect all of whose components are equal to zero.

static const IntVect Unit
This is an IntVect all of whose components are equal to one.


this class has no child classes.

alphabetic index hierarchy of classes


Chombo

Copyright Notice

This software is copyright (C) by the Lawrence Berkeley National Laboratory. Permission is granted to reproduce this software for non-commercial purposes provided that this notice is left intact.

It is acknowledged that the U.S. Government has rights to this software under Contract DE-AC03-765F00098 between the U.S. Department of Energy and the University of California.

This software is provided as a professional and academic contribution for joint exchange. Thus it is experimental, is provided ``as is'', with no warranties of any kind whatsoever, no support, no promise of updates, or printed documentation. By using this software, you acknowledge that the Lawrence Berkeley National Laboratory and Regents of the University of California shall have no liability with respect to the infringement of other copyrights by any part of this software.