SAMRAI::hier::BoxList< DIM > Class Template Reference

#include <source/hierarchy/boxes/BoxList.h>

Inheritance diagram for SAMRAI::hier::BoxList< DIM >:

Inheritance graph
[legend]
List of all members.

Public Types

typedef tbox::List< Box< DIM
> >::Iterator 
Iterator

Public Member Functions

 BoxList ()
 BoxList (const Box< DIM > &box)
 BoxList (const BoxList< DIM > &list)
 BoxList (const BoxArray< DIM > &array)
BoxList< DIM > & operator= (const BoxList< DIM > &list)
 ~BoxList ()
int getNumberOfBoxes () const
void simplifyBoxes ()
void unionBoxes (const Box< DIM > &box)
void unionBoxes (const BoxList< DIM > &boxes)
void removeIntersections (const Box< DIM > &takeaway)
void removeIntersections (const BoxList< DIM > &takeaway)
void removeIntersections (const Box< DIM > &box, const Box< DIM > &takeaway)
void intersectBoxes (const Box< DIM > &box)
void intersectBoxes (const BoxList< DIM > &boxes)
void coalesceBoxes ()
void sortDescendingBoxSizes ()
int getTotalSizeOfBoxes () const
bool contains (const Index< DIM > &p) const
void grow (const IntVector< DIM > &ghosts)
void shift (const IntVector< DIM > &offset)
void refine (const IntVector< DIM > &ratio)
void coarsen (const IntVector< DIM > &ratio)
bool boxesIntersect () const
Box< DIM > getBoundingBox () const
void print (std::ostream &os=tbox::plog) const

Detailed Description

template<int DIM>
class SAMRAI::hier::BoxList< DIM >

Class BoxList represents a linked list of boxes. It defines basic box calculus operations such as set intersection, union, and difference.

See also:
hier::Box

hier::BoxArray


Member Typedef Documentation

template<int DIM>
typedef tbox::List< Box<DIM> >::Iterator SAMRAI::hier::BoxList< DIM >::Iterator

The iterator for class BoxList<DIM>. This is a convenient alias to the list iterator tbox::List< Box<DIM> >Iterator.

Reimplemented from SAMRAI::tbox::List< TYPE >.


Constructor & Destructor Documentation

template<int DIM>
SAMRAI::hier::BoxList< DIM >::BoxList (  )  [inline]

Create an empty box list with no boxes.

template<int DIM>
SAMRAI::hier::BoxList< DIM >::BoxList ( const Box< DIM > &  box  ) 

Create a box list with one box in it.

template<int DIM>
SAMRAI::hier::BoxList< DIM >::BoxList ( const BoxList< DIM > &  list  ) 

Create a box list and copy the boxes from the argument list.

template<int DIM>
SAMRAI::hier::BoxList< DIM >::BoxList ( const BoxArray< DIM > &  array  ) 

Create a box list and copy the boxes from the argument array.

template<int DIM>
SAMRAI::hier::BoxList< DIM >::~BoxList (  )  [inline]

The destructor releases all list storage.


Member Function Documentation

template<int DIM>
BoxList< DIM > & SAMRAI::hier::BoxList< DIM >::operator= ( const BoxList< DIM > &  list  ) 

Copy boxes from the argument list.

template<int DIM>
int SAMRAI::hier::BoxList< DIM >::getNumberOfBoxes (  )  const [inline]

Return integer number of boxes in the box list. Note that this function merely calls the getNumberOfItems() function in the tbox::List base class. This function is provided for convenience and consistency with the tbox::BoxArray class.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::simplifyBoxes (  ) 

Place the boxes on the list into a canonical ordering. The canonical ordering for boxes is defined such that boxes that lie next to each other in higher dimensions are coalesced together before boxes that lie next to each other in lower dimensions. This ordering provides a standard representation that can be used to compare box lists. The canonical ordering also does not allow any overlap between the boxes on the list. This routine is potentially expensive, since the running time is $O(N^2)$ for N boxes. None of the domain calculus routines call simplifyBoxes(); all calls to simplify the boxes must be explicit. Note that this routine is distinct from coalesceBoxes(), which is not guaranteed to produce a canonical ordering.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::unionBoxes ( const Box< DIM > &  box  )  [inline]

Add the box to the list of boxes. Note that this routine does not simplify the box list. Thus, the new box may overlap with boxes that already reside on the list.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::unionBoxes ( const BoxList< DIM > &  boxes  )  [inline]

Add the boxes to the list of boxes. Note that this routine does not simplify the box list. Thus, the new boxes may overlap with boxes that already reside on the list.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::removeIntersections ( const Box< DIM > &  takeaway  ) 

Remove from the current boxlist the portions that intersect the box takeaway. This operation can be thought of as a set difference defined over the abstract AMR box index space. Performing the set difference will require $O(N)$ time for a list with $N$ boxes.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::removeIntersections ( const BoxList< DIM > &  takeaway  ) 

Remove from the current boxlist the portions that intersect the boxes in the BoxList takeaway.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::removeIntersections ( const Box< DIM > &  box,
const Box< DIM > &  takeaway 
)

A special version for the case where the BoxList is empty initially, this routine builds the list of boxes that get formed when intersecting box with takeaway. If the boxes do not intersect, box is added to the boxlist. This routine is primarily suited for applications which are looking only for the intersection of two boxes.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::intersectBoxes ( const Box< DIM > &  box  ) 

Intersect the current boxlist against the specified box. Performing the intersection will require $O(N)$ time for a list with $N$ boxes.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::intersectBoxes ( const BoxList< DIM > &  boxes  ) 

Intersect the current boxlist against the specified boxlist. The intersection calculation will require $O(N^2)$ time for boxlists with $N$ boxes.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::coalesceBoxes (  ) 

Combine any boxes in the list which may be coalesced. Two boxes may be coalesced if their union is a box (recall that boxes are not closed under index set unions). Empty boxes on the list are removed during this process. Note that this is potentially an expensive calculation (e.g., it will require $(N-1)!$ box comparisons for a box list with $N$ boxes in the worst possible case). So this routine should be used sparingly. Also note that this routine is different than simplifyBoxes() since it does not produce a canonical ordering. In particular, this routine processes the boxes in the order in which they appear on the list, rather than attempting to coalesce boxes along specific coordinate directions before others.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::sortDescendingBoxSizes (  ) 

Sort the boxes in the list from largest to smallest in size. Recall that the size of a box is the number of cell indices it contains. This routine uses a heap sort algorithm which requires $O(N*logN)$ work in both average and worst case scenarios. Note that to obtain a box list from smallest to largest, the list elements can be reversed after this sorting routine is applied.

template<int DIM>
int SAMRAI::hier::BoxList< DIM >::getTotalSizeOfBoxes (  )  const

Count up the total number of indices in all the boxes in the list.

template<int DIM>
bool SAMRAI::hier::BoxList< DIM >::contains ( const Index< DIM > &  p  )  const

Check whether an index lies within the bounds of the collection of boxes.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::grow ( const IntVector< DIM > &  ghosts  ) 

Grow all boxes in the box list by the specified ghost cell width.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::shift ( const IntVector< DIM > &  offset  ) 

Shift all boxes in the box list by the specified offset.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::refine ( const IntVector< DIM > &  ratio  ) 

Refine the index space of each box in the box list by the specified vector refinement ratio.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::coarsen ( const IntVector< DIM > &  ratio  ) 

Coarsen the index space of each box in the box list by the specified vector coarsening ratio.

template<int DIM>
bool SAMRAI::hier::BoxList< DIM >::boxesIntersect (  )  const

Return true if there exists non-empty intersection among boxes in list; otherwise, return false.

template<int DIM>
Box< DIM > SAMRAI::hier::BoxList< DIM >::getBoundingBox (  )  const

Return the bounding box for all boxes in the box list.

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::print ( std::ostream &  os = tbox::plog  )  const

Print all class member data for this bounding box list object to specified output stream.


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:27 2009 for SAMRAI by  doxygen 1.5.1