IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
IBTK::MergingLoadBalancer Class Reference

Class MergingLoadBalancer merges the boxes generated by a load balancer in a final step to decrease the total number of boxes. In essence, it postprocesses the list of boxes generated by its parent class to try and coalesce the set of boxes on each process. More...

#include <ibtk/MergingLoadBalancer.h>

Inheritance diagram for IBTK::MergingLoadBalancer:
Inheritance graph
[legend]

Public Member Functions

virtual void loadBalanceBoxes (SAMRAI::hier::BoxArray< NDIM > &out_boxes, SAMRAI::hier::ProcessorMapping &mapping, const SAMRAI::hier::BoxList< NDIM > &in_boxes, const SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM > > hierarchy, int level_number, const SAMRAI::hier::BoxArray< NDIM > &physical_domain, const SAMRAI::hier::IntVector< NDIM > &ratio_to_hierarchy_level_zero, const SAMRAI::hier::IntVector< NDIM > &min_size, const SAMRAI::hier::IntVector< NDIM > &max_size, const SAMRAI::hier::IntVector< NDIM > &cut_factor, const SAMRAI::hier::IntVector< NDIM > &bad_interval) const override
 
void setMaxWorkloadFactor (double factor, int level_number=-1)
 
void setWorkloadTolerance (double tolerance, int level_number=-1)
 
void setWorkloadPatchDataIndex (int data_id, int level_number=-1)
 
void setUniformWorkload (int level_number=-1)
 
void setBinPackMethod (const std::string &method, int level_number=-1)
 
void setIgnoreLevelDomainIsSingleBox (bool flag)
 
bool getLoadBalanceDependsOnPatchData (int level_number) const
 
void loadBalanceBoxes (hier::BoxArray< DIM > &out_boxes, hier::ProcessorMapping &mapping, const hier::BoxList< DIM > &in_boxes, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, int level_number, const hier::BoxArray< DIM > &physical_domain, const hier::IntVector< DIM > &ratio_to_hierarchy_level_zero, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval) const
 
virtual void printClassData (std::ostream &os) const
 

Private Member Functions

void getFromInput (tbox::Pointer< tbox::Database > db)
 
void chopUniformSingleBox (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::Box< DIM > &in_box, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const
 
void chopBoxesWithUniformWorkload (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::BoxList< DIM > &in_boxes, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, int level_number, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const
 
void chopBoxesWithNonuniformWorkload (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::BoxList< DIM > &in_boxes, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, int level_number, const hier::IntVector< DIM > &ratio_to_coarsest_hierarchy_level, int wrk_indx, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const
 
void binPackBoxes (hier::BoxArray< DIM > &boxes, hier::ProcessorMapping &mapping, tbox::Array< double > &workloads, const std::string &bin_pack_method) const
 
int getWorkloadDataId (int level_number) const
 
double getMaxWorkloadFactor (int level_number) const
 
double getWorkloadTolerance (int level_number) const
 
std::string getBinPackMethod (int level_number) const
 

Private Attributes

std::string d_object_name
 
bool d_processor_layout_specified
 
hier::IntVector< DIM > d_processor_layout
 
bool d_ignore_level_box_union_is_single_box
 
int d_master_workload_data_id
 
double d_master_max_workload_factor
 
double d_master_workload_tolerance
 
std::string d_master_bin_pack_method
 
tbox::Array< intd_workload_data_id
 
tbox::Array< doubled_max_workload_factor
 
tbox::Array< doubled_workload_tolerance
 
tbox::Array< std::string > d_bin_pack_method
 
bool d_opt_for_single_box
 
tbox::Pointer< tbox::Timer > t_load_balance_boxes
 
tbox::Pointer< tbox::Timer > t_load_balance_boxes_remove_intersection
 
tbox::Pointer< tbox::Timer > t_bin_pack_boxes
 
tbox::Pointer< tbox::Timer > t_bin_pack_boxes_sort
 
tbox::Pointer< tbox::Timer > t_bin_pack_boxes_pack
 
tbox::Pointer< tbox::Timer > t_chop_boxes
 

Detailed Description

Note
During regridding, the boxes generated by this class are subsequently read by GriddingAlgorithm, which will enforce minimum and maximum size constraints; i.e., to take full advantage of this class one must set up the GriddingAlgorithm objects to have very large maximum box sizes.

Member Function Documentation

◆ loadBalanceBoxes() [1/2]

virtual void IBTK::MergingLoadBalancer::loadBalanceBoxes ( SAMRAI::hier::BoxArray< NDIM > &  out_boxes,
SAMRAI::hier::ProcessorMapping mapping,
const SAMRAI::hier::BoxList< NDIM > &  in_boxes,
const SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM > >  hierarchy,
int  level_number,
const SAMRAI::hier::BoxArray< NDIM > &  physical_domain,
const SAMRAI::hier::IntVector< NDIM > &  ratio_to_hierarchy_level_zero,
const SAMRAI::hier::IntVector< NDIM > &  min_size,
const SAMRAI::hier::IntVector< NDIM > &  max_size,
const SAMRAI::hier::IntVector< NDIM > &  cut_factor,
const SAMRAI::hier::IntVector< NDIM > &  bad_interval 
) const
overridevirtual

◆ setMaxWorkloadFactor()

void SAMRAI::mesh::LoadBalancer< DIM >::setMaxWorkloadFactor ( double  factor,
int  level_number = -1 
)
inherited

Set the max workload factor for either the specified level or all hierarchy levels. See discussion about inputs above for information on how this value is used during load balancing operations.

Parameters
factorDouble value of multiplier for average workload used in box chopping. The default value is 1.0.
level_numberOptional integer number for level to which factor is applied. If no value is given, the factor will be used for all levels.

◆ setWorkloadTolerance()

void SAMRAI::mesh::LoadBalancer< DIM >::setWorkloadTolerance ( double  tolerance,
int  level_number = -1 
)
inherited

Set the workload tolerance for either the specified level or all hierarchy levels. See discussion about inputs above for information on how this value is used during load balancing operations.

Parameters
factorDouble value of tolerance. The default value is 0.0;
level_numberOptional integer number for level to which factor is applied. If no value is given, the value will be used for all levels.

◆ setWorkloadPatchDataIndex()

void SAMRAI::mesh::LoadBalancer< DIM >::setWorkloadPatchDataIndex ( int  data_id,
int  level_number = -1 
)
inherited

Configure the load balancer to use the data stored in the hierarchy at the specified descriptor index for estimating the workload on each cell.

Parameters
data_idInteger value of patch data identifier for workload estimate on each cell.
level_numberOptional integer number for level on which data id is used. If no value is given, the data will be used for all levels.

◆ setUniformWorkload()

void SAMRAI::mesh::LoadBalancer< DIM >::setUniformWorkload ( int  level_number = -1)
inherited

Configure the load balancer to load balance boxes by assuming all cells on the specified level or all hierarchy levels are weighted equally.

Parameters
level_numberOptional integer number for level on which uniform workload estimate will be used. If the level number is not specified, a uniform workload estimate will be used on all levels.

◆ setBinPackMethod()

void SAMRAI::mesh::LoadBalancer< DIM >::setBinPackMethod ( const std::string &  method,
int  level_number = -1 
)
inherited

Configure the load balancer to use the bin-packing procedure for mapping patches to processors indicated by the string.

Parameters
methodString value indicating bin-packing method to use. See input file description above for valid options. The default value is "GREEDY".
level_numberOptional integer number for level on which bin-packing method will be used. If no value is given, the prescribed methods will be used on all levels.

◆ setIgnoreLevelDomainIsSingleBox()

void SAMRAI::mesh::LoadBalancer< DIM >::setIgnoreLevelDomainIsSingleBox ( bool  flag)
inherited

Set the boolean flag to control chopping of level boxes when the union of the input boxes passed to the loadBalanceBoxes() routine is a single box. The default value is false, which means that the domain will be chopped to make patch boxes based on the (single box) union of the boxes describing the level regardless of the input boxes. When the value is set to true, the domain will be chopped by chopping each of the input boxes.

Parameters
flagBoolean value indicating whether to ignore the set of input boxes to the loadBalanceBoxes() routine when the union of those boxes is a single box.

◆ getLoadBalanceDependsOnPatchData()

bool SAMRAI::mesh::LoadBalancer< DIM >::getLoadBalanceDependsOnPatchData ( int  level_number) const
virtualinherited

Return true if load balancing procedure for given level depends on patch data on mesh; otherwise return false. This can be used to determine whether a level needs to be rebalanced although its box configuration is unchanged. This function is pure virtual in the LoadBalanceStrategy<DIM> base class.

Returns
Boolean value indicating whether load balance depends on patch data.
Parameters
level_numberInteger patch level number.

Implements SAMRAI::mesh::LoadBalanceStrategy< DIM >.

◆ loadBalanceBoxes() [2/2]

void SAMRAI::mesh::LoadBalancer< DIM >::loadBalanceBoxes ( hier::BoxArray< DIM > &  out_boxes,
hier::ProcessorMapping mapping,
const hier::BoxList< DIM > &  in_boxes,
const tbox::Pointer< hier::PatchHierarchy< DIM > >  hierarchy,
int  level_number,
const hier::BoxArray< DIM > &  physical_domain,
const hier::IntVector< DIM > &  ratio_to_hierarchy_level_zero,
const hier::IntVector< DIM > &  min_size,
const hier::IntVector< DIM > &  max_size,
const hier::IntVector< DIM > &  cut_factor,
const hier::IntVector< DIM > &  bad_interval 
) const
virtualinherited

Given a list of boxes, representing the domain of a level in the AMR hierarchy, generate an array of boxes and an associated processor mapping from which the patches for the level will be generated and assigned. The resulting boxes and processor mapping will be determined based on parameters set via input or member functions above. This function is pure virtual in the LoadBalanceStrategy<DIM> base class.

Parameters
out_boxesOutput box array for generating patches on level.
mappingOutput processor mapping for patches on level.
in_boxesInput box list representing union of patches on level.
hierarchyInput patch hierarchy in which level will reside.
level_numberInput integer number of level in patch hierarchy. This value must be >= 0.
physical_domainArray of boxes describing the physical extent of the problem domain in the index space associated with the level. This box array cannot be empty.
ratio_to_hierarchy_level_zeroInput integer vector indicating ratio between index space of level to load balance and hierarchy level 0 (i.e., coarsest hierarchy level).
min_sizeInput integer vector of minimum dimensions for output boxes. All entries must be > 0.
max_sizeInput integer vector of maximum dimensions for output boxes. All entries must be >= min_size.
cut_factorInput integer vector used to create boxes with correct dimensions. The length of each box dimension will be an integer multiple of the corresponding cut factor vector entry. All vector entries must be > 0. See hier::BoxUtilities documentation for more details.
bad_intervalInput integer vector used to create boxes near physical domain boundary with sufficient number of cells. No box face will be closer to the boundary than the corresponding interval of cells to the boundary (the corresponding value is given by the normal direction of the box face) unless the face coincides with the boundary itself. The point of this argument is to have no patch live within a certain ghost cell width of the boundary if its boundary does not coincide with that boundary . That is, all ghost cells along a face will be either in the domain interior or outside the domain. All entries must be >= 0. See hier::BoxUtilities documentation for more details.

Implements SAMRAI::mesh::LoadBalanceStrategy< DIM >.

◆ printClassData()

virtual void SAMRAI::mesh::LoadBalancer< DIM >::printClassData ( std::ostream &  os) const
virtualinherited

Print out all members of the class instance to given output stream.

◆ getFromInput()

void SAMRAI::mesh::LoadBalancer< DIM >::getFromInput ( tbox::Pointer< tbox::Database db)
privateinherited

◆ chopUniformSingleBox()

void SAMRAI::mesh::LoadBalancer< DIM >::chopUniformSingleBox ( hier::BoxArray< DIM > &  out_boxes,
tbox::Array< double > &  out_workloads,
const hier::Box< DIM > &  in_box,
const hier::IntVector< DIM > &  min_size,
const hier::IntVector< DIM > &  max_size,
const hier::IntVector< DIM > &  cut_factor,
const hier::IntVector< DIM > &  bad_interval,
const hier::BoxArray< DIM > &  physical_domain 
) const
privateinherited

◆ chopBoxesWithUniformWorkload()

void SAMRAI::mesh::LoadBalancer< DIM >::chopBoxesWithUniformWorkload ( hier::BoxArray< DIM > &  out_boxes,
tbox::Array< double > &  out_workloads,
const hier::BoxList< DIM > &  in_boxes,
const tbox::Pointer< hier::PatchHierarchy< DIM > >  hierarchy,
int  level_number,
const hier::IntVector< DIM > &  min_size,
const hier::IntVector< DIM > &  max_size,
const hier::IntVector< DIM > &  cut_factor,
const hier::IntVector< DIM > &  bad_interval,
const hier::BoxArray< DIM > &  physical_domain 
) const
privateinherited

◆ chopBoxesWithNonuniformWorkload()

void SAMRAI::mesh::LoadBalancer< DIM >::chopBoxesWithNonuniformWorkload ( hier::BoxArray< DIM > &  out_boxes,
tbox::Array< double > &  out_workloads,
const hier::BoxList< DIM > &  in_boxes,
const tbox::Pointer< hier::PatchHierarchy< DIM > >  hierarchy,
int  level_number,
const hier::IntVector< DIM > &  ratio_to_coarsest_hierarchy_level,
int  wrk_indx,
const hier::IntVector< DIM > &  min_size,
const hier::IntVector< DIM > &  max_size,
const hier::IntVector< DIM > &  cut_factor,
const hier::IntVector< DIM > &  bad_interval,
const hier::BoxArray< DIM > &  physical_domain 
) const
privateinherited

◆ binPackBoxes()

void SAMRAI::mesh::LoadBalancer< DIM >::binPackBoxes ( hier::BoxArray< DIM > &  boxes,
hier::ProcessorMapping mapping,
tbox::Array< double > &  workloads,
const std::string &  bin_pack_method 
) const
privateinherited

◆ getWorkloadDataId()

int SAMRAI::mesh::LoadBalancer< DIM >::getWorkloadDataId ( int  level_number) const
privateinherited

◆ getMaxWorkloadFactor()

double SAMRAI::mesh::LoadBalancer< DIM >::getMaxWorkloadFactor ( int  level_number) const
privateinherited

◆ getWorkloadTolerance()

double SAMRAI::mesh::LoadBalancer< DIM >::getWorkloadTolerance ( int  level_number) const
privateinherited

◆ getBinPackMethod()

std::string SAMRAI::mesh::LoadBalancer< DIM >::getBinPackMethod ( int  level_number) const
privateinherited

Member Data Documentation

◆ d_object_name

std::string SAMRAI::mesh::LoadBalancer< DIM >::d_object_name
privateinherited

◆ d_processor_layout_specified

bool SAMRAI::mesh::LoadBalancer< DIM >::d_processor_layout_specified
privateinherited

◆ d_processor_layout

hier::IntVector<DIM> SAMRAI::mesh::LoadBalancer< DIM >::d_processor_layout
privateinherited

◆ d_ignore_level_box_union_is_single_box

bool SAMRAI::mesh::LoadBalancer< DIM >::d_ignore_level_box_union_is_single_box
privateinherited

◆ d_master_workload_data_id

int SAMRAI::mesh::LoadBalancer< DIM >::d_master_workload_data_id
privateinherited

◆ d_master_max_workload_factor

double SAMRAI::mesh::LoadBalancer< DIM >::d_master_max_workload_factor
privateinherited

◆ d_master_workload_tolerance

double SAMRAI::mesh::LoadBalancer< DIM >::d_master_workload_tolerance
privateinherited

◆ d_master_bin_pack_method

std::string SAMRAI::mesh::LoadBalancer< DIM >::d_master_bin_pack_method
privateinherited

◆ d_workload_data_id

tbox::Array<int> SAMRAI::mesh::LoadBalancer< DIM >::d_workload_data_id
privateinherited

◆ d_max_workload_factor

tbox::Array<double> SAMRAI::mesh::LoadBalancer< DIM >::d_max_workload_factor
privateinherited

◆ d_workload_tolerance

tbox::Array<double> SAMRAI::mesh::LoadBalancer< DIM >::d_workload_tolerance
privateinherited

◆ d_bin_pack_method

tbox::Array<std::string> SAMRAI::mesh::LoadBalancer< DIM >::d_bin_pack_method
privateinherited

◆ d_opt_for_single_box

bool SAMRAI::mesh::LoadBalancer< DIM >::d_opt_for_single_box
privateinherited

◆ t_load_balance_boxes

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_load_balance_boxes
privateinherited

◆ t_load_balance_boxes_remove_intersection

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_load_balance_boxes_remove_intersection
privateinherited

◆ t_bin_pack_boxes

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_bin_pack_boxes
privateinherited

◆ t_bin_pack_boxes_sort

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_bin_pack_boxes_sort
privateinherited

◆ t_bin_pack_boxes_pack

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_bin_pack_boxes_pack
privateinherited

◆ t_chop_boxes

tbox::Pointer<tbox::Timer> SAMRAI::mesh::LoadBalancer< DIM >::t_chop_boxes
privateinherited

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