OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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 "oofemenv.h"
39#include "domaintype.h"
40#include "statecountertype.h"
41#include "parametermanager.h"
42#include "intarray.h"
43#include "error.h"
44#include "bctracker.h"
45#include "inputrecord.h"
46
47#ifdef __MPI_PARALLEL_MODE
49#endif
50
51#include <memory>
52#include <unordered_map>
53#include <map>
54#include <string>
55#include <list>
56
58
59#define _IFT_Domain_type "domain"
60#define _IFT_Domain_ndofman "ndofman"
61#define _IFT_Domain_nelem "nelem"
62#define _IFT_Domain_nmat "nmat"
63#define _IFT_Domain_ncrosssect "ncrosssect"
64#define _IFT_Domain_nbc "nbc"
65#define _IFT_Domain_nic "nic"
66#define _IFT_Domain_nfunct "nltf"
67#define _IFT_Domain_nset "nset"
68#define _IFT_Domain_nbarrier "nbarrier"
69#define _IFT_Domain_topology "topology"
70#define _IFT_Domain_nxfemman "nxfemman"
71#define _IFT_Domain_ncontactsurf "ncontactsurf"
72#define _IFT_Domain_numberOfSpatialDimensions "nsd"
73#define _IFT_Domain_nfracman "nfracman"
74#define _IFT_Domain_axisymmetric "axisymm"
76
77namespace oofem {
78class Element;
79class Node;
80class Material;
81class GeneralBoundaryCondition;
82class InitialCondition;
83class Load;
84class Function;
85class CrossSection;
86class ElementSide;
87class DofManager;
88class OutputManager;
89class EngngModel;
90class ConnectivityTable;
91class ErrorEstimator;
92class SpatialLocalizer;
93class NodalRecoveryModel;
94class NonlocalBarrier;
95class DomainTransactionManager;
96class XfemManager;
97class TopologyDescription;
98class DataReader;
99class Set;
100class ContactSurface;
101class FractureManager;
102class oofegGraphicContext;
103class ProcessCommunicator;
104
105
121{
122 public:
124 std :: vector< std :: unique_ptr< Element > > elementList;
126 std :: vector< std :: unique_ptr< DofManager > > dofManagerList;
128 std :: vector< std :: unique_ptr< CrossSection > > crossSectionList;
135
136private:
138 std :: vector< std :: unique_ptr< Material > > materialList;
140 std :: vector< std :: unique_ptr< GeneralBoundaryCondition > > bcList;
142 std :: vector< std :: unique_ptr< InitialCondition > > icList;
144 std :: vector< std :: unique_ptr< Function > > functionList;
146 std :: vector< std :: unique_ptr< Set > > setList;
148 std::vector< std::unique_ptr< ContactSurface > >contactSurfaceList;
150 std :: vector< std :: unique_ptr< NonlocalBarrier > > nonlocalBarrierList;
151
154
163
168
173 std :: unique_ptr< ConnectivityTable > connectivityTable;
178 std :: unique_ptr< SpatialLocalizer > spatialLocalizer;
180 std :: unique_ptr< OutputManager > outputManager;
186 int nsd;
189 std :: unique_ptr< NodalRecoveryModel > smoother;
190
191 std :: string mDomainType;
204 std :: unique_ptr< XfemManager > xfemManager;
205
207 std :: unique_ptr< FractureManager > fracManager;
208
209
210
213
218 // elementGlobal2LocalMap
219 std::unordered_map< int, int > elementGlobal2LocalMap;
220
225 std::unordered_map< int, int > dofmanGlobal2LocalMap;
226
231 std::unordered_map< int, IntArray> materialNum2ElMap;
232
234 std :: unique_ptr< TopologyDescription > topology;
235
236public:
239private:
240
241#ifdef __MPI_PARALLEL_MODE
246 std :: unique_ptr< DomainTransactionManager > transactionManager;
248 std :: map< int, DofManager * >dmanMap;
252 std :: map< int, Element * >elementMap;
255
256
259
260 std :: list< Element * >recvElemList;
262#endif
263
264public:
272 Domain(int n, int serNum, EngngModel * e);
273
274 Domain(const Domain& src) = delete;
275 Domain &operator = (const Domain &src) = delete;
276
278 ~Domain();
279
281 int giveNumber() { return this->number; }
283 void setNumber(int nn) { this->number = nn; }
285 int giveSerialNumber() { return this->serialNumber; }
286
287 // management of the mesh components
293 Element *giveElement(int n);
294 std :: vector< std :: unique_ptr< Element > > &giveElements() { return this->elementList; }
300 Element *giveGlobalElement(int n);
306 int giveElementPlaceInArray(int iGlobalElNum) const;
312 int giveDofManPlaceInArray(int iGlobalDofManNum) const;
317 const IntArray &giveElementsWithMaterialNum(int iMaterialNum) const;
318
324 ContactSurface *giveContactSurface(int n);
325 std::vector< std::unique_ptr< ContactSurface > > &giveContactSurface() { return this->contactSurfaceList; }
326
327
328
329
333 EngngModel *giveEngngModel();
334
335 void SetEngngModel(EngngModel *ipEngngModel) {engineeringModel = ipEngngModel;}
336
342 Load *giveLoad(int n);
348 GeneralBoundaryCondition *giveBc(int n);
349 std :: vector< std :: unique_ptr< GeneralBoundaryCondition > > &giveBcs() { return this->bcList; }
355 InitialCondition *giveIc(int n);
356 std :: vector< std :: unique_ptr< InitialCondition > > &giveIcs() { return this->icList; }
357
363 Function *giveFunction(int n);
364 std :: vector< std :: unique_ptr< Function > > &giveFunctions() { return this->functionList; }
370 Material *giveMaterial(int n);
371 std :: vector< std :: unique_ptr< Material > > &giveMaterials() { return this->materialList; }
377 CrossSection *giveCrossSection(int n);
378 std :: vector< std :: unique_ptr< CrossSection > > &giveCrossSections() { return this->crossSectionList; }
384 NonlocalBarrier *giveNonlocalBarrier(int n);
390 Set *giveSet(int n);
391 std :: vector< std :: unique_ptr< Set > > &giveSets() { return this->setList; }
398 inline Node *giveNode(int n)
399 {
400 #ifdef DEBUG
401 if ( n < 1 || n > (int)dofManagerList.size() ) {
402 OOFEM_ERROR("undefined dofManager (%d)", n);
403 }
404
405 Node *node = reinterpret_cast< Node * >( dofManagerList[n-1].get() );
406
407 return node;
408
409 #else
410 return reinterpret_cast< Node * >( dofManagerList[n-1].get() );
411 #endif
412 }
413
419 ElementSide *giveSide(int n);
426 DofManager *giveDofManager(int n);
427 std :: vector< std :: unique_ptr< DofManager > > &giveDofManagers() { return this->dofManagerList; }
433 DofManager *giveGlobalDofManager(int n);
446 int instanciateYourself(DataReader &dr);
447 int instanciateYourself(DataReader &dr, InputRecord& ir);
448 void initializeFinish();
453 void postInitialize();
459 void createDofs();
461 int giveNumberOfDofManagers() const { return (int)dofManagerList.size(); }
463 int giveNumberOfElements() const { return (int)elementList.size(); }
465 int giveNumberOfMaterialModels() const { return (int)materialList.size(); }
467 int giveNumberOfCrossSectionModels() const { return (int)crossSectionList.size(); }
469 int giveNumberOfBoundaryConditions() const { return (int)bcList.size(); }
471 int giveNumberOfInitialConditions() const { return (int)icList.size(); }
473 int giveNumberOfFunctions() const { return (int)functionList.size(); }
477 int giveNumberOfNonlocalBarriers() const { return (int)nonlocalBarrierList.size(); }
479 int giveNumberOfSets() const { return (int)setList.size(); }
481 int giveNumberOfContactSurfaces() const { return ( int ) contactSurfaceList.size(); }
482
484 int giveNumberOfSpatialDimensions();
486 bool isAxisymmetric();
491
492 void resizeDofManagers(int _newSize);
494 void resizeElements(int _newSize);
496 void resizeCrossSectionModels(int _newSize);
498 void resizeMaterials(int _newSize);
500 void resizeNonlocalBarriers(int _newSize);
502 void resizeBoundaryConditions(int _newSize);
504 void resizeInitialConditions(int _newSize);
506 void resizeFunctions(int _newSize);
508 void resizeSets(int _newSize);
510 void resizeContactSurfaces(int _newSize);
511
513
514 void py_setDofManager(int i, DofManager *obj);
515 void py_setElement(int i, Element *obj);
516 void py_setCrossSection(int i, CrossSection *obj);
517 void py_setMaterial(int i, Material *obj);
518 void py_setNonlocalBarrier(int i, NonlocalBarrier *obj);
519 void py_setBoundaryCondition(int i, GeneralBoundaryCondition *obj);
520 void py_setInitialCondition(int i, InitialCondition *obj);
521 void py_setFunction(int i, Function *obj);
522 void py_setSet(int i, Set *obj);
524
526 void setDofManager(int i, std::unique_ptr<DofManager> obj);
528 void setElement(int i, std::unique_ptr<Element> obj);
530 void setCrossSection(int i, std::unique_ptr<CrossSection> obj);
532 void setMaterial(int i, std::unique_ptr<Material> obj);
534 void setNonlocalBarrier(int i, std::unique_ptr<NonlocalBarrier> obj);
536 void setBoundaryCondition(int i, std::unique_ptr<GeneralBoundaryCondition> obj);
538 void setInitialCondition(int i, std::unique_ptr<InitialCondition> obj);
540 void setFunction(int i, std::unique_ptr<Function> obj);
542 void setSet(int i, std::unique_ptr<Set> obj);
543
545 void setXfemManager(std::unique_ptr<XfemManager> ipXfemManager);
546
547 XfemManager *giveXfemManager();
548 bool hasXfemManager();
549
550 FractureManager *giveFractureManager();
551 bool hasFractureManager();
552
553 BCTracker *giveBCTracker();
554
560 void setTopology(TopologyDescription *topo, bool destroyOld = true);
562 void clearBoundaryConditions();
564 void clearElements();
566 void clear();
568
581 void saveContext(DataStream &stream, ContextMode mode);
594 void restoreContext(DataStream &stream, ContextMode mode);
599 const IntArray &giveDefaultNodeDofIDArry();
603 void setDomainType(domainType _dType) { this->dType = _dType; }
610 int checkConsistency();
611
616 double giveArea();
621 double giveVolume();
626 double giveSize();
627
633 int giveNextFreeDofID(int increment = 1);
637 void resetFreeDofID();
641 int giveMaxDofID() { return this->freeDofID - 1; }
642
643 void setNextFreeDofID(int dofid){ this->freeDofID = dofid;}
644
648 ConnectivityTable *giveConnectivityTable();
652 SpatialLocalizer *giveSpatialLocalizer();
653
657 void setSpatialLocalizer(std::unique_ptr<SpatialLocalizer> sl);
661 OutputManager *giveOutputManager();
666 ErrorEstimator *giveErrorEstimator();
671 NodalRecoveryModel *giveSmoother();
675 TopologyDescription *giveTopology();
681 void setSmoother(NodalRecoveryModel *newSmoother, bool destroyOld = true);
682
683#ifdef __MPI_PARALLEL_MODE
691
694 DomainTransactionManager *giveTransactionManager();
704 int commitTransactions(DomainTransactionManager *tm);
705
709 void initGlobalDofManMap(bool forceinit = false);
710 void initGlobalElementMap(bool forceinit = false);
715 void renumberDofManagers();
716 void renumberDofManData(DomainTransactionManager *tm);
717 void renumberElements();
718 void renumberElementData(DomainTransactionManager *tm);
720 int LB_giveUpdatedLocalNumber(int oldnum, EntityRenumberingScheme scheme);
722 int LB_giveUpdatedGlobalNumber(int oldnum, EntityRenumberingScheme scheme);
724
725
728 int dofmanGlobal2Local(int _globnum);
729 int elementGlobal2Local(int _globnum);
731#endif
732
734 const char *giveClassName() const { return "Domain"; }
735
737 StateCounterType giveNonlocalUpdateStateCounter() { return this->nonlocalUpdateStateCounter; }
739 void setNonlocalUpdateStateCounter(StateCounterType val) { this->nonlocalUpdateStateCounter = val; }
740
741 void resolveDomainDofsDefaults(const char *);
742
743private:
745 std :: string errorInfo(const char *func) const;
746
747private:
752 void BuildElementPlaceInArrayMap();
753
758 void BuildDofManPlaceInArrayMap();
759
764 void BuildMaterialToElementMap();
765};
766} // end namespace oofem
767#endif // domain_h
Abstract base class for all contact surfaces.
std::unordered_map< int, IntArray > materialNum2ElMap
Definition domain.h:231
std ::vector< std ::unique_ptr< DofManager > > dofManagerList
Dof manager list.
Definition domain.h:126
std ::unique_ptr< ConnectivityTable > connectivityTable
Definition domain.h:173
IntArray defaultNodeDofIDArry
Default dofs for a node (depends on the domain type).
Definition domain.h:153
Domain(int n, int serNum, EngngModel *e)
Definition domain.C:97
int giveNumberOfBoundaryConditions() const
Returns number of boundary conditions in domain.
Definition domain.h:469
int number
Domain number.
Definition domain.h:182
int giveNumberOfMaterialModels() const
Returns number of material models in domain.
Definition domain.h:465
std::unordered_map< int, int > elementGlobal2LocalMap
Definition domain.h:219
std ::vector< std ::unique_ptr< Set > > setList
Set list.
Definition domain.h:146
std ::vector< std ::unique_ptr< InitialCondition > > icList
Initial condition list.
Definition domain.h:142
void SetEngngModel(EngngModel *ipEngngModel)
Definition domain.h:335
int giveNumberOfContactSurfaces() const
Returns number of contact surfaces.
Definition domain.h:481
int freeDofID
Keeps track of next free dof ID (for special Lagrange multipliers, XFEM and such).
Definition domain.h:238
std ::unique_ptr< OutputManager > outputManager
Output manager, allowing to filter the produced output.
Definition domain.h:180
std ::vector< std ::unique_ptr< Material > > & giveMaterials()
Definition domain.h:371
int giveNumberOfInitialConditions() const
Returns number of initial conditions in domain.
Definition domain.h:471
StateCounterType giveNonlocalUpdateStateCounter()
Returns the value of nonlocalUpdateStateCounter.
Definition domain.h:737
bool dmanMapInitialized
dmanMap init flag.
Definition domain.h:250
std ::unique_ptr< SpatialLocalizer > spatialLocalizer
Definition domain.h:178
int giveNumber()
Returns domain number.
Definition domain.h:281
std ::vector< std ::unique_ptr< NonlocalBarrier > > nonlocalBarrierList
Nonlocal barrier list.
Definition domain.h:150
std::unordered_map< int, int > dofmanGlobal2LocalMap
Definition domain.h:225
std::vector< std::unique_ptr< ContactSurface > > & giveContactSurface()
Definition domain.h:325
int giveNumberOfSets() const
Returns number of sets.
Definition domain.h:479
domainType dType
Definition domain.h:162
int giveNumberOfElements() const
Returns number of elements in domain.
Definition domain.h:463
int serialNumber
Domain serial (version) number. Used for domain version identification during Adaptive computations.
Definition domain.h:184
std ::vector< std ::unique_ptr< DofManager > > & giveDofManagers()
Definition domain.h:427
StateCounterType nonlocalUpdateStateCounter
Definition domain.h:202
std ::vector< std ::unique_ptr< Function > > & giveFunctions()
Definition domain.h:364
std ::vector< std ::unique_ptr< Set > > & giveSets()
Definition domain.h:391
std ::vector< std ::unique_ptr< GeneralBoundaryCondition > > bcList
Boundary condition list.
Definition domain.h:140
domainType giveDomainType()
Returns domain type.
Definition domain.h:601
bool elementMapInitialized
dmanMap init flag.
Definition domain.h:254
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition domain.h:461
std ::unique_ptr< NodalRecoveryModel > smoother
nodal recovery object associated to receiver.
Definition domain.h:189
std ::vector< std ::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
Definition domain.h:349
void setNonlocalUpdateStateCounter(StateCounterType val)
sets the value of nonlocalUpdateStateCounter
Definition domain.h:739
std ::unique_ptr< TopologyDescription > topology
Topology description.
Definition domain.h:234
Domain(const Domain &src)=delete
int nsd
Number of spatial dimensions.
Definition domain.h:186
Node * giveNode(int n)
Definition domain.h:398
int giveMaxDofID()
Definition domain.h:641
std ::vector< std ::unique_ptr< Element > > & giveElements()
Definition domain.h:294
std ::unique_ptr< FractureManager > fracManager
Fracture Manager.
Definition domain.h:207
std ::unique_ptr< DomainTransactionManager > transactionManager
Definition domain.h:246
void setDomainType(domainType _dType)
Sets domain type.
Definition domain.h:603
std ::vector< std ::unique_ptr< InitialCondition > > & giveIcs()
Definition domain.h:356
std::vector< std::unique_ptr< ContactSurface > > contactSurfaceList
Contact surface list.
Definition domain.h:148
void setNextFreeDofID(int dofid)
Definition domain.h:643
std ::vector< std ::unique_ptr< Element > > elementList
Element list.
Definition domain.h:124
std ::vector< std ::unique_ptr< CrossSection > > & giveCrossSections()
Definition domain.h:378
std ::list< Element * > recvElemList
List of received elements.
Definition domain.h:260
ParameterManager elementPPM
Definition domain.h:133
int giveSerialNumber()
Returns domain serial (version) number.
Definition domain.h:285
EngngModel * engineeringModel
Definition domain.h:167
int giveNumberOfRegions() const
Returns number of regions. Currently regions corresponds to cross section models.
Definition domain.h:475
bool axisymm
Definition domain.h:187
std ::unique_ptr< XfemManager > xfemManager
XFEM Manager.
Definition domain.h:204
std ::vector< std ::unique_ptr< CrossSection > > crossSectionList
Cross section list.
Definition domain.h:128
std ::map< int, Element * > elementMap
Global element map (index is global of man number).
Definition domain.h:252
std ::map< int, DofManager * > dmanMap
Global dof manager map (index is global of man number).
Definition domain.h:248
const char * giveClassName() const
Returns class name of the receiver.
Definition domain.h:734
int giveNumberOfCrossSectionModels() const
Returns number of cross section models in domain.
Definition domain.h:467
int giveNumberOfFunctions() const
Returns number of load time functions in domain.
Definition domain.h:473
ParameterManager dofmanPPM
Definition domain.h:134
std ::vector< std ::unique_ptr< Material > > materialList
Material list.
Definition domain.h:138
std ::vector< std ::unique_ptr< Function > > functionList
Load time function list.
Definition domain.h:144
void setNumber(int nn)
Returns domain number.
Definition domain.h:283
int giveNumberOfNonlocalBarriers() const
Returns number of nonlocal integration barriers.
Definition domain.h:477
std::string mDomainType
Definition domain.h:191
BCTracker bcTracker
BC tracker (keeps track of BCs applied wia sets to components).
Definition domain.h:212
#define OOFEM_ERROR(...)
Definition error.h:79
long ContextMode
Definition contextmode.h:43
std::string errorInfo(const char *func)
Definition error.C:47
long StateCounterType
StateCounterType type used to indicate solution state.
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011