OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
loadbalancer.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #ifndef loadbalancer_h
36 #define loadbalancer_h
37 
38 #include "oofemcfg.h"
39 #include "inputrecord.h"
40 #include "floatarray.h"
41 
42 #include <vector>
43 #include <memory>
44 
46 
47 #define _IFT_LoadBalancer_wtp "wtp"
48 #define _IFT_LoadBalancerMonitor_nodeWeightMode "nodeweightmode"
49 #define _IFT_LoadBalancerMonitor_initialnodeweights "nw"
50 
51 
52 namespace oofem {
53 class Domain;
54 class EngngModel;
55 class ProcessCommunicator;
56 class TimeStep;
57 class IntArray;
58 
59  #define MIGRATE_LOAD_TAG 9998
60 
68 class OOFEM_EXPORT LoadBalancerMonitor
69 {
70 protected:
74 public:
75  enum LoadBalancerDecisionType { LBD_CONTINUE, LBD_RECOVER };
76 
77  LoadBalancerMonitor(EngngModel * em): emodel(em) { }
78  virtual ~LoadBalancerMonitor() { }
79 
81  virtual IRResultType initializeFrom(InputRecord *ir);
82 
85  virtual LoadBalancerDecisionType decide(TimeStep *) = 0;
88  const FloatArray & giveProcessorWeights() { return nodeWeights; }
90 
92  virtual const char *giveClassName() const = 0;
93 };
94 
95 
108 class OOFEM_EXPORT LoadBalancer
109 {
110 public:
115  enum DofManMode {
120  };
121 protected:
123 
124 public:
125 
126  LoadBalancer(Domain * d);
127  virtual ~LoadBalancer() { }
128 
129 
130 
133  virtual void calculateLoadTransfer() = 0;
135 
138  void migrateLoad(Domain *d);
140 
142  virtual void printStatistics() const;
143 
146  virtual DofManMode giveDofManState(int idofman) = 0;
148 
150  virtual IntArray *giveDofManPartitions(int idofman) = 0;
151 
153  virtual int giveElementPartition(int ielem) = 0;
154 
156  virtual IRResultType initializeFrom(InputRecord *ir);
158 
160  Domain *giveDomain() { return domain; }
162  virtual void setDomain(Domain *d) { this->domain = d; }
164  virtual const char *giveClassName() const = 0;
165 
166 protected:
167 
168  int packMigratingData(Domain *, ProcessCommunicator &pc);
169  int unpackMigratingData(Domain *, ProcessCommunicator &pc);
170  void deleteRemoteDofManagers(Domain *);
171  void deleteRemoteElements(Domain *);
172  void initializeWtp(IntArray &wtp);
173 
174 public:
175 
177  {
178 protected:
180 public:
182  virtual ~WorkTransferPlugin();
183 
190  virtual void init(Domain *d) = 0;
205  virtual void migrate() = 0;
211  virtual void update() = 0;
212  };
213 
214 protected:
216  std :: vector< std :: unique_ptr< WorkTransferPlugin > >wtpList;
217 };
218 
219 /*
220 class OOFEM_EXPORT LoadBalancerElementInterface : public Interface
221 {
222 public:
223  LoadBalancerElementInterface() { }
224 
225  virtual double predictRelativeComputationalCost();
226 };
227 */
228 } // end namespace oofem
229 
230 #endif // loadbalancer_h
DofManMode
Describes the state of dofmanager after load balancing on the local partition.
Definition: loadbalancer.h:115
Class and object Domain.
Definition: domain.h:115
Shared dofman that remains shared.
Definition: loadbalancer.h:118
Undefined (undetermined) state, if assigned means internal error.
Definition: loadbalancer.h:116
Class implementing an array of integers.
Definition: intarray.h:61
Local dofman that became remote (became local on remote partition).
Definition: loadbalancer.h:119
const FloatArray & giveProcessorWeights()
Returns processor weights; the larger weight means more powerful node, sum of weights should equal to...
Definition: loadbalancer.h:88
Local dofman that remains local.
Definition: loadbalancer.h:117
std::vector< std::unique_ptr< WorkTransferPlugin > > wtpList
List of work transfer plugins.
Definition: loadbalancer.h:216
Class representing process communicator for engineering model.
Definition: processcomm.h:176
Abstract base class representing general load balancer.
Definition: loadbalancer.h:108
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual ~LoadBalancer()
Definition: loadbalancer.h:127
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual void setDomain(Domain *d)
sets associated Domain
Definition: loadbalancer.h:162
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
Domain * giveDomain()
Returns reference to its domain.
Definition: loadbalancer.h:160
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class representing solution step.
Definition: timestep.h:80
Abstract base class representing general load balancer monitor.
Definition: loadbalancer.h:68
LoadBalancerMonitor(EngngModel *em)
Definition: loadbalancer.h:77

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:29 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011