IntVectSet Class Reference

#include <IntVectSet.H>

Collaboration diagram for IntVectSet:

Collaboration graph
[legend]

List of all members.


Detailed Description

An irregular domain on an integer lattice.

IntVectSet represents an irregular region in an integer lattice SpaceDim-dimensional index space as an arbitrary collection of IntVects. A full set calculus is defined. Any IntVect or cell-centered Box can be fully represented as an IntVectSet. There is an iterator that provides access to the contents of an IntVectSet. IntVectSets are implicitly cell-centered. Intersection, union, and complement operations are defined for pairs of IntVectSets (and, by extension, an IntVectSet and an IntVect or an IntVectSet and a Box). The minimum Box of an IntVectSet is defined as the smallest Box that contains every IntVect in the IntVectSet.

The IntVects in an IntVectSet do not have a canonical ordering.

Union operators

IntVectSet operator| (const IntVectSet &ivs1, const IntVectSet &ivs2)
 Returns a new IntVectSet that is the union of two IntVectSets.
IntVectSet operator| (const IntVectSet &ivs, const IntVect &iv)
 Returns a new IntVectSet that is the union of an IntVectSet and an IntVect.
IntVectSet operator| (const IntVect &iv, const IntVectSet &ivs)
 Returns a new IntVectSet that is the union of an IntVectSet and an IntVect.
IntVectSet operator| (const IntVectSet &ivs, const Box &b)
 Returns a new IntVectSet that is the union of an IntVectSet and a Box.
IntVectSet operator| (const Box &b, const IntVectSet &ivs)
 Returns a new IntVectSet that is the union of an IntVectSet and a Box.
IntVectSetoperator|= (const IntVectSet &ivs)
 unions another IntVectSet ivs into this IntVectSet
void or_intvectset (const IntVectSet &ivs)
 same as operator|= except it doesn't return *this
IntVectSetoperator|= (const IntVect &iv)
 unions a single IntVect iv into this IntVectSet
void or_intvect (const IntVect &ivs)
 same as operator|= except it doesn't return *this
IntVectSetoperator|= (const Box &b)
 unions the IntVects in the Box into this IntVectSet
void or_box (const Box &b)
 same as operator|= except it doesn't return *this

Intersection operators

IntVectSet operator & (const IntVectSet &ivs1, const IntVectSet &ivs2)
 Returns a new IntVectSet that is the intersection of two IntVectSets.
IntVectSet operator & (const IntVectSet &ivs, const Box &b)
 Returns a new IntVectSet that is the intersection of an IntVectSet and a Box.
IntVectSet operator & (const Box &b, const IntVectSet &ivs)
 Returns a new IntVectSet that is the intersection of an IntVectSet and a Box.
IntVectSetoperator &= (const IntVectSet &ivs)
 Modifies this IntVectSet to its intersection with another IntVectSet.
void and_intvectset (const IntVectSet &ivs)
 same as operator&= except it doesn't return *this
IntVectSetoperator &= (const Box &b)
 Modifies this IntVectSet to be its intersection with a Box.
void and_box (const Box &b)
 same as operator&= except it doesn't return *this
IntVectSetoperator &= (const ProblemDomain &domain)
 Modifies this IntVectSet to be its intersection with the Box in a ProblemDomain.
void and_domain (const ProblemDomain &d)
 same as operator&= except it doesn't return *this

Modification functions

IntVectSet grow (const IntVectSet &ivs, int igrow)
 Add IntVects to an IntVectSet in all directions.
IntVectSet refine (const IntVectSet &ivs, int iref=2)
 Refine all the IntVects in an IntVectSet.
IntVectSet coarsen (const IntVectSet &ivs, int iref=2)
 Coarsen all the IntVects in an IntVectSet.
void grow (int igrow)
 Add IntVects to this IntVectSet in all directions.
IntVectSetgrow (int idir, int igrow)
 Add IntVects to this IntVectSet in one direction.
void grow_dir (int idir, int igrow)
 same as grow(idir,igrow) except doesn't return *this
IntVectSetrefine (int iref=2)
 Refine all the IntVects in this IntVecSet.
IntVectSetcoarsen (int iref=2)
 Coarsen all the IntVects in this IntVectSet.
void shift (const IntVect &iv)
 Increment all the IntVects in this IntVectSet by the IntVect iv.
void nestingRegion (int radius, const Box &domain, int granularity=1)
 Make this IntVectSet be properly nested.
void nestingRegion (int radius, const ProblemDomain &probdomain, int granularity=1)
 Make this IntVectSet be properly nested.
void nestingRegion_prob (int radius, const ProblemDomain &probdomain)
 same as nestingRegion() except it doesn't return *this
void makeEmpty ()
 Modifies this IntVectSet to be empty.
IntVectSet chop (int dir, int chop_pnt)
 Chop the IntVectSet at the chop_pnt index in the dir direction.
void chop (int dir, int chop_pnt, IntVectSet &a_hi)
static void setMaxDense (const int &a_maxDense)

Constructors, Destructor, and defines

 ~IntVectSet ()
 IntVectSet ()
 default constructor: defines an empty IntVectSet.
void define ()
 default define: modifies this IntVectSet to be empty.
 IntVectSet (const IntVectSet &ivs)
 copy constructor
void define (const IntVectSet &ivs)
 copy define: modifies this IntVectSet into a copy of ivs
void define_intvectset (const IntVectSet &ivs)
 copy define: same as define(IntVectSet)
IntVectSet copy () const
 return a copy of this IntVectSet
 IntVectSet (const DenseIntVectSet &a_dense)
 conversion constructor
void define (const DenseIntVectSet &a_dense)
 conversion define
 IntVectSet (const TreeIntVectSet &a_tree)
 conversion constructor
void define (const TreeIntVectSet &a_tree)
 conversion define
 IntVectSet (const IntVect &iv)
 IntVect constructor.
void define (const IntVect &iv)
 IntVect define: modifies this IntVectSet to have just one IntVect.
void define_intvect (const IntVect &iv)
 IntVect define: same as define(IntVect).
 IntVectSet (const Box &b)
 Box constructor.
void define (const Box &b)
 Box define.
void define_box (const Box &b)
 Box define: same as define(Box).

Complement operators

IntVectSet operator- (const IntVectSet &ivs) const
 Returns the complement of the IntVectSet ivs within this IntVectSet.
IntVectSet operator- (const Box &b) const
 Returns the complement of the Box b within this IntVectSet.
IntVectSet operator- (const IntVect &iv) const
 Returns the complement of the IntVect iv within this IntVectSet.
IntVectSetoperator-= (const IntVectSet &ivs)
 Remove the IntVects in the IntVectSet ivs from this IntVectSet.
void minus (const IntVectSet &ivs)
 same as operator-= except it doesn't return *this
IntVectSetoperator-= (const Box &b)
 Remove the IntVects in the Box b from this IntVectSet.
void minus_box (const Box &b)
 same as operator-= except it doesn't return *this
IntVectSetoperator-= (const IntVect &iv)
 Remove the IntVect iv from this IntVectSet.
void minus_intvect (const IntVect &iv)
 same as operator-= except it doesn't return *this

Accessor and Inquiry functions

int numPts () const
 Returns the number of IntVects in this IntVectSet.
const BoxminBox () const
 Returns the minimum enclosing box of this IntVectSet.
void recalcMinBox () const
 Forces recalculation of the minimum enclosing box of this IntVectSet.
bool isEmpty () const
 Returns true if no IntVects are in this IntVectSet.
bool isDense () const
 Returns true if this IntVectSet is currently being represented in a dense fashion.
bool contains (const IntVect &iv) const
 Returns true if this IntVectSet contains iv.
bool contains (const IntVectSet &ivs) const
 Returns true if this IntVectSet contains all the IntVects in ivs.
bool contains_intvectset (const IntVectSet &ivs) const
 same as contains(ivs)
bool contains (const Box &box) const
 Returns true if this IntVectSet contains all the IntVects in box.
bool contains_box (const Box &b) const
 same as contains(b)
Vector< Boxboxes () const
 Returns a Vector<Box> representation of this IntVectSet.
void compact () const
 Optimize memory usage of this IntVectSet.

Linearization functions

int linearSize () const
 Returns the number of bytes in a linear representation of *this.
void linearIn (const void *const a_inBuf)
 Modify *this using the data in the linear representation in a_inBuf.
void linearOut (void *const a_outBuf) const
 Write a linear representation of *this to a_outBuf.

Public Member Functions

bool operator== (const IntVectSet &a_ivs) const
 Returns true if this IntVectSet has the same IntVects as a_ivs.
bool operator< (const IntVectSet &a_ivs) const
void printBoxes (std::ostream &a_ostream) const
 Writes a Vector<Box> representation to an output stream.
void p () const
 Writes a Vector<Box> representation to the parallel stdout.
void convert () const

Static Public Attributes

static long int count
static long int peakcount
static int s_maxDense

Static Private Member Functions

static void clearStaticMemory ()

Private Attributes

bool m_isdense
TreeIntVectSet m_ivs
DenseIntVectSet m_dense

Friends

class IVSIterator
std::ostream & operator<< (std::ostream &os, const IntVectSet &ivs)
 Writes a text representation of an IntVectSet to an output stream.
void dumpmemoryatexit ()


Constructor & Destructor Documentation

IntVectSet::~IntVectSet (  ) 

IntVectSet::IntVectSet (  )  [inline]

default constructor: defines an empty IntVectSet.

References count, and peakcount.

IntVectSet::IntVectSet ( const IntVectSet ivs  )  [inline]

copy constructor

References count, and peakcount.

IntVectSet::IntVectSet ( const DenseIntVectSet a_dense  )  [explicit]

conversion constructor

IntVectSet::IntVectSet ( const TreeIntVectSet a_tree  )  [explicit]

conversion constructor

IntVectSet::IntVectSet ( const IntVect iv  )  [explicit]

IntVect constructor.

construct this to be an IntVectSet with just one IntVect.

IntVectSet::IntVectSet ( const Box b  )  [explicit]

Box constructor.

construct this to be an IntVectSet with all the IntVects in the Box .


Member Function Documentation

void IntVectSet::define (  ) 

default define: modifies this IntVectSet to be empty.

Referenced by define_box(), define_intvect(), and define_intvectset().

void IntVectSet::define ( const IntVectSet ivs  )  [inline]

copy define: modifies this IntVectSet into a copy of ivs

void IntVectSet::define_intvectset ( const IntVectSet ivs  )  [inline]

copy define: same as define(IntVectSet)

References define().

IntVectSet IntVectSet::copy (  )  const [inline]

return a copy of this IntVectSet

void IntVectSet::define ( const DenseIntVectSet a_dense  ) 

conversion define

void IntVectSet::define ( const TreeIntVectSet a_tree  ) 

conversion define

void IntVectSet::define ( const IntVect iv  ) 

IntVect define: modifies this IntVectSet to have just one IntVect.

void IntVectSet::define_intvect ( const IntVect iv  )  [inline]

IntVect define: same as define(IntVect).

References define().

void IntVectSet::define ( const Box b  ) 

Box define.

modifies this IntVect to have all the IntVects in the Box .

void IntVectSet::define_box ( const Box b  )  [inline]

Box define: same as define(Box).

References define().

IntVectSet& IntVectSet::operator|= ( const IntVectSet ivs  ) 

unions another IntVectSet ivs into this IntVectSet

void IntVectSet::or_intvectset ( const IntVectSet ivs  )  [inline]

same as operator|= except it doesn't return *this

IntVectSet& IntVectSet::operator|= ( const IntVect iv  ) 

unions a single IntVect iv into this IntVectSet

void IntVectSet::or_intvect ( const IntVect ivs  )  [inline]

same as operator|= except it doesn't return *this

IntVectSet& IntVectSet::operator|= ( const Box b  ) 

unions the IntVects in the Box into this IntVectSet

void IntVectSet::or_box ( const Box b  )  [inline]

same as operator|= except it doesn't return *this

IntVectSet IntVectSet::operator- ( const IntVectSet ivs  )  const

Returns the complement of the IntVectSet ivs within this IntVectSet.

IntVectSet IntVectSet::operator- ( const Box b  )  const

Returns the complement of the Box b within this IntVectSet.

IntVectSet IntVectSet::operator- ( const IntVect iv  )  const

Returns the complement of the IntVect iv within this IntVectSet.

IntVectSet& IntVectSet::operator-= ( const IntVectSet ivs  ) 

Remove the IntVects in the IntVectSet ivs from this IntVectSet.

Modifies this IntVectSet to be the complement of the IntVectSet ivs within this IntVectSet.

void IntVectSet::minus ( const IntVectSet ivs  )  [inline]

same as operator-= except it doesn't return *this

IntVectSet& IntVectSet::operator-= ( const Box b  ) 

Remove the IntVects in the Box b from this IntVectSet.

Modifies this IntVectSet to be the complement of the argument Box within this IntVectSet.

void IntVectSet::minus_box ( const Box b  )  [inline]

same as operator-= except it doesn't return *this

IntVectSet& IntVectSet::operator-= ( const IntVect iv  ) 

Remove the IntVect iv from this IntVectSet.

Modifies this IntVectSet to be the complement of the argument IntVect within this IntVectSet.

void IntVectSet::minus_intvect ( const IntVect iv  )  [inline]

same as operator-= except it doesn't return *this

IntVectSet& IntVectSet::operator &= ( const IntVectSet ivs  ) 

Modifies this IntVectSet to its intersection with another IntVectSet.

void IntVectSet::and_intvectset ( const IntVectSet ivs  )  [inline]

same as operator&= except it doesn't return *this

IntVectSet& IntVectSet::operator &= ( const Box b  ) 

Modifies this IntVectSet to be its intersection with a Box.

void IntVectSet::and_box ( const Box b  )  [inline]

same as operator&= except it doesn't return *this

IntVectSet& IntVectSet::operator &= ( const ProblemDomain domain  ) 

Modifies this IntVectSet to be its intersection with the Box in a ProblemDomain.

void IntVectSet::and_domain ( const ProblemDomain d  )  [inline]

same as operator&= except it doesn't return *this

void IntVectSet::grow ( int  igrow  ) 

Add IntVects to this IntVectSet in all directions.

Modifies this IntVectSet by growing it by the specified number of IntVects in all directions, including diagonal. It is an error if igrow < 0.

Referenced by grow_dir().

IntVectSet& IntVectSet::grow ( int  idir,
int  igrow 
)

Add IntVects to this IntVectSet in one direction.

Modifies this IntVectSet by growing it by the specified number of IntVects igrow in the specified coordinate direction idir. Directions are zero-based.

void IntVectSet::grow_dir ( int  idir,
int  igrow 
) [inline]

same as grow(idir,igrow) except doesn't return *this

References grow().

IntVectSet& IntVectSet::refine ( int  iref = 2  ) 

Refine all the IntVects in this IntVecSet.

Modifies this IntVectSet by refining it by the factor iref. It is an error if iref <= 0. Definition of refinement: for each IntVect iv in the original IntVectSet, the refined IntVectSet will contain the Box defined by refine( Box(iv,iv), iref ).

IntVectSet& IntVectSet::coarsen ( int  iref = 2  ) 

Coarsen all the IntVects in this IntVectSet.

Modifies this IntVectSet by coarsening it by the factor iref. It is an error if iref <= 0. Definition of coarsening: for each IntVect iv in the original IntVectSet, the refined IntVectSet will contain the IntVect defined by coarsen( iv, iref ).

void IntVectSet::shift ( const IntVect iv  ) 

Increment all the IntVects in this IntVectSet by the IntVect iv.

void IntVectSet::nestingRegion ( int  radius,
const Box domain,
int  granularity = 1 
)

Make this IntVectSet be properly nested.

Modifies this IntVectSet to remove all IntVects that are not at least radius from the the edge of the IntVectSet in any direction. radius must be positive. IntVects that border the Box domain are spared from this trimming.

Referenced by nestingRegion_prob().

void IntVectSet::nestingRegion ( int  radius,
const ProblemDomain probdomain,
int  granularity = 1 
)

Make this IntVectSet be properly nested.

Modifies this IntVectSet to remove all IntVects that are not at least radius from the the edge of the IntVectSet in any direction. radius must be positive. IntVects that border non-periodic boundaries are spared from this trimming. Radius extends across periodic images.

void IntVectSet::nestingRegion_prob ( int  radius,
const ProblemDomain probdomain 
) [inline]

same as nestingRegion() except it doesn't return *this

References nestingRegion().

void IntVectSet::makeEmpty (  ) 

IntVectSet IntVectSet::chop ( int  dir,
int  chop_pnt 
)

Chop the IntVectSet at the chop_pnt index in the dir direction.

Returns one IntVectSet and modifies this IntVectSet. The union of the two is the original IntVectSet. This IntVectSet gets the IntVects with dir index >= chop_pnt, and the returned IntVectSet gets the IntVects with dir index < chop_pnt. It is an error if dir is invalid.

void IntVectSet::chop ( int  dir,
int  chop_pnt,
IntVectSet a_hi 
)

static void IntVectSet::setMaxDense ( const int &  a_maxDense  )  [static]

Set the max box size for IntVectSet::define(Box) which will make the IntVectSet dense. Default is 6.4^6.

int IntVectSet::numPts (  )  const

Returns the number of IntVects in this IntVectSet.

const Box& IntVectSet::minBox (  )  const

Returns the minimum enclosing box of this IntVectSet.

Referenced by IVSFAB< T >::define(), BaseIVFAB< T >::define(), and BaseIFFAB< T >::define().

void IntVectSet::recalcMinBox (  )  const

Forces recalculation of the minimum enclosing box of this IntVectSet.

bool IntVectSet::isEmpty (  )  const

bool IntVectSet::isDense (  )  const [inline]

Returns true if this IntVectSet is currently being represented in a dense fashion.

References m_isdense.

bool IntVectSet::contains ( const IntVect iv  )  const

bool IntVectSet::contains ( const IntVectSet ivs  )  const

Returns true if this IntVectSet contains all the IntVects in ivs.

bool IntVectSet::contains_intvectset ( const IntVectSet ivs  )  const [inline]

same as contains(ivs)

References contains().

bool IntVectSet::contains ( const Box box  )  const

Returns true if this IntVectSet contains all the IntVects in box.

Note: this is done using an algorithm that is much faster than looping through all the IntVects.

bool IntVectSet::contains_box ( const Box b  )  const [inline]

same as contains(b)

References contains().

Vector<Box> IntVectSet::boxes (  )  const

Returns a Vector<Box> representation of this IntVectSet.

The returned Boxes contain only the IntVects in this IntVectSet, so the union of the Boxes in the Vector == this IntVectSet.

void IntVectSet::compact (  )  const

Optimize memory usage of this IntVectSet.

Attempts to optimize storage for IntVectSet. This will also optimize iteration through the IntVectSet later. Best to call it when you are no longer modifying the IntVectSet

int IntVectSet::linearSize (  )  const

Returns the number of bytes in a linear representation of *this.

void IntVectSet::linearIn ( const void *const   a_inBuf  ) 

Modify *this using the data in the linear representation in a_inBuf.

void IntVectSet::linearOut ( void *const   a_outBuf  )  const

Write a linear representation of *this to a_outBuf.

Assumes a_outBuf is at least linearSize() bytes long.

bool IntVectSet::operator== ( const IntVectSet a_ivs  )  const

Returns true if this IntVectSet has the same IntVects as a_ivs.

bool IntVectSet::operator< ( const IntVectSet a_ivs  )  const

Primary sorting criterion: being dense; if *this is dense and a_ivs is not, then *this is smaller, and vice versa. Secondary sorting criterion: operator< as defined on DenseIntVectSet or TreeIntVectSet. In a total tie, returns false.

These criteria might not seem natural, but that doesn't matter as the only reason for this operator is to support using IntVectSet as the key to an std::map.

void IntVectSet::printBoxes ( std::ostream &  a_ostream  )  const

Writes a Vector<Box> representation to an output stream.

Referenced by p().

void IntVectSet::p (  )  const [inline]

Writes a Vector<Box> representation to the parallel stdout.

References pout(), and printBoxes().

void IntVectSet::convert (  )  const

static void IntVectSet::clearStaticMemory (  )  [static, private]


Friends And Related Function Documentation

friend class IVSIterator [friend]

IntVectSet operator| ( const IntVectSet ivs1,
const IntVectSet ivs2 
) [friend]

Returns a new IntVectSet that is the union of two IntVectSets.

IntVectSet operator| ( const IntVectSet ivs,
const IntVect iv 
) [friend]

Returns a new IntVectSet that is the union of an IntVectSet and an IntVect.

IntVectSet operator| ( const IntVect iv,
const IntVectSet ivs 
) [friend]

Returns a new IntVectSet that is the union of an IntVectSet and an IntVect.

IntVectSet operator| ( const IntVectSet ivs,
const Box b 
) [friend]

Returns a new IntVectSet that is the union of an IntVectSet and a Box.

IntVectSet operator| ( const Box b,
const IntVectSet ivs 
) [friend]

Returns a new IntVectSet that is the union of an IntVectSet and a Box.

IntVectSet operator & ( const IntVectSet ivs1,
const IntVectSet ivs2 
) [friend]

Returns a new IntVectSet that is the intersection of two IntVectSets.

The result may be empty.

IntVectSet operator & ( const IntVectSet ivs,
const Box b 
) [friend]

Returns a new IntVectSet that is the intersection of an IntVectSet and a Box.

The result may be empty.

IntVectSet operator & ( const Box b,
const IntVectSet ivs 
) [friend]

Returns a new IntVectSet that is the intersection of an IntVectSet and a Box.

The result may be empty.

IntVectSet grow ( const IntVectSet ivs,
int  igrow 
) [friend]

Add IntVects to an IntVectSet in all directions.

Creates a new IntVectSet that is a copy of the argument IntVectSet ivs grown by the specified number of IntVects in all directions igrow, including diagonal. It is an error if igrow < 0.

IntVectSet refine ( const IntVectSet ivs,
int  iref = 2 
) [friend]

Refine all the IntVects in an IntVectSet.

Creates a new IntVectSet that is a copy of the argument IntVectSet ivs refined by the factor iref. It is an error if iref <= 0. Definition of refinement: for each IntVect iv in the original IntVectSet ivs, the refined IntVectSet will contain the Box defined by refine( Box(iv,iv), iref ).

IntVectSet coarsen ( const IntVectSet ivs,
int  iref = 2 
) [friend]

Coarsen all the IntVects in an IntVectSet.

Creates a new IntVectSet that is a copy of the argument IntVectSet ivs coarsened by the factor iref. It is an error if iref <= 0. Definition of coarsening: for each IntVect iv in the original IntVectSet, the refined IntVectSet will contain the IntVect defined by coarsen( iv, iref ).

std::ostream& operator<< ( std::ostream &  os,
const IntVectSet ivs 
) [friend]

Writes a text representation of an IntVectSet to an output stream.

void dumpmemoryatexit (  )  [friend]


Member Data Documentation

long int IntVectSet::count [static]

Referenced by IntVectSet().

long int IntVectSet::peakcount [static]

Referenced by IntVectSet().

int IntVectSet::s_maxDense [static]

bool IntVectSet::m_isdense [private]

Referenced by isDense().


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

Generated on Tue Apr 14 14:23:38 2009 for Chombo + EB by  doxygen 1.5.5