IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::hier::BoxTree< DIM > Class Template Reference

#include <BoxTree.h>

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

Public Member Functions

void findOverlapBoxes (BoxList< DIM > &overlap_boxes, const Box< DIM > &box) const
 Compute list of boxes that overlap the specified box. More...
 
void removeIntersections (BoxList< DIM > &list) const
 Remove from list the portions that intersect the boxes in the BoxArray that was passed to the constructor. More...
 
BoxTree constructors
 BoxTree (const BoxArray< DIM > &boxes, const tbox::Array< tbox::List< IntVector< DIM > > > &box_shifts, const ProcessorMapping &box_mapping, int min_length=10)
 Constructor for BoxTree. More...
 
 BoxTree (const BoxArray< DIM > &boxes, const tbox::Array< tbox::List< IntVector< DIM > > > &box_shifts, int min_length=10)
 
 BoxTree (const BoxArray< DIM > &boxes, int min_length=10)
 
 ~BoxTree ()
 
BoxTree findIndices
void findOverlapIndices (tbox::Array< int > &indices, const Box< DIM > &box) const
 Compute the indices of all boxes that overlap the specified box. More...
 
void findLocalOverlapIndices (tbox::Array< int > &indices, const Box< DIM > &box) const
 Compute the indices of the boxes local to this processor that overlap the specified box. More...
 

Private Member Functions

 BoxTree (const BoxTree< DIM > &box)
 
BoxTree< DIM > & operator= (const BoxTree< DIM > &box)
 
void privateFindOverlapIndices (tbox::Array< int > &indices, const Box< DIM > &box, bool find_local_overlaps) const
 

Private Attributes

tbox::Pointer< BoxTreeNode< DIM > > d_tree
 
BoxArray< DIM > d_boxes
 
bool d_have_mapping
 

Detailed Description

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

Class BoxTree is a utility class that provides functionality that can be used to reduce the runtime complexity of certain box calculus operations.

A BoxTree object is constructed by passing the ctor a BoxArray; this array is used internally to setup private data structures that will be used in subsequent methods, described below. If the BoxArray contains n boxes, then the setup phase (which is invoked by the constructor) has an expected runtime complexity of O(n log(n)).

Following construction, two types of operations are supported by the member functions findOverlapIndices() and findLocalOverlapIndices().
Each function takes an integer array and a box as input, and computes the indices of the subset of the boxes (in the array that was passed to the constructor) that overlap with the argument box. On return from the function, the integer array holds the indices of the boxes in the array that overlap with the argument box. The function findOverlapIndices() returns indices of all boxes that overlap the argument box. The function findLocalOverlapIndices() returns only the indices of the boxes that are assigned to this processor.

Second, the removeIntersections call takes a list of boxes as input, and removes those portions that intersect with the boxes in the BoxArray that was passed to the constructor.

This class provides functionality that is similar to that provided by the BoxTop and BoxGraph classes. However, it employs different algorithms to do so, and is expected to have different runtime characteristics. Questions such as "which is faster for removeIntersections(): BoxTop, BoxGraph, or BoxTree?" depends on many factors for which analysis is difficult. The answer is largely a function of a particular problem and domain topology, and is best answered experimentally.

See also
hier::BoxTop
hier::BoxGraph
hier::Box
hier::BoxArray

Constructor & Destructor Documentation

◆ BoxTree() [1/4]

template<int DIM>
SAMRAI::hier::BoxTree< DIM >::BoxTree ( const BoxArray< DIM > &  boxes,
const tbox::Array< tbox::List< IntVector< DIM > > > &  box_shifts,
const ProcessorMapping box_mapping,
int  min_length = 10 
)

The primary difference between the constructors is that the first takes processor mapping information while the others do not. This is because processor mapping information is required in the method findLocalOverlapIndices(), but is not required for the other methods.

If you do not pass processor mappying information, and subsequently call findLocalOverlapIndices(), an unrecoverable assertion will be thrown.

Parameters
boxesinput array of boxes.
box_shiftsthe amount by which each box is shifted when there are periodic boundary conditions. If there are no periodic boundary conditions you can pass an array of length zero; otherwise the array must contain an entry for each box in boxes.
box_mappingmaps each box in boxes to a processor.
min_lengthcontrols the partitioning of boxes amongst child nodes in the tree.
Setting to a larger value tends to decrease the total number of nodes in the tree, and hence reduces memory requirements; however, a larger value may also increase the cost of the findOverlapBoxes and removeIntersections operations. (and hence reduces memory requirements), but increase the cost of findOverlapBoxes. Unless you are heavily invested in performance tweaking, please use the default value. Really, I mean it.

◆ BoxTree() [2/4]

template<int DIM>
SAMRAI::hier::BoxTree< DIM >::BoxTree ( const BoxArray< DIM > &  boxes,
const tbox::Array< tbox::List< IntVector< DIM > > > &  box_shifts,
int  min_length = 10 
)

◆ BoxTree() [3/4]

template<int DIM>
SAMRAI::hier::BoxTree< DIM >::BoxTree ( const BoxArray< DIM > &  boxes,
int  min_length = 10 
)

◆ ~BoxTree()

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

The dtor does nothing interesting.

◆ BoxTree() [4/4]

template<int DIM>
SAMRAI::hier::BoxTree< DIM >::BoxTree ( const BoxTree< DIM > &  box)
private

The copy ctor is not implemented.

Member Function Documentation

◆ findOverlapIndices()

template<int DIM>
void SAMRAI::hier::BoxTree< DIM >::findOverlapIndices ( tbox::Array< int > &  indices,
const Box< DIM > &  box 
) const

The integer array will contain the indices of all boxes (in the BoxArray that was passed to the constructor) and that overlap the specified box.

Parameters
indicesinteger array to hold the array indices of the overlapping boxes in the box array.
boxbox whose overlaps are requested.

◆ findLocalOverlapIndices()

template<int DIM>
void SAMRAI::hier::BoxTree< DIM >::findLocalOverlapIndices ( tbox::Array< int > &  indices,
const Box< DIM > &  box 
) const

The integer array will contain the indices of the boxes (in the BoxArray that was passed to the constructor) and that overlap the specified box and which are assigned to this processor. The processor assignment is determined from the mapping information passed to the constructor. This routine will result in an unrecoverable exception if a constructor that does not accept the mapping information was used to create this object. See the comments for the constructors.

Parameters
indicesinteger array to hold the array indices of the overlapping boxes in the box array.
boxbox whose overlaps are requested.

◆ findOverlapBoxes()

template<int DIM>
void SAMRAI::hier::BoxTree< DIM >::findOverlapBoxes ( BoxList< DIM > &  overlap_boxes,
const Box< DIM > &  box 
) const
Parameters
overlap_boxesboxes in BoxArray that was passed to the constructor that overlap with argument box.
boxbox whose overlaps are requested.

◆ removeIntersections()

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

CAUTION: the semantics of this call differ from that of BoxList::removeIntersections(const BoxList<DIM> takeaway). Here, the list that is being modified is the list that is passed as an argument; the "takeaway" list is the list that was passed when the BoxTop object was constructed.

Parameters
listthe list of boxes from which intersections are to be removed.

◆ operator=()

template<int DIM>
BoxTree<DIM>& SAMRAI::hier::BoxTree< DIM >::operator= ( const BoxTree< DIM > &  box)
private

The assignment operator is not implemented.

◆ privateFindOverlapIndices()

template<int DIM>
void SAMRAI::hier::BoxTree< DIM >::privateFindOverlapIndices ( tbox::Array< int > &  indices,
const Box< DIM > &  box,
bool  find_local_overlaps 
) const
private

Private routine to construct overlap indices.

Member Data Documentation

◆ d_tree

template<int DIM>
tbox::Pointer< BoxTreeNode<DIM> > SAMRAI::hier::BoxTree< DIM >::d_tree
private

◆ d_boxes

template<int DIM>
BoxArray<DIM> SAMRAI::hier::BoxTree< DIM >::d_boxes
private

◆ d_have_mapping

template<int DIM>
bool SAMRAI::hier::BoxTree< DIM >::d_have_mapping
private

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