#include <source/hierarchy/boxes/BoxGraph.h>
Public Member Functions | |
BoxGraph (const BoxArray< DIM > &src_box_array, const tbox::Array< tbox::List< IntVector< DIM > > > &src_shifts, const ProcessorMapping &src_mapping, const BoxArray< DIM > &dst_box_array, const IntVector< DIM > &dst_grow=IntVector< DIM >(1), int sort_dimension=-1) | |
Constructor for use with getSrcOverlapIndices(). | |
BoxGraph (const BoxArray< DIM > &src_box_array, const tbox::Array< tbox::List< IntVector< DIM > > > &src_shifts, const BoxArray< DIM > &dst_box_array, const IntVector< DIM > &dst_grow=IntVector< DIM >(1), int sort_dimension=-1) | |
Constructor for use with removeIntersections(). | |
BoxGraph (const BoxArray< DIM > &src_box_array, const BoxArray< DIM > &dst_box_array, const IntVector< DIM > &dst_grow=IntVector< DIM >(1), int sort_dimension=-1) | |
~BoxGraph () | |
const tbox::Array< int > & | getSrcOverlapIndices (int dst_index) |
Compute the indices of boxes from the src_box_array that overlap with the box dst_box_array[index]. | |
const tbox::Array< int > & | getLocalSrcOverlapIndices (int dst_index) |
Computes the indices of boxes from the src_box_array that overlap with the box dst_box_array[index] and that are mapped to the same processor. | |
void | removeIntersections (BoxList< DIM > &list) |
Remove from the dst_box_array the portions that intersect the boxes in src_box_array. | |
void | printGraph (ostream &os=tbox::plog) |
Undocumented function, used during development and testing. |
BoxGraph is designed around the premise that you have two sets of boxes: an array or source boxes (src_box_array), and an array of destination boxes (dst_box_array). The dst boxes are grown by some number of cells in each coordinate direction to determine overlaps with the source boxes. Typically, this is related to the ghost width of that data that resides on AMR hierachy patches that correspond to the boxes. The getSrcOverlapIndices() and getLocalSrcOverlapIndices() methods provide efficient methods to determine which boxes from the src_box_array overlap with a specified box from the dst_box_array. getSrcOverlapIndices() returns the indices of all source boxes that overlap with a specified destination box. getLocalSrcOverlapIndices() returns the indices of all source boxes that overlap with a specified destination box and are mapped to the same processor as the specified destination box.
The removeIntersections() method is similar in concept to the BoxList<DIM>::removeIntersections() method. Here, however, we operate on the two arrays of boxes that are passed to the constructor. The BoxGraph::removeIntersections() method is functionally equivalent to the following:
* BoxList<DIM> dst_box_list(dst_box_array); * BoxList<DIM> src_box_list(src_box_array); * dst_box_list.removeIntersections(src_box_list); *
Note that the dst_box_array may be the same as the src_box_array. This occurs, for example, during regridding operations when both both levels are the same.
The above sequence of calls, however, has O(N^2) runtime complexity, assuming both arrays of boxes contain N items. This class typically performs removeIntersections in O(N^3/2), although worst case behavior can be shown to be O(N^5/2).
Internally BoxGraph operates by constructing a bipartite graph; (this is performed in the constructor). One set of independent vertices contains a vertex for each box in the src_box_array; the other independent set contains vertices corresponding to the dst_box_array. The graph contains an edge (i,j) if (1) vertices i and j belong to different independent sets; (2) the boxes corresponding to the vertices overlap each other.
Methods in this class were originally designed to improve efficiency in xfer_RefineSchedule<DIM>::generateCommunicationSchedule().
|
Constructor for use with getSrcOverlapIndices(). This constructor must be used if you will later call BoxGraph::getSrcOverlapIndices(). This constructor can also be used if you will later call BoxGraph::removeIntersections().
|
|
Constructor for use with removeIntersections(). This constructor can be used when a BoxGraph object is employed to perform BoxGraph::removeIntersections() operations. It can not be used if you intend to call BoxGraph::getSrcOverlapIndices().
|
|
|
|
The destructor releases privately held resources. |
|
Compute the indices of boxes from the src_box_array that overlap with the box dst_box_array[index].
|
|
Computes the indices of boxes from the src_box_array that overlap with the box dst_box_array[index] and that are mapped to the same processor.
|
|
Remove from the dst_box_array the portions that intersect the boxes in src_box_array. Returns what you would get if you performed the following operations: * BoxList<DIM> dst_box_list(dst_box_array); * BoxList<DIM> src_box_list(src_box_array); * dst_box_list.removeIntersections(src_box_list); *
|
|
Undocumented function, used during development and testing.
|