OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
domain.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 domain_h
36 #define domain_h
37 
38 #include "oofemcfg.h"
39 #include "domaintype.h"
40 #include "statecountertype.h"
41 #include "intarray.h"
42 #include "error.h"
43 #include "bctracker.h"
44 #ifdef __PARALLEL_MODE
45  #include "entityrenumberingscheme.h"
46 #endif
47 
48 #include <memory>
49 #include <unordered_map>
50 #include <map>
51 #include <string>
52 #include <list>
53 
55 
56 #define _IFT_Domain_type "domain"
57 #define _IFT_Domain_ndofman "ndofman"
58 #define _IFT_Domain_nelem "nelem"
59 #define _IFT_Domain_nmat "nmat"
60 #define _IFT_Domain_ncrosssect "ncrosssect"
61 #define _IFT_Domain_nbc "nbc"
62 #define _IFT_Domain_nic "nic"
63 #define _IFT_Domain_nfunct "nltf"
64 #define _IFT_Domain_nset "nset"
65 #define _IFT_Domain_nbarrier "nbarrier"
66 #define _IFT_Domain_topology "topology"
67 #define _IFT_Domain_nxfemman "nxfemman"
68 #define _IFT_Domain_ncontactman "ncontactman"
69 #define _IFT_Domain_numberOfSpatialDimensions "nsd"
70 #define _IFT_Domain_nfracman "nfracman"
71 #define _IFT_Domain_axisymmetric "axisymm"
72 
73 
74 namespace oofem {
75 class Element;
76 class Node;
77 class Material;
78 class GeneralBoundaryCondition;
79 class InitialCondition;
80 class Load;
81 class Function;
82 class CrossSection;
83 class ElementSide;
84 class DofManager;
85 class OutputManager;
86 class EngngModel;
87 class ConnectivityTable;
88 class ErrorEstimator;
89 class SpatialLocalizer;
90 class NodalRecoveryModel;
91 class NonlocalBarrier;
92 class DomainTransactionManager;
93 class XfemManager;
94 class TopologyDescription;
95 class DataReader;
96 class Set;
97 class FractureManager;
98 class oofegGraphicContext;
99 class ProcessCommunicator;
100 class ContactManager;
115 class OOFEM_EXPORT Domain
116 {
117 private:
119  std :: vector< std :: unique_ptr< Element > > elementList;
121  std :: vector< std :: unique_ptr< DofManager > > dofManagerList;
123  std :: vector< std :: unique_ptr< Material > > materialList;
125  std :: vector< std :: unique_ptr< CrossSection > > crossSectionList;
127  std :: vector< std :: unique_ptr< GeneralBoundaryCondition > > bcList;
129  std :: vector< std :: unique_ptr< InitialCondition > > icList;
131  std :: vector< std :: unique_ptr< Function > > functionList;
133  std :: vector< std :: unique_ptr< Set > > setList;
135  std :: vector< std :: unique_ptr< NonlocalBarrier > > nonlocalBarrierList;
136 
139 
148 
153 
158  std :: unique_ptr< ConnectivityTable > connectivityTable;
163  std :: unique_ptr< SpatialLocalizer > spatialLocalizer;
165  std :: unique_ptr< OutputManager > outputManager;
167  int number;
171  int nsd;
172  bool axisymm;
174  std :: unique_ptr< NodalRecoveryModel > smoother;
175 
176  std :: string mDomainType;
189  std :: unique_ptr< XfemManager > xfemManager;
190 
192  std :: unique_ptr< FractureManager > fracManager;
193 
195  std :: unique_ptr< ContactManager > contactManager;
196 
199 
204  std::unordered_map< int, int > mElementPlaceInArray;
205 
210  std::unordered_map< int, int > mDofManPlaceInArray;
211 
216  std::unordered_map< int, IntArray> mMapMaterialNum2El;
217 
219  std :: unique_ptr< TopologyDescription > topology;
220 
221 public:
224 private:
225 
226 #ifdef __PARALLEL_MODE
227 
231  std :: unique_ptr< DomainTransactionManager > transactionManager;
233  std :: map< int, DofManager * >dmanMap;
237  std :: map< int, Element * >elementMap;
240 
241 
244  std :: list< Element * >recvElemList;
246 
247 #endif
248 
249 public:
257  Domain(int n, int serNum, EngngModel * e);
258 
259  Domain(const Domain& src) = delete;
260  Domain &operator = (const Domain &src) = delete;
261 
263  ~Domain();
264 
266  int giveNumber() { return this->number; }
268  void setNumber(int nn) { this->number = nn; }
270  int giveSerialNumber() { return this->serialNumber; }
271 
272  // management of the mesh components
278  Element *giveElement(int n);
279  std :: vector< std :: unique_ptr< Element > > &giveElements() { return this->elementList; }
285  Element *giveGlobalElement(int n);
291  int giveElementPlaceInArray(int iGlobalElNum) const;
297  int giveDofManPlaceInArray(int iGlobalDofManNum) const;
302  const IntArray &giveElementsWithMaterialNum(int iMaterialNum) const;
306  EngngModel *giveEngngModel();
307 
308  void SetEngngModel(EngngModel *ipEngngModel) {engineeringModel = ipEngngModel;}
309 
315  Load *giveLoad(int n);
321  GeneralBoundaryCondition *giveBc(int n);
322  std :: vector< std :: unique_ptr< GeneralBoundaryCondition > > &giveBcs() { return this->bcList; }
328  InitialCondition *giveIc(int n);
329  std :: vector< std :: unique_ptr< InitialCondition > > &giveIcs() { return this->icList; }
330 
336  Function *giveFunction(int n);
337  std :: vector< std :: unique_ptr< Function > > &giveFunctions() { return this->functionList; }
343  Material *giveMaterial(int n);
344  std :: vector< std :: unique_ptr< Material > > &giveMaterials() { return this->materialList; }
350  CrossSection *giveCrossSection(int n);
351  std :: vector< std :: unique_ptr< CrossSection > > &giveCrossSections() { return this->crossSectionList; }
357  NonlocalBarrier *giveNonlocalBarrier(int n);
363  Set *giveSet(int n);
364  std :: vector< std :: unique_ptr< Set > > &giveSets() { return this->setList; }
371  inline Node *giveNode(int n)
372  {
373  #ifdef DEBUG
374  if ( n < 1 || n > (int)dofManagerList.size() ) {
375  OOFEM_ERROR("undefined dofManager (%d)", n);
376  }
377 
378  Node *node = reinterpret_cast< Node * >( dofManagerList[n-1].get() );
379 
380  return node;
381 
382  #else
383  return reinterpret_cast< Node * >( dofManagerList[n-1].get() );
384  #endif
385  }
392  ElementSide *giveSide(int n);
399  DofManager *giveDofManager(int n);
400  std :: vector< std :: unique_ptr< DofManager > > &giveDofManagers() { return this->dofManagerList; }
406  DofManager *giveGlobalDofManager(int n);
419  int instanciateYourself(DataReader &dr);
424  void postInitialize();
430  void createDofs();
432  int giveNumberOfDofManagers() const { return (int)dofManagerList.size(); }
434  int giveNumberOfElements() const { return (int)elementList.size(); }
436  int giveNumberOfMaterialModels() const { return (int)materialList.size(); }
438  int giveNumberOfCrossSectionModels() const { return (int)crossSectionList.size(); }
440  int giveNumberOfBoundaryConditions() const { return (int)bcList.size(); }
442  int giveNumberOfInitialConditions() const { return (int)icList.size(); }
444  int giveNumberOfFunctions() const { return (int)functionList.size(); }
446  int giveNumberOfRegions() const { return this->giveNumberOfCrossSectionModels(); }
448  int giveNumberOfNonlocalBarriers() const { return (int)nonlocalBarrierList.size(); }
450  int giveNumberOfSets() const { return (int)setList.size(); }
451 
453  int giveNumberOfSpatialDimensions();
455  bool isAxisymmetric();
460  void resizeDofManagers(int _newSize);
463  void resizeElements(int _newSize);
465  void resizeCrossSectionModels(int _newSize);
467  void resizeMaterials(int _newSize);
469  void resizeNonlocalBarriers(int _newSize);
471  void resizeBoundaryConditions(int _newSize);
473  void resizeInitialConditions(int _newSize);
475  void resizeFunctions(int _newSize);
477  void resizeSets(int _newSize);
478 
480  void setDofManager(int i, DofManager *obj);
482  void setElement(int i, Element *obj);
484  void setCrossSection(int i, CrossSection *obj);
486  void setMaterial(int i, Material *obj);
488  void setNonlocalBarrier(int i, NonlocalBarrier *obj);
490  void setBoundaryCondition(int i, GeneralBoundaryCondition *obj);
492  void setInitialCondition(int i, InitialCondition *obj);
494  void setFunction(int i, Function *obj);
496  void setSet(int i, Set *obj);
497 
499  void setXfemManager(XfemManager *ipXfemManager);
500 
501  XfemManager *giveXfemManager();
502  bool hasXfemManager();
503 
504  ContactManager *giveContactManager();
505  bool hasContactManager();
506 
507  FractureManager *giveFractureManager();
508  bool hasFractureManager();
509 
510  BCTracker *giveBCTracker();
511 
517  void setTopology(TopologyDescription *topo, bool destroyOld = true);
519  void clearBoundaryConditions();
521  void clearElements();
523  void clear();
525 
539  contextIOResultType saveContext(DataStream &stream, ContextMode mode);
553  contextIOResultType restoreContext(DataStream &stream, ContextMode mode);
558  const IntArray &giveDefaultNodeDofIDArry();
560  domainType giveDomainType() { return dType; }
562  void setDomainType(domainType _dType) { this->dType = _dType; }
569  int checkConsistency();
570 
575  double giveArea();
580  double giveVolume();
585  double giveSize();
586 
592  int giveNextFreeDofID(int increment = 1);
596  void resetFreeDofID();
600  int giveMaxDofID() { return this->freeDofID - 1; }
601 
602  void setNextFreeDofID(int dofid){ this->freeDofID = dofid;}
603 
607  ConnectivityTable *giveConnectivityTable();
611  SpatialLocalizer *giveSpatialLocalizer();
615  OutputManager *giveOutputManager();
620  ErrorEstimator *giveErrorEstimator();
625  NodalRecoveryModel *giveSmoother();
629  TopologyDescription *giveTopology();
635  void setSmoother(NodalRecoveryModel *newSmoother, bool destroyOld = true);
636 
637 #ifdef __PARALLEL_MODE
638 
648  DomainTransactionManager *giveTransactionManager();
658  int commitTransactions(DomainTransactionManager *tm);
659 
663  void initGlobalDofManMap(bool forceinit = false);
664  void initGlobalElementMap(bool forceinit = false);
669  void renumberDofManagers();
670  void renumberDofManData(DomainTransactionManager *tm);
671  void renumberElements();
672  void renumberElementData(DomainTransactionManager *tm);
674  int LB_giveUpdatedLocalNumber(int oldnum, EntityRenumberingScheme scheme);
676  int LB_giveUpdatedGlobalNumber(int oldnum, EntityRenumberingScheme scheme);
678 
679 
682  int dofmanGlobal2Local(int _globnum);
683  int elementGlobal2Local(int _globnum);
685 #endif
686 
688  const char *giveClassName() const { return "Domain"; }
689 
691  StateCounterType giveNonlocalUpdateStateCounter() { return this->nonlocalUpdateStateCounter; }
693  void setNonlocalUpdateStateCounter(StateCounterType val) { this->nonlocalUpdateStateCounter = val; }
694 
695 private:
696  void resolveDomainDofsDefaults(const char *);
697 
699  std :: string errorInfo(const char *func) const;
700 
701 private:
706  void BuildElementPlaceInArrayMap();
707 
712  void BuildDofManPlaceInArrayMap();
713 
718  void BuildMaterialToElementMap();
719 };
720 } // end namespace oofem
721 #endif // domain_h
std::vector< std::unique_ptr< Function > > & giveFunctions()
Definition: domain.h:337
The base class for all spatial localizers.
void setNextFreeDofID(int dofid)
Definition: domain.h:602
This class keeps track of applied boundary conditions on individual entities.
Definition: bctracker.h:53
int giveNumberOfSets() const
Returns number of sets.
Definition: domain.h:450
std::vector< std::unique_ptr< GeneralBoundaryCondition > > bcList
Boundary condition list.
Definition: domain.h:127
Class and object Domain.
Definition: domain.h:115
Abstract base class for all nonlocal barriers.
int nsd
Number of spatial dimensions.
Definition: domain.h:171
Class implementing general initial condition.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition: domain.h:432
int giveNumberOfBoundaryConditions() const
Returns number of boundary conditions in domain.
Definition: domain.h:440
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
std::vector< std::unique_ptr< Set > > & giveSets()
Definition: domain.h:364
std::unique_ptr< SpatialLocalizer > spatialLocalizer
Spatial Localizer.
Definition: domain.h:163
long StateCounterType
StateCounterType type used to indicate solution state.
int giveNumberOfInitialConditions() const
Returns number of initial conditions in domain.
Definition: domain.h:442
std::unique_ptr< XfemManager > xfemManager
XFEM Manager.
Definition: domain.h:189
void setNonlocalUpdateStateCounter(StateCounterType val)
sets the value of nonlocalUpdateStateCounter
Definition: domain.h:693
std::unique_ptr< FractureManager > fracManager
Fracture Manager.
Definition: domain.h:192
const char * giveClassName() const
Returns class name of the receiver.
Definition: domain.h:688
Abstract base class for all finite elements.
Definition: element.h:145
std::vector< std::unique_ptr< Set > > setList
Set list.
Definition: domain.h:133
Base class for dof managers.
Definition: dofmanager.h:113
std::vector< std::unique_ptr< DofManager > > & giveDofManagers()
Definition: domain.h:400
This class manages the fracture mechanics part.
Represents output manager.
Definition: outputmanager.h:81
int giveNumber()
Returns domain number.
Definition: domain.h:266
Class representing the abstraction for input data source.
Definition: datareader.h:50
int giveNumberOfElements() const
Returns number of elements in domain.
Definition: domain.h:434
std::unique_ptr< NodalRecoveryModel > smoother
nodal recovery object associated to receiver.
Definition: domain.h:174
std::vector< std::unique_ptr< NonlocalBarrier > > nonlocalBarrierList
Nonlocal barrier list.
Definition: domain.h:135
domainType giveDomainType()
Returns domain type.
Definition: domain.h:560
Class implementing an array of integers.
Definition: intarray.h:61
IntArray defaultNodeDofIDArry
Default dofs for a node (depends on the domain type).
Definition: domain.h:138
Base abstract class representing cross section in finite element mesh.
Definition: crosssection.h:107
std::vector< std::unique_ptr< Material > > materialList
Material list.
Definition: domain.h:123
bool axisymm
Definition: domain.h:172
std::unique_ptr< TopologyDescription > topology
Topology description.
Definition: domain.h:219
std::unique_ptr< OutputManager > outputManager
Output manager, allowing to filter the produced output.
Definition: domain.h:165
std::map< int, DofManager * > dmanMap
Global dof manager map (index is global of man number).
Definition: domain.h:233
Class representing domain transaction manager.
std::vector< std::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
Definition: domain.h:322
EntityRenumberingScheme
Type allowing to specify the required renumbering scheme; One can have a renumbering scheme for dof m...
StateCounterType giveNonlocalUpdateStateCounter()
Returns the value of nonlocalUpdateStateCounter.
Definition: domain.h:691
std::vector< std::unique_ptr< Material > > & giveMaterials()
Definition: domain.h:344
#define OOFEM_ERROR(...)
Definition: error.h:61
void setDomainType(domainType _dType)
Sets domain type.
Definition: domain.h:562
std::vector< std::unique_ptr< DofManager > > dofManagerList
Dof manager list.
Definition: domain.h:121
Set of elements, boundaries, edges and/or nodes.
Definition: set.h:66
std::vector< std::unique_ptr< Function > > functionList
Load time function list.
Definition: domain.h:131
int giveNumberOfCrossSectionModels() const
Returns number of cross section models in domain.
Definition: domain.h:438
Class representing connectivity table.
int giveNumberOfMaterialModels() const
Returns number of material models in domain.
Definition: domain.h:436
std::unique_ptr< DomainTransactionManager > transactionManager
Transaction manager.
Definition: domain.h:231
std::vector< std::unique_ptr< InitialCondition > > & giveIcs()
Definition: domain.h:329
Abstract base class for all boundary conditions of problem.
Abstract base class for all material models.
Definition: material.h:95
bool elementMapInitialized
dmanMap init flag.
Definition: domain.h:239
BCTracker bcTracker
BC tracker (keeps track of BCs applied wia sets to components)
Definition: domain.h:198
int serialNumber
Domain serial (version) number. Used for domain version identification during Adaptive computations...
Definition: domain.h:169
This class manages all the contacts in a domain.
The base class for all error estimation or error indicator algorithms.
int number
Domain number.
Definition: domain.h:167
int giveSerialNumber()
Returns domain serial (version) number.
Definition: domain.h:270
std::vector< std::unique_ptr< CrossSection > > crossSectionList
Cross section list.
Definition: domain.h:125
Abstract base class representing a function with vector input and output.
Definition: function.h:88
This class manages the xfem part.
Definition: xfemmanager.h:109
std::vector< std::unique_ptr< Element > > elementList
Element list.
Definition: domain.h:119
std::unordered_map< int, int > mDofManPlaceInArray
Map from a dofmans&#39;s global number to its place in the dofman array.
Definition: domain.h:210
std::string mDomainType
Definition: domain.h:176
EngngModel * engineeringModel
Associated Engineering model.
Definition: domain.h:152
int giveNumberOfFunctions() const
Returns number of load time functions in domain.
Definition: domain.h:444
Class implementing element side having some DOFs in finite element mesh.
Definition: elementside.h:60
bool dmanMapInitialized
dmanMap init flag.
Definition: domain.h:235
std::unordered_map< int, int > mElementPlaceInArray
Map from an element&#39;s global number to its place in the element array.
Definition: domain.h:204
int giveNumberOfNonlocalBarriers() const
Returns number of nonlocal integration barriers.
Definition: domain.h:448
int giveMaxDofID()
Gives the current maximum dof ID used.
Definition: domain.h:600
Abstract class for topology description.
domainType dType
Domain type.
Definition: domain.h:147
int giveNumberOfRegions() const
Returns number of regions. Currently regions corresponds to cross section models. ...
Definition: domain.h:446
void setNumber(int nn)
Returns domain number.
Definition: domain.h:268
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
std::unique_ptr< ContactManager > contactManager
Contact Manager.
Definition: domain.h:195
std::string errorInfo(const char *func)
Definition: error.C:41
std::vector< std::unique_ptr< InitialCondition > > icList
Initial condition list.
Definition: domain.h:129
std::vector< std::unique_ptr< Element > > & giveElements()
Definition: domain.h:279
Load is base abstract class for all loads.
Definition: load.h:61
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
Node * giveNode(int n)
Service for accessing particular domain node.
Definition: domain.h:371
domainType
Definition: domaintype.h:72
the oofem namespace is to define a context or scope in which all oofem names are defined.
void SetEngngModel(EngngModel *ipEngngModel)
Definition: domain.h:308
StateCounterType nonlocalUpdateStateCounter
For nonlocal models of integral type it is necessary, mainly due to resulting efficiency, to compute variable(s) which are nonlocally averaged in advance, before average process begins.
Definition: domain.h:187
Class implementing node in finite element mesh.
Definition: node.h:87
The base class for all recovery models, which perform nodal averaging or projection processes for int...
std::unordered_map< int, IntArray > mMapMaterialNum2El
Map from material number to elements that have the given material number.
Definition: domain.h:216
std::unique_ptr< ConnectivityTable > connectivityTable
Domain connectivity table.
Definition: domain.h:158
int freeDofID
Keeps track of next free dof ID (for special Lagrange multipliers, XFEM and such) ...
Definition: domain.h:223
std::map< int, Element * > elementMap
Global element map (index is global of man number).
Definition: domain.h:237
std::vector< std::unique_ptr< CrossSection > > & giveCrossSections()
Definition: domain.h:351

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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011