#include <source/hierarchy/boxes/BoxGraph.h>
Public Member Functions | |
~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 (std::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().
SAMRAI::hier::BoxGraph< DIM >::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().
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().
src_box_array | the array of source boxes. | |
src_shifts | the 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 src_box_array. | |
src_mapping | maps each box in src_box_array to a processor. | |
dst_box_array | the array of destination boxes. | |
dst_grow | the amount to grow each box in dst_box_array. | |
sort_dimension | the direction (x, y, z) in which boxes will be sorted when building the graph. This parameter is included for performance tuning and testing; users should use the default setting. |
SAMRAI::hier::BoxGraph< DIM >::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().
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().
src_box_array | the array of source boxes. | |
src_shifts | the 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 src_box_array. | |
dst_box_array | the array of destination boxes. | |
dst_grow | the to grow each box in dst_box_array. | |
sort_dimension | the direction (x, y, z) in which boxes will be sorted when building the graph. This parameter is included for performance tuning and testing; users should use the default setting. |
SAMRAI::hier::BoxGraph< DIM >::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 | |||
) |
SAMRAI::hier::BoxGraph< DIM >::~BoxGraph | ( | ) |
The destructor releases privately held resources.
SAMRAI::hier::BoxGraph< DIM >::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().
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().
src_box_array | the array of source boxes. | |
src_shifts | the 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 src_box_array. | |
src_mapping | maps each box in src_box_array to a processor. | |
dst_box_array | the array of destination boxes. | |
dst_grow | the amount to grow each box in dst_box_array. | |
sort_dimension | the direction (x, y, z) in which boxes will be sorted when building the graph. This parameter is included for performance tuning and testing; users should use the default setting. |
SAMRAI::hier::BoxGraph< DIM >::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().
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().
src_box_array | the array of source boxes. | |
src_shifts | the 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 src_box_array. | |
dst_box_array | the array of destination boxes. | |
dst_grow | the to grow each box in dst_box_array. | |
sort_dimension | the direction (x, y, z) in which boxes will be sorted when building the graph. This parameter is included for performance tuning and testing; users should use the default setting. |
SAMRAI::hier::BoxGraph< DIM >::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 | |||
) |
const tbox::Array< int > & SAMRAI::hier::BoxGraph< DIM >::getSrcOverlapIndices | ( | int | dst_index | ) | [inline] |
Compute the indices of boxes from the src_box_array that overlap with the box dst_box_array[index].
dst_index | input; the index of the box from the dst_box_array whose overlaps are requested. |
const tbox::Array< int > & SAMRAI::hier::BoxGraph< DIM >::getLocalSrcOverlapIndices | ( | int | dst_index | ) | [inline] |
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.
dst_index | input; the index of the box from the dst_box_array whose overlaps are requested. |
void SAMRAI::hier::BoxGraph< DIM >::removeIntersections | ( | BoxList< DIM > & | list | ) |
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); *
list | on return, contains the portions of the dst_box_array that remain after removing the intersections with the src_box_array. |
void SAMRAI::hier::BoxGraph< DIM >::printGraph | ( | std::ostream & | os = tbox::plog |
) |
Undocumented function, used during development and testing.