SAMRAI::hier::BoxUtilities< DIM > Struct Template Reference

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

List of all members.

Static Public Member Functions

static void checkBoxConstraints (const Box< DIM > &box, const IntVector< DIM > &min_size, const IntVector< DIM > &cut_factor, const IntVector< DIM > &bad_interval, const BoxArray< DIM > &physical_boxes)
static void chopBoxes (BoxList< DIM > &boxes, const IntVector< DIM > &max_size, const IntVector< DIM > &min_size, const IntVector< DIM > &cut_factor, const IntVector< DIM > &bad_interval, const BoxArray< DIM > &physical_boxes)
static void chopBox (BoxList< DIM > &boxes, const Box< DIM > &box, const tbox::Array< tbox::List< int > > cut_points)
static bool extendBoxToDomainBoundary (Box< DIM > &box, const BoxList< DIM > &domain, const IntVector< DIM > &ext_ghosts)
static bool extendBoxesToDomainBoundary (BoxList< DIM > &boxes, const BoxList< DIM > &domain, const IntVector< DIM > &ext_ghosts)
static void growBoxesWithinDomain (BoxList< DIM > &boxes, const BoxList< DIM > &domain, const IntVector< DIM > &min_size)
static bool findBestCutPointsGivenMax (tbox::Array< tbox::List< int > > &cut_points, const Box< DIM > &box, const IntVector< DIM > &max_size, const IntVector< DIM > &min_size, const IntVector< DIM > &cut_factor)
static bool findBestCutPointsForDirectionGivenMax (const int idir, tbox::List< int > &cut_points, const Box< DIM > &box, const int max_size, const int min_size, const int cut_factor)
static bool findBestCutPointsGivenNumber (tbox::Array< tbox::List< int > > &cut_points, const Box< DIM > &box, const IntVector< DIM > &number_boxes, const IntVector< DIM > &min_size, const IntVector< DIM > &cut_factor)
static bool findBestCutPointsForDirectionGivenNumber (const int idir, tbox::List< int > &cut_points, const Box< DIM > &box, const int num_boxes, const int min_size, const int cut_factor)
static bool checkBoxForBadCutPoints (IntVector< DIM > &bad_cut_information, const Box< DIM > &box, const BoxArray< DIM > &physical_boxes, const IntVector< DIM > &bad_interval)
static bool checkBoxForBadCutPointsInDirection (const int dir, const Box< DIM > &box, const BoxArray< DIM > &physical_boxes, const IntVector< DIM > &bad_interval)
static void findBadCutPoints (tbox::Array< tbox::Array< bool > > &bad_cuts, const Box< DIM > &box, const BoxArray< DIM > &physical_boxes, const IntVector< DIM > &bad_interval)
static void findBadCutPointsForDirection (const int dir, tbox::Array< bool > &bad_cuts, const Box< DIM > &box, const BoxArray< DIM > &physical_boxes, const IntVector< DIM > &bad_interval)
static void fixBadCutPoints (tbox::Array< tbox::List< int > > &cuts, const tbox::Array< tbox::Array< bool > > &bad_cuts, const Box< DIM > &box, const IntVector< DIM > &min_size, const IntVector< DIM > &cut_factor)
static void fixBadCutPointsForDirection (const int dir, tbox::List< int > &cuts, const tbox::Array< bool > &bad_cuts, const Box< DIM > &box, const int min_size, const int cut_factor)
static void findBadCutPointsForBorderAndDirection (const int id, tbox::Array< bool > &bad_cuts, const Box< DIM > &box, const Box< DIM > &border, const int bad_interval)
static void makeNonOverlappingBoxLists (tbox::Array< BoxList< DIM > > &box_list_array, const BoxArray< DIM > &boxes)


Detailed Description

template<int DIM>
struct SAMRAI::hier::BoxUtilities< DIM >

Class BoxUtilities<DIM> provides several utility routines for processing boxes or collections of boxes. Many of these operations require information about the location of the input boxes within some region of index space (domain) or are used to compute this sort of information. Often these routines are used in load balancing and communication routines to determine the relationship of a box or set of boxes to some domain boundary, where the domain is specified by a list of box regions.

The following provides an explanation some of the concepts common to many of the functions in this class.

A cut point for a coordinate direction is an integer that specifies the index value of the cell immediately to the right of the boundary along which a box will be cut. For instance, if we have a cut point value of 12 in the y-coordinate direction for box [(0,0,0), (5,15,10)], then the box will be cut into [(0,0,0),(5,11,10)] and [(0,12,0),(5,15,10)]. That is, the box has been cut along the boundary between the y = 11 and y = 12 cells.

The following provides an explanation some of the arguments common to many of the functions in this class.

It should be noted that the max_size constraint has lower priority than the other constraints. In instances where all constraints cannot be simultaneously satisfied, the max_size constraint is sacrificed.

This constraint is usually enforced with the cut_factor equal to a multiple of the refinement ratio between levels to ensure that if the box is coarsened, the resulting box is aligned with the coarse grid (it is assumed that the boundary of the fine box is aligned with a coarse cell boundary).

The bad_interval constraint is enforced to avoid the situation where the ghost region for a box resides partially inside and partially outside the box list domain which complicates ghost cell filling. In addition, this constraint avoids complicated issues with respect to the numerical accuracy of the solution.

Typically, bad_interval is based on the maximum ghost cell width over all patch data objects and some coarsen ratio.

Note that all member functions of this class are static. The main intent of the class is to group the functions into one name space. Thus, you should never attempt to instantiate a class of type BoxUtilities<DIM>; simply call the functions as static functions; e.g., BoxUtilities<DIM>::function(...). These routines are placed here rather than in the box, box list, box array classes to avoid circular dependencies among these classes.

See also:
hier::Box

hier::BoxArray

hier::BoxList


Member Function Documentation

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::checkBoxConstraints ( const Box< DIM > &  box,
const IntVector< DIM > &  min_size,
const IntVector< DIM > &  cut_factor,
const IntVector< DIM > &  bad_interval,
const BoxArray< DIM > &  physical_boxes 
) [static]

Check the given box for violation of minimum size, cut factor, and box list domain constraints. If a patch is generated from a box that violates any of these constraints, then some other routine (e.g., ghost cell filling, or inter-patch communication) may fail. Thus, this routine prints an error message describing the violation and executes a program abort.

Arguments:

If there is no constraint on the box location within the box list domain, pass in an empty box array for the physical_boxes argument.

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::chopBoxes ( BoxList< DIM > &  boxes,
const IntVector< DIM > &  max_size,
const IntVector< DIM > &  min_size,
const IntVector< DIM > &  cut_factor,
const IntVector< DIM > &  bad_interval,
const BoxArray< DIM > &  physical_boxes 
) [static]

Replace each box in the list that is too large with a list of non- overlapping smaller boxes whose union covers the same region of index space as the original box.

Arguments:

Notes:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::chopBox ( BoxList< DIM > &  boxes,
const Box< DIM > &  box,
const tbox::Array< tbox::List< int > >  cut_points 
) [static]

Chop the box into a collection of boxes according to the collection of cut points specified along each coordinate direction. Cut points that do not reside within the range of box indices are ignored.

Arguments:

Assertion checks:

Notes:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::extendBoxToDomainBoundary ( Box< DIM > &  box,
const BoxList< DIM > &  domain,
const IntVector< DIM > &  ext_ghosts 
) [static]

Extend the box in the list to domain boundary as needed so that the domain boundary does not intersect the ghost cell region around the box in an inappropriate manner. Intersections that are disallowed are those in which a portion of the domain boundary is parallel to a box face and lies strictly in the interior of the ghost cell layer adjacent to that face. In other words, we eliminate ghost cell regions residing outside of a given domain and which are narrower than the specified ghost width. The boolean return value is true if the input box was extended to the boundary and thus is changed by the routine. Otherwise, the return value is false.

See description of bad_interval in the class header comments for more details.

Arguments:

Assertion checks:

Notes:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::extendBoxesToDomainBoundary ( BoxList< DIM > &  boxes,
const BoxList< DIM > &  domain,
const IntVector< DIM > &  ext_ghosts 
) [static]

Same function as extendBoxToDomainBoundary() above except that it extends each box in a list of boxes to the domain boundary specified by the box list argument as needed. The boolean return value is true if any box in the input box list was extended to the boundary and thus is changed by the routine. Otherwise, the return value is false.

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::growBoxesWithinDomain ( BoxList< DIM > &  boxes,
const BoxList< DIM > &  domain,
const IntVector< DIM > &  min_size 
) [static]

Grow each box in the list that is smaller than the specified minimum size.

Arguments:

Assertion checks:

Notes:

For instance if the domain is given by [(0,0),(2,10)], [(0,3),(1,4)], [(0,5),(10,10)] and the box is given by [(4,1),(6,2)] with a minimum size of (4,4), there is no way the box can be grown to the minimum size without have to "cross" the gap in the box list domain.

This routine will grow each box as far as it can, but will not remedy these situations, generally.

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::findBestCutPointsGivenMax ( tbox::Array< tbox::List< int > > &  cut_points,
const Box< DIM > &  box,
const IntVector< DIM > &  max_size,
const IntVector< DIM > &  min_size,
const IntVector< DIM > &  cut_factor 
) [static]

Determine whether the box may be chopped according to specified min_size, max_size and cut_factor constraints. For those directions along which the box may be chopped, the cut points are computed. The cut points for the j-th coordinate direction are placed into a list of integers corresponding to the j-th component of the cut_point array.

Return value:

Arguments:

Assertion checks:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::findBestCutPointsForDirectionGivenMax ( const int  idir,
tbox::List< int > &  cut_points,
const Box< DIM > &  box,
const int  max_size,
const int  min_size,
const int  cut_factor 
) [static]

Determine whether the box may be chopped according to specified min_size, max_size and cut_factor constraints along given coordinate direction. If the box may be chopped, the cut points are computed and placed into a list of integers.

Return value:

Arguments:

Assertion checks:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::findBestCutPointsGivenNumber ( tbox::Array< tbox::List< int > > &  cut_points,
const Box< DIM > &  box,
const IntVector< DIM > &  number_boxes,
const IntVector< DIM > &  min_size,
const IntVector< DIM > &  cut_factor 
) [static]

Determine whether the box may be chopped into the specified number of boxes along each coordinate direction. For those directions along which the box may be chopped, the cut points are computed. The cut points for the j-th coordinate direction are placed into a list of integers corresponding to the j-th component of the cut_point array.

Return value:

Arguments:

Important note: By convention, each integer cut point that is computed corresponds to the cell index to the right of cut point.

Assertion checks:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::findBestCutPointsForDirectionGivenNumber ( const int  idir,
tbox::List< int > &  cut_points,
const Box< DIM > &  box,
const int  num_boxes,
const int  min_size,
const int  cut_factor 
) [static]

Determine whether the box may be chopped into the specified number of boxes along along given coordinate direction. If the box may be chopped, the cut points are computed and placed into a list of integers.

Return value:

Arguments:

Assertion checks:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::checkBoxForBadCutPoints ( IntVector< DIM > &  bad_cut_information,
const Box< DIM > &  box,
const BoxArray< DIM > &  physical_boxes,
const IntVector< DIM > &  bad_interval 
) [static]

Determine whether box has any bad cut points based on its position within the box list domain. Information about the potentially bad directions is returned in the IntVector bad_cut_information. An entry of zero indicates that there are no bad cut points for the box along that coordinate direction. An entry of one indicates that there may be a bad cut point along that direction.

Return value:

Arguments:

Assertion checks:

template<int DIM>
bool SAMRAI::hier::BoxUtilities< DIM >::checkBoxForBadCutPointsInDirection ( const int  dir,
const Box< DIM > &  box,
const BoxArray< DIM > &  physical_boxes,
const IntVector< DIM > &  bad_interval 
) [static]

Determine whether box may have any bad cut points along the specified coordinate direction based on its position within the box array domain.

Return value:

Arguments:

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::findBadCutPoints ( tbox::Array< tbox::Array< bool > > &  bad_cuts,
const Box< DIM > &  box,
const BoxArray< DIM > &  physical_boxes,
const IntVector< DIM > &  bad_interval 
) [static]

Determine bad cut points for box based on the specified box array domain and bad interval.

The cut information is returned as an array (size = DIM) of arrays (size = number of cells along edge of box) of boolean values. A false value indicates a good cut point, a true value indicates that the box should not be cut at that point.

Arguments:

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::findBadCutPointsForDirection ( const int  dir,
tbox::Array< bool > &  bad_cuts,
const Box< DIM > &  box,
const BoxArray< DIM > &  physical_boxes,
const IntVector< DIM > &  bad_interval 
) [static]

Find bad cut points for a box given a single coordinate direction. The cut information is returned as an array of boolean values (size = number of cells along specified edge of box). A false value indicates a good cut point, a true value indicates that the box should not be cut at that point.

Arguments:

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::fixBadCutPoints ( tbox::Array< tbox::List< int > > &  cuts,
const tbox::Array< tbox::Array< bool > > &  bad_cuts,
const Box< DIM > &  box,
const IntVector< DIM > &  min_size,
const IntVector< DIM > &  cut_factor 
) [static]

Given a set of potential cut points and a set of bad cut points for a box, adjust the cut points so that they do not coincide with bad cut points. Typically, the cuts are generated using either of the findBestCutPoints...() functions, and the bad cut points are generated using the findBadCutPoints() function.

Arguments:

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::fixBadCutPointsForDirection ( const int  dir,
tbox::List< int > &  cuts,
const tbox::Array< bool > &  bad_cuts,
const Box< DIM > &  box,
const int  min_size,
const int  cut_factor 
) [static]

Given a set of potential cut points and a set of bad cut points for a box, adjust the cut points in the specified coordinate direction so that they do not coincide with bad cut points. Typically, the cuts are generated using either of the findBestCutPoints...() functions, and the bad cut points are generated using the findBadCutPoints() function.

Arguments:

Assertion checks:

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::findBadCutPointsForBorderAndDirection ( const int  id,
tbox::Array< bool > &  bad_cuts,
const Box< DIM > &  box,
const Box< DIM > &  border,
const int  bad_interval 
) [static]

This static private member function is called by findBadCutPoints(), and the findBadCutPointsForDirection() member functions. It sets bad cut points near the lower and upper ends of the border box in the given coordinate direction.

template<int DIM>
void SAMRAI::hier::BoxUtilities< DIM >::makeNonOverlappingBoxLists ( tbox::Array< BoxList< DIM > > &  box_list_array,
const BoxArray< DIM > &  boxes 
) [static]

Construct an array of box lists so that each list contains a non-overlapping set of boxes covering some portion of the box at the same array location in the box array. The regions of index space formed by composing the union of boxes on each box list are mutually disjoint and the union of all boxes in the box lists exactly covers the union of boxes in the original box array. In other words, this routine partitions the boxes in the "boxes" argument into a set of non-overlapping box collections. If none of the boxes in this box array overlap then each box list in the resulting array has a single box equal to the corresponding box in the box array. This routine is especially useful for determining a unique set of index points given an array of boxes in some index space.

Arguments:


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