ug4
ug::Partitioner_DynamicBisection< TElem, dim > Class Template Reference

Parallel bisection partitioner. More...

#include <partitioner_dynamic_bisection.h>

+ Inheritance diagram for ug::Partitioner_DynamicBisection< TElem, dim >:

Classes

struct  ElemList
 
struct  Entry
 
struct  TreeNode
 

Public Types

typedef Grid::VertexAttachmentAccessor< apos_taapos_t
 
typedef Attachment< vector_tapos_t
 
typedef IPartitioner base_class
 
typedef TElem elem_t
 
typedef GridLayoutMap::Types< elem_t >::Layout::LevelLayout layout_t
 
typedef TElem::side side_t
 
typedef MathVector< dimvector_t
 

Public Member Functions

virtual ConstSPProcessHierarchy current_process_hierarchy () const
 
void enable_longest_split_axis (bool enable)
 enables automatical determination of split-axis by longest geometry extension More...
 
void enable_split_axis (int axis, bool enable)
 enable or disable splits along a certain axis. More...
 
void enable_static_partitioning (bool enable)
 
virtual SubsetHandlerget_partitions ()
 
virtual const std::vector< int > * get_process_map () const
 returns the processes map. Updated during partitioning. may be NULL. More...
 
virtual ConstSPProcessHierarchy next_process_hierarchy () const
 
int num_split_improvement_iterations () const
 the maximum number of iterations performed to find a good split plane More...
 
virtual bool partition (size_t baseLvl, size_t elementThreshold)
 
 Partitioner_DynamicBisection ()
 
virtual void set_balance_weights (SPBalanceWeights balanceWeights)
 
void set_grid (MultiGrid *mg, Attachment< MathVector< dim > > aPos)
 
virtual void set_next_process_hierarchy (SPProcessHierarchy procHierarchy)
 
void set_num_split_improvement_iterations (int num)
 
virtual void set_partition_post_processor (SPPartitionPostProcessor ppp)
 
virtual void set_partition_pre_processor (SPPartitionPreProcessor ppp)
 
void set_start_split_axis (int axis)
 sets the axis with which bisection is started. More...
 
void set_subset_handler (SmartPtr< SubsetHandler > sh)
 allows to optionally specify a subset-handler on which the balancer shall operate More...
 
void set_tolerance (number tol)
 sets the tolerance threshold. 1: no tolerance, 0: full tolerance. More...
 
bool static_partitioning_enabled () const
 
virtual bool supports_balance_weights () const
 
virtual bool supports_connection_weights () const
 
virtual bool supports_repartitioning () const
 
virtual ~Partitioner_DynamicBisection ()
 
- Public Member Functions inherited from ug::IPartitioner
 IPartitioner ()
 
virtual bool problems_occurred ()
 indicates whether problems occurred during the last partitioning More...
 
virtual void set_communication_weights (SPCommunicationWeights commWeights)
 
void set_verbose (bool verbose)
 
virtual bool supports_communication_weights () const
 
bool verbose () const
 
virtual ~IPartitioner ()
 
virtual void enable_clustered_siblings (bool bEnable)
 
virtual bool clustered_siblings_enabled ()
 

Private Types

enum  constants {
  UNCLASSIFIED = 0 , LEFT = 1 , RIGHT = 1 << 1 , CUTTING = LEFT | RIGHT ,
  CUTTING_CENTER_LEFT , CUTTING_CENTER_RIGHT , TOTAL , NUM_CONSTANTS
}
 

Private Member Functions

void bisect_elements (std::vector< TreeNode > &childNodesOut, std::vector< TreeNode > &parentNodes, ANumber aWeight, number maxChildWeight, pcl::ProcessCommunicator &com, int cutRecursion, int splitAxis)
 
void calculate_global_dimensions (std::vector< TreeNode > &treeNodes, number maxChildWeight, ANumber aWeight, pcl::ProcessCommunicator &com)
 
int classify_elem (elem_t *e, int splitAxis, number splitValue)
 
void control_bisection (ISubsetHandler &partitionSH, std::vector< TreeNode > &treeNodes, ANumber aWeight, number maxChildWeight, pcl::ProcessCommunicator &com)
 
void copy_partitions_to_children (ISubsetHandler &partitionSH, int lvl)
 
void gather_weights_from_level (int baseLvl, int childLvl, ANumber aWeight, bool copyToVMastersOnBaseLvl, bool markedElemsOnly)
 
int get_next_split_axis ()
 returns the next valid split axis to m_lastSplitAxis. More...
 
int get_next_split_axis (int lastAxis) const
 returns the next valid split axis to the specified one More...
 
void improve_split_values (std::vector< TreeNode > &treeNodes, size_t maxIterations, ANumber aWeight, pcl::ProcessCommunicator &com)
 
void perform_bisection (int numTargetProcs, int minLvl, int maxLvl, int partitionLvl, ANumber aWeight, pcl::ProcessCommunicator com)
 

Private Attributes

aapos_t m_aaPos
 
apos_t m_aPos
 
SPBalanceWeights m_balanceWeights
 
std::vector< Entrym_entries
 
int m_firstSplitAxisEnabled
 
int m_highestRedistLevel
 
pcl::InterfaceCommunicator< layout_tm_intfcCom
 
int m_lastSplitAxis
 
int m_longestSplitAxisEnabled
 
MultiGridm_mg
 
SPProcessHierarchy m_nextProcessHierarchy
 
int m_numSplitAxisEnabled
 
SPPartitionPostProcessor m_partitionPostProcessor
 
SPPartitionPreProcessor m_partitionPreProcessor
 
SPProcessHierarchy m_processHierarchy
 
std::vector< int > m_procMap
 
SmartPtr< SubsetHandlerm_sh
 
bool m_splitAxisEnabled [dim]
 
size_t m_splitImproveIterations
 
int m_startSplitAxis
 
bool m_staticPartitioning
 
number m_tolerance
 

Static Private Attributes

static const size_t s_invalidIndex = -1
 

Additional Inherited Members

- Protected Attributes inherited from ug::IPartitioner
bool m_problemsOccurred
 

Detailed Description

template<class TElem, int dim>
class ug::Partitioner_DynamicBisection< TElem, dim >

Parallel bisection partitioner.

The partitioner can be used inside a LoadBalancer or separately. It can operate on serial and parallel multigrids.

The following partition hints provided by a process hierarchy are supported:

  • 'enableXCuts' (bool)
  • 'enableYCuts' (bool)
  • 'enableZCuts' (bool)

Member Typedef Documentation

◆ aapos_t

template<class TElem , int dim>
typedef Grid::VertexAttachmentAccessor<apos_t> ug::Partitioner_DynamicBisection< TElem, dim >::aapos_t

◆ apos_t

template<class TElem , int dim>
typedef Attachment<vector_t> ug::Partitioner_DynamicBisection< TElem, dim >::apos_t

◆ base_class

template<class TElem , int dim>
typedef IPartitioner ug::Partitioner_DynamicBisection< TElem, dim >::base_class

◆ elem_t

template<class TElem , int dim>
typedef TElem ug::Partitioner_DynamicBisection< TElem, dim >::elem_t

◆ layout_t

template<class TElem , int dim>
typedef GridLayoutMap::Types<elem_t>::Layout::LevelLayout ug::Partitioner_DynamicBisection< TElem, dim >::layout_t

◆ side_t

template<class TElem , int dim>
typedef TElem::side ug::Partitioner_DynamicBisection< TElem, dim >::side_t

◆ vector_t

template<class TElem , int dim>
typedef MathVector<dim> ug::Partitioner_DynamicBisection< TElem, dim >::vector_t

Member Enumeration Documentation

◆ constants

template<class TElem , int dim>
enum ug::Partitioner_DynamicBisection::constants
private
Enumerator
UNCLASSIFIED 
LEFT 
RIGHT 
CUTTING 
CUTTING_CENTER_LEFT 
CUTTING_CENTER_RIGHT 
TOTAL 
NUM_CONSTANTS 

Constructor & Destructor Documentation

◆ Partitioner_DynamicBisection()

◆ ~Partitioner_DynamicBisection()

template<class TElem , int dim>
ug::Partitioner_DynamicBisection< TElem, dim >::~Partitioner_DynamicBisection
virtual

Member Function Documentation

◆ bisect_elements()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::bisect_elements ( std::vector< TreeNode > &  childNodesOut,
std::vector< TreeNode > &  parentNodes,
ANumber  aWeight,
number  maxChildWeight,
pcl::ProcessCommunicator com,
int  cutRecursion,
int  splitAxis 
)
private

◆ calculate_global_dimensions()

◆ classify_elem()

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::classify_elem ( elem_t e,
int  splitAxis,
number  splitValue 
)
private

◆ control_bisection()

◆ copy_partitions_to_children()

◆ current_process_hierarchy()

template<class TElem , int dim>
ConstSPProcessHierarchy ug::Partitioner_DynamicBisection< TElem, dim >::current_process_hierarchy
virtual

Implements ug::IPartitioner.

◆ enable_longest_split_axis()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::enable_longest_split_axis ( bool  enable)
inline

enables automatical determination of split-axis by longest geometry extension

disabled by default

References ug::Partitioner_DynamicBisection< TElem, dim >::m_longestSplitAxisEnabled.

◆ enable_split_axis()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::enable_split_axis ( int  axis,
bool  enable 
)

enable or disable splits along a certain axis.

By default, splits along all axis are enabled.

References dim.

◆ enable_static_partitioning()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::enable_static_partitioning ( bool  enable)
virtual

static partitioning should be used if a globally refined multigrid is is used throughout a simulation. Static partitioning drastically reduces global communication. The drawback is, that static partitioning e.g. can't be used to properly rebalance a distributed adaptive grid.

Reimplemented from ug::IPartitioner.

◆ gather_weights_from_level()

◆ get_next_split_axis() [1/2]

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::get_next_split_axis
private

returns the next valid split axis to m_lastSplitAxis.

The method starts from m_startSplitAxis, cycling through all valid split axis.

Note
The method uses m_lastSplitAxis to determine the last used axis. It also sets m_lastSplitAxis to the next axis. In order to force the method to restart from m_startSplitAxis you may set m_lastSplitAxis to -1.

◆ get_next_split_axis() [2/2]

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::get_next_split_axis ( int  lastAxis) const
private

returns the next valid split axis to the specified one

References dim, and UG_THROW.

◆ get_partitions()

template<class TElem , int dim>
SubsetHandler & ug::Partitioner_DynamicBisection< TElem, dim >::get_partitions
virtual

Implements ug::IPartitioner.

References make_sp().

◆ get_process_map()

template<class TElem , int dim>
const std::vector< int > * ug::Partitioner_DynamicBisection< TElem, dim >::get_process_map ( ) const
virtual

returns the processes map. Updated during partitioning. may be NULL.

If NULL is returned, this means that each subset index correspons to a global proc-rank.

Implements ug::IPartitioner.

◆ improve_split_values()

◆ next_process_hierarchy()

template<class TElem , int dim>
ConstSPProcessHierarchy ug::Partitioner_DynamicBisection< TElem, dim >::next_process_hierarchy
virtual

Implements ug::IPartitioner.

◆ num_split_improvement_iterations()

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::num_split_improvement_iterations ( ) const
inline

the maximum number of iterations performed to find a good split plane

References ug::Partitioner_DynamicBisection< TElem, dim >::m_splitImproveIterations.

◆ partition()

◆ perform_bisection()

◆ set_balance_weights()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_balance_weights ( SPBalanceWeights  balanceWeights)
virtual

Reimplemented from ug::IPartitioner.

◆ set_grid()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_grid ( MultiGrid mg,
Attachment< MathVector< dim > >  aPos 
)

◆ set_next_process_hierarchy()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_next_process_hierarchy ( SPProcessHierarchy  procHierarchy)
virtual

Implements ug::IPartitioner.

◆ set_num_split_improvement_iterations()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_num_split_improvement_iterations ( int  num)
inline

◆ set_partition_post_processor()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_partition_post_processor ( SPPartitionPostProcessor  ppp)
virtual

Reimplemented from ug::IPartitioner.

◆ set_partition_pre_processor()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_partition_pre_processor ( SPPartitionPreProcessor  ppp)
virtual

Reimplemented from ug::IPartitioner.

◆ set_start_split_axis()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_start_split_axis ( int  axis)
inline

sets the axis with which bisection is started.

0 by default.

Note
the start-split-axis is only considered if longest-split-axis is disabled.

References ug::Partitioner_DynamicBisection< TElem, dim >::m_startSplitAxis.

◆ set_subset_handler()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_subset_handler ( SmartPtr< SubsetHandler sh)
virtual

allows to optionally specify a subset-handler on which the balancer shall operate

Reimplemented from ug::IPartitioner.

◆ set_tolerance()

template<class TElem , int dim>
void ug::Partitioner_DynamicBisection< TElem, dim >::set_tolerance ( number  tol)
inline

sets the tolerance threshold. 1: no tolerance, 0: full tolerance.

the tolerance is defaulted to 0.99

References ug::Partitioner_DynamicBisection< TElem, dim >::m_tolerance.

◆ static_partitioning_enabled()

template<class TElem , int dim>
bool ug::Partitioner_DynamicBisection< TElem, dim >::static_partitioning_enabled

◆ supports_balance_weights()

template<class TElem , int dim>
bool ug::Partitioner_DynamicBisection< TElem, dim >::supports_balance_weights
virtual

Reimplemented from ug::IPartitioner.

◆ supports_connection_weights()

template<class TElem , int dim>
bool ug::Partitioner_DynamicBisection< TElem, dim >::supports_connection_weights
virtual

◆ supports_repartitioning()

template<class TElem , int dim>
virtual bool ug::Partitioner_DynamicBisection< TElem, dim >::supports_repartitioning ( ) const
inlinevirtual

Reimplemented from ug::IPartitioner.

Member Data Documentation

◆ m_aaPos

template<class TElem , int dim>
aapos_t ug::Partitioner_DynamicBisection< TElem, dim >::m_aaPos
private

◆ m_aPos

template<class TElem , int dim>
apos_t ug::Partitioner_DynamicBisection< TElem, dim >::m_aPos
private

◆ m_balanceWeights

template<class TElem , int dim>
SPBalanceWeights ug::Partitioner_DynamicBisection< TElem, dim >::m_balanceWeights
private

◆ m_entries

template<class TElem , int dim>
std::vector<Entry> ug::Partitioner_DynamicBisection< TElem, dim >::m_entries
private

◆ m_firstSplitAxisEnabled

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_firstSplitAxisEnabled
private

◆ m_highestRedistLevel

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_highestRedistLevel
private

◆ m_intfcCom

template<class TElem , int dim>
pcl::InterfaceCommunicator<layout_t> ug::Partitioner_DynamicBisection< TElem, dim >::m_intfcCom
private

◆ m_lastSplitAxis

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_lastSplitAxis
private

◆ m_longestSplitAxisEnabled

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_longestSplitAxisEnabled
private

◆ m_mg

template<class TElem , int dim>
MultiGrid* ug::Partitioner_DynamicBisection< TElem, dim >::m_mg
private

◆ m_nextProcessHierarchy

template<class TElem , int dim>
SPProcessHierarchy ug::Partitioner_DynamicBisection< TElem, dim >::m_nextProcessHierarchy
private

◆ m_numSplitAxisEnabled

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_numSplitAxisEnabled
private

◆ m_partitionPostProcessor

template<class TElem , int dim>
SPPartitionPostProcessor ug::Partitioner_DynamicBisection< TElem, dim >::m_partitionPostProcessor
private

◆ m_partitionPreProcessor

template<class TElem , int dim>
SPPartitionPreProcessor ug::Partitioner_DynamicBisection< TElem, dim >::m_partitionPreProcessor
private

◆ m_processHierarchy

template<class TElem , int dim>
SPProcessHierarchy ug::Partitioner_DynamicBisection< TElem, dim >::m_processHierarchy
private

◆ m_procMap

template<class TElem , int dim>
std::vector<int> ug::Partitioner_DynamicBisection< TElem, dim >::m_procMap
private

◆ m_sh

template<class TElem , int dim>
SmartPtr<SubsetHandler> ug::Partitioner_DynamicBisection< TElem, dim >::m_sh
private

◆ m_splitAxisEnabled

template<class TElem , int dim>
bool ug::Partitioner_DynamicBisection< TElem, dim >::m_splitAxisEnabled[dim]
private

◆ m_splitImproveIterations

◆ m_startSplitAxis

template<class TElem , int dim>
int ug::Partitioner_DynamicBisection< TElem, dim >::m_startSplitAxis
private

◆ m_staticPartitioning

template<class TElem , int dim>
bool ug::Partitioner_DynamicBisection< TElem, dim >::m_staticPartitioning
private

◆ m_tolerance

template<class TElem , int dim>
number ug::Partitioner_DynamicBisection< TElem, dim >::m_tolerance
private

◆ s_invalidIndex

template<class TElem , int dim>
const size_t ug::Partitioner_DynamicBisection< TElem, dim >::s_invalidIndex = -1
staticprivate

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