Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
load_balancer_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3 * Author: Sebastian Reiter
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33#ifndef __H__UG__load_balancer_util__
34#define __H__UG__load_balancer_util__
35
36#include "partitioner.h"
38
39namespace ug{
40
43CreateProcessHierarchy(size_t* numElemsOnLvl, size_t numLvls,
44 size_t minNumElemsPerProcPerLvl, size_t maxNumRedistProcs,
45 size_t maxNumProcs, int minDistLvl,
46 int maxLvlsWithoutRedist);
47
48//
49//template <int dim>
50//class StdConnectionWeights : public ConnectionWeights<dim>{
51// public:
52// typedef ConnectionWeights<dim> base_class;
53// typedef typename base_class::elem_type elem_type;
54//
55// StdConnectionWeights() : m_wgt(1.0) {}
56// StdConnectionWeights(number wgt) : m_wgt(wgt) {}
57// virtual ~StdConnectionWeights() {}
58//
59// virtual void set_weight(number wgt) {m_wgt = wgt;}
60//
61// virtual void set_grid(MultiGrid*, Attachment<MathVector<dim> >) {}
62// virtual void refresh_weights(int) {}
63// virtual number get_weight(elem_type*, elem_type*) {return m_wgt;}
64//
65// private:
66// number m_wgt;
67//};
68
69
79 public:
81 m_wgt(1.0) {}
82
83 virtual ~StdBalanceWeights() {}
84
85 virtual void set_weight(number wgt) {m_wgt = wgt;}
86 virtual void refresh_weights(int) {}
87
88 virtual number get_weight(Vertex* e) {return m_wgt;}
89 virtual number get_weight(Edge* e) {return m_wgt;}
90 virtual number get_weight(Face* e) {return m_wgt;}
91 virtual number get_weight(Volume* e) {return m_wgt;}
92
93 private:
95};
96
97
99template <int dim>
101 public:
106
107 virtual void set_weight_factor(number weightFactor)
108 {
109 m_weightFactor = weightFactor;
110 }
111
112 virtual number weight_factor() const {return m_weightFactor;}
113
115 {
116 m_aaPos.access(*mg, aPos);
117 }
118
119 virtual void refresh_weights(int baseLevel) {}
120
121 virtual number get_weight(Vertex* e) {return 1;}
122 virtual number get_weight(Edge* e) {return get_weight_impl(e);}
123 virtual number get_weight(Face* e) {return get_weight_impl(e);}
124 virtual number get_weight(Volume* e) {return get_weight_impl(e);}
125
126 private:
130
132 return 1;
133 }
134
137
138};
139
140
141}// end of namespace
142
143#endif
The higher the volume, the higher the weight when anisotropic refinement is used.....
Definition load_balancer_util.h:100
Grid::VertexAttachmentAccessor< position_attachment_t > m_aaPos
Definition load_balancer_util.h:136
number get_weight_impl(elem_t *e)
Definition load_balancer_util.h:127
GeomObjBaseTypeByDim< dim >::base_obj_type elem_t
Definition load_balancer_util.h:103
virtual number get_weight(Edge *e)
Definition load_balancer_util.h:122
Attachment< MathVector< dim > > position_attachment_t
Definition load_balancer_util.h:102
number get_weight_impl(GridObject *e)
Definition load_balancer_util.h:131
virtual void set_grid(MultiGrid *mg, Attachment< MathVector< dim > > aPos)
Definition load_balancer_util.h:114
virtual ~AnisotropicBalanceWeights()
Definition load_balancer_util.h:105
number m_weightFactor
Definition load_balancer_util.h:135
virtual void set_weight_factor(number weightFactor)
Definition load_balancer_util.h:107
virtual number weight_factor() const
Definition load_balancer_util.h:112
virtual void refresh_weights(int baseLevel)
Definition load_balancer_util.h:119
virtual number get_weight(Face *e)
Definition load_balancer_util.h:123
virtual number get_weight(Vertex *e)
Definition load_balancer_util.h:121
AnisotropicBalanceWeights()
Definition load_balancer_util.h:104
virtual number get_weight(Volume *e)
Definition load_balancer_util.h:124
A generic specialization of IAttachment.
Definition attachment_pipe.h:263
Base-class for edges.
Definition grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition grid_base_objects.h:510
bool access(Grid &grid, TAttachment &a)
Definition grid.h:189
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition grid_base_objects.h:157
Definition partitioner.h:49
a mathematical Vector with N entries.
Definition math_vector.h:97
Definition multi_grid.h:72
Definition load_balancer_util.h:78
virtual number get_weight(Vertex *e)
Definition load_balancer_util.h:88
StdBalanceWeights()
Definition load_balancer_util.h:80
virtual number get_weight(Edge *e)
Definition load_balancer_util.h:89
virtual void set_weight(number wgt)
Definition load_balancer_util.h:85
virtual ~StdBalanceWeights()
Definition load_balancer_util.h:83
virtual void refresh_weights(int)
Definition load_balancer_util.h:86
number m_wgt
Definition load_balancer_util.h:94
virtual number get_weight(Volume *e)
Definition load_balancer_util.h:91
virtual number get_weight(Face *e)
Definition load_balancer_util.h:90
Base-class for all vertex-types.
Definition grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition grid_base_objects.h:754
number CalculateVolume(Volume *elem, TAAPos aaPos)
Calculates the volume of the given element.
Definition volume_calculation_impl.hpp:43
double number
Definition types.h:124
the ug namespace
SmartPtr< ProcessHierarchy > SPProcessHierarchy
Definition process_hierarchy.h:47
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
Definition grid_base_objects.h:980