33 #ifndef __H__UG__domain_load_balancer__
34 #define __H__UG__domain_load_balancer__
44 template <
class TDomain>
47 size_t maxNumRedistProcs,
size_t maxNumProcs,
48 int minDistLvl,
int maxLevelsWithoutRedist)
51 maxNumRedistProcs, maxNumProcs, minDistLvl,
52 maxLevelsWithoutRedist, NULL);
55 template <
class TDomain>
58 size_t maxNumRedistProcs,
size_t maxNumProcs,
59 int minDistLvl,
int maxLevelsWithoutRedist,
63 std::vector<size_t> numElemsOnLvl;
65 for(
size_t i = 0; i < domInf.
num_levels(); ++i)
68 if(numElemsOnLvl.empty()){
73 std::vector<int> numMarked;
75 if(dom.get_dim() == 1){
79 else if(dom.get_dim() == 2){
83 else if(dom.get_dim() == 3){
88 if(numMarked.size() < numElemsOnLvl.size())
89 numMarked.resize(numElemsOnLvl.size(), 0);
91 if(numMarked[numElemsOnLvl.size() - 1] > 0)
92 numElemsOnLvl.resize(numElemsOnLvl.size() + 1, 0);
94 for(
size_t i = 0; i < numElemsOnLvl.size(); ++i){
96 numElemsOnLvl[i+1] += numMarked[i] * elemFactor;
102 minNumElemsPerProcPerLvl, maxNumRedistProcs,
103 maxNumProcs, minDistLvl, maxLevelsWithoutRedist);
107 template <
class TDomain>
122 create(*dom->grid(), dom->position_attachment()));
127 std::vector<std::string> additionalSHNames = dom->additional_subset_handler_names();
128 for(
size_t i = 0; i < additionalSHNames.size(); ++i){
141 template <
class TDomain,
class TPartitioner>
145 TPartitioner::set_grid(dom.grid().get(), dom.position_attachment());
149 template <
class TDomain,
class TBalanceWeights>
153 TBalanceWeights::set_grid(dom.grid().get(), dom.position_attachment());
157 template <
class TDomain,
class TCommunicationCostWeights>
161 TCommunicationCostWeights::set_grid(dom.grid().get(), dom.position_attachment());
T * get()
returns encapsulated pointer
Definition: smart_pointer.h:197
bool valid() const
returns true if the pointer is valid, false if not.
Definition: smart_pointer.h:206
Definition: domain_load_balancer.h:150
DomainBalanceWeights(TDomain &dom)
Definition: domain_load_balancer.h:152
Definition: domain_load_balancer.h:158
DomainCommunicationCostWeights(TDomain &dom)
Definition: domain_load_balancer.h:160
Describes the contents of a domain.
Definition: domain.h:59
A small wrapper for LoadBalancer which adds comfort methods to balance and distribute domains.
Definition: domain_load_balancer.h:109
LoadBalancer base_class
Definition: domain_load_balancer.h:110
DomainLoadBalancer(SmartPtr< TDomain > dom)
Definition: domain_load_balancer.h:116
SmartPtr< TDomain > m_dom
Definition: domain_load_balancer.h:137
Definition: domain_load_balancer.h:142
DomainPartitioner(TDomain &dom)
Definition: domain_load_balancer.h:144
Serialization callback for grid attachments.
Definition: serialization.h:290
The refiner interface allows to mark elements for refinement and to call refine.
Definition: refiner_interface.h:67
size_t num_marked_edges(std::vector< int > &numMarkedEdgesOut)
returns the number of (globally) marked edges on all levels of the hierarchy
Definition: refiner_interface.cpp:314
size_t num_marked_faces(std::vector< int > &numMarkedFacesOut)
returns the number of (globally) marked faces on all levels of the hierarchy
Definition: refiner_interface.cpp:332
size_t num_marked_volumes(std::vector< int > &numMarkedVolsOut)
returns the number of (globally) marked volumes on all levels of the hierarchy
Definition: refiner_interface.cpp:350
A load-balancer redistributes grids using the specified partitioner and process-hierarchy.
Definition: load_balancer.h:51
virtual void set_grid(MultiGrid *mg)
Definition: load_balancer.cpp:269
virtual void add_serializer(SPVertexDataSerializer cb)
add serialization callbacks.
Definition: load_balancer.h:135
static SPProcessHierarchy create()
Definition: process_hierarchy.h:57
static SPGridDataSerializer create(ISubsetHandler &sh)
Definition: serialization.h:314
size_t num_elements_on_level(size_t lvl) const
returns the global number of elements on the given level (excluding ghosts...)
Definition: domain.h:66
size_t num_levels() const
Definition: domain.h:64
function util LuaCallbackHelper create(func)
SmartPtr< ProcessHierarchy > SPProcessHierarchy
Definition: process_hierarchy.h:46
SPProcessHierarchy CreateProcessHierarchy(TDomain &dom, size_t minNumElemsPerProcPerLvl, size_t maxNumRedistProcs, size_t maxNumProcs, int minDistLvl, int maxLevelsWithoutRedist)
Creates a process-hierarchy that fullfills the given conditions.
Definition: domain_load_balancer.h:46