IBAMR  IBAMR version 0.20.
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SAMRAI::hier::BoxList< DIM > Class Template Reference

#include <BoxList.h>

Inheritance diagram for SAMRAI::hier::BoxList< DIM >:
Inheritance graph
[legend]

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
 
bool isEmpty () const
 
int getNumberOfItems () const
 
int size () const
 
void addItem (const Box< DIM > &item)
 
void addItemBefore (ListIterator< Box< DIM > > &iter, const Box< DIM > &item)
 
void addItemAfter (ListIterator< Box< DIM > > &iter, const Box< DIM > &item)
 
void appendItem (const Box< DIM > &item)
 
void copyItems (const List< Box< DIM > > &list)
 
void catenateItems (List< Box< DIM > > &list)
 
void catenateItemsAtFront (List< Box< DIM > > &list)
 
void clearItems ()
 
Box< DIM > & getFirstItem () const
 
Box< DIM > & getLastItem () const
 
void removeFirstItem ()
 
void removeLastItem ()
 
void removeItem (ListIterator< Box< DIM > > &iter)
 
void reverse ()
 
List< Box< DIM > >::Iterator listStart () const
 
List< Box< DIM > >::Iterator listEnd () const
 

Static Public Member Functions

static void freeCachedListItems ()
 

Private Member Functions

void burstBoxes (const Box< DIM > &bursty, const Box< DIM > &solid, const int dimension)
 
void newBurstBoxes (const Box< DIM > &bursty, const Box< DIM > &solid, const int dimension)
 

Static Private Member Functions

static void heapify (Box< DIM > **heap, const int i, const int j)
 

Private Attributes

int d_number_items
 
ListNode< Box< DIM > > * d_list_head
 
ListNode< Box< DIM > > * d_list_tail
 

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

◆ Iterator

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.

Constructor & Destructor Documentation

◆ BoxList() [1/4]

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

Create an empty box list with no boxes.

◆ BoxList() [2/4]

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

Create a box list with one box in it.

◆ BoxList() [3/4]

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

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

◆ BoxList() [4/4]

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

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

◆ ~BoxList()

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

The destructor releases all list storage.

Member Function Documentation

◆ operator=()

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

Copy boxes from the argument list.

◆ getNumberOfBoxes()

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

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.

◆ simplifyBoxes()

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.

◆ unionBoxes() [1/2]

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

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.

◆ unionBoxes() [2/2]

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

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.

◆ removeIntersections() [1/3]

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.

◆ removeIntersections() [2/3]

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.

◆ removeIntersections() [3/3]

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.

◆ intersectBoxes() [1/2]

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.

◆ intersectBoxes() [2/2]

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.

◆ coalesceBoxes()

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.

◆ sortDescendingBoxSizes()

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.

◆ getTotalSizeOfBoxes()

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

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

◆ contains()

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.

◆ grow()

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.

◆ shift()

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

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

◆ refine()

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.

◆ coarsen()

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.

◆ boxesIntersect()

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.

◆ getBoundingBox()

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

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

◆ print()

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.

◆ burstBoxes()

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::burstBoxes ( const Box< DIM > &  bursty,
const Box< DIM > &  solid,
const int  dimension 
)
private

◆ newBurstBoxes()

template<int DIM>
void SAMRAI::hier::BoxList< DIM >::newBurstBoxes ( const Box< DIM > &  bursty,
const Box< DIM > &  solid,
const int  dimension 
)
private

◆ heapify()

template<int DIM>
static void SAMRAI::hier::BoxList< DIM >::heapify ( Box< DIM > **  heap,
const int  i,
const int  j 
)
staticprivate

Sort boxes in list from largest to smallest in size with a heap sort.

◆ freeCachedListItems()

static void SAMRAI::tbox::List< Box< DIM > >::freeCachedListItems ( )
staticinherited

Free cached list nodes. A cached list of list nodes is used to speed allocation and deallocation of list items. This call will return this cached memory to the free memory pool.

◆ isEmpty()

bool SAMRAI::tbox::List< Box< DIM > >::isEmpty ( ) const
inherited

Check whether a list is empty (has no elements).

◆ getNumberOfItems()

int SAMRAI::tbox::List< Box< DIM > >::getNumberOfItems ( ) const
inherited

Return the number of items in the list.

◆ size()

int SAMRAI::tbox::List< Box< DIM > >::size ( ) const
inherited

Return the number of items in the list. Identical to getNumberOfItems(), but this method is common to several container classes.

◆ addItem()

void SAMRAI::tbox::List< Box< DIM > >::addItem ( const Box< DIM > &  item)
inherited

Add a new item to the head of the list.

◆ addItemBefore()

void SAMRAI::tbox::List< Box< DIM > >::addItemBefore ( ListIterator< Box< DIM > > &  iter,
const Box< DIM > &  item 
)
inherited

Add a new item to the list before the item pointed to by the specified iterator.

◆ addItemAfter()

void SAMRAI::tbox::List< Box< DIM > >::addItemAfter ( ListIterator< Box< DIM > > &  iter,
const Box< DIM > &  item 
)
inherited

Add a new item to the list after the item pointed to by the specified iterator.

◆ appendItem()

void SAMRAI::tbox::List< Box< DIM > >::appendItem ( const Box< DIM > &  item)
inherited

Add a new item to the tail of the list.

◆ copyItems()

void SAMRAI::tbox::List< Box< DIM > >::copyItems ( const List< Box< DIM > > &  list)
inherited

Copy list items from the argument list. The new items are appended to the end of the current list. The argument list is not modified.

◆ catenateItems()

void SAMRAI::tbox::List< Box< DIM > >::catenateItems ( List< Box< DIM > > &  list)
inherited

Catenate list items from the argument list to the end of the current list. Unline copyItems(), the argument list is set to null.

◆ catenateItemsAtFront()

void SAMRAI::tbox::List< Box< DIM > >::catenateItemsAtFront ( List< Box< DIM > > &  list)
inherited

Catenate list items from the argument list to the front of the current list. Unline copyItems(), the argument list is set to null.

◆ clearItems()

void SAMRAI::tbox::List< Box< DIM > >::clearItems ( )
inherited

Empty the list. All list items are deallocated.

◆ getFirstItem()

Box< DIM > & SAMRAI::tbox::List< Box< DIM > >::getFirstItem ( ) const
inherited

Return a reference to the first item in the list. This operation is not defined if the list is empty. This member function is const since it cannot change the list, although the item in the list may change.

◆ getLastItem()

Box< DIM > & SAMRAI::tbox::List< Box< DIM > >::getLastItem ( ) const
inherited

Return a reference to the last item in the list. This operation is not defined if the list is empty. This member function is const since it cannot change the list, although the item in the list may change.

◆ removeFirstItem()

void SAMRAI::tbox::List< Box< DIM > >::removeFirstItem ( )
inherited

Remove (deallocate) the first item in the list.

◆ removeLastItem()

void SAMRAI::tbox::List< Box< DIM > >::removeLastItem ( )
inherited

Remove (deallocate) the last item in the list.

◆ removeItem()

void SAMRAI::tbox::List< Box< DIM > >::removeItem ( ListIterator< Box< DIM > > &  iter)
inherited

Remove (deallocate) the item pointed to by the iterator. After performing the remove, the iterator becomes invalid. Iterators that point to other elements in the list remain valid after the deletion of an item.

◆ reverse()

void SAMRAI::tbox::List< Box< DIM > >::reverse ( )
inherited

Reverse all elements in the list. This operation is performed in-place by swapping next and previous list element pointers.

◆ listStart()

List<Box< DIM > >::Iterator SAMRAI::tbox::List< Box< DIM > >::listStart ( ) const
inherited

Return a List<TYPE>::Iterator that points to the start of the list.

◆ listEnd()

List<Box< DIM > >::Iterator SAMRAI::tbox::List< Box< DIM > >::listEnd ( ) const
inherited

Return a List<TYPE>::Iterator that points to the end of the list.

Member Data Documentation

◆ d_number_items

int SAMRAI::tbox::List< Box< DIM > >::d_number_items
privateinherited

◆ d_list_head

ListNode<Box< DIM > >* SAMRAI::tbox::List< Box< DIM > >::d_list_head
privateinherited

◆ d_list_tail

ListNode<Box< DIM > >* SAMRAI::tbox::List< Box< DIM > >::d_list_tail
privateinherited

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