OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
xfemmanager.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 xfemmanager_h
36 #define xfemmanager_h
37 
38 #include "oofemcfg.h"
39 #include "datareader.h"
40 #include "inputrecord.h"
41 #include "contextioresulttype.h"
42 #include "contextmode.h"
43 #include "enrichmentitem.h"
44 #include "enumitem.h"
45 #include "internalstatevaluetype.h"
46 
47 #include <unordered_map>
48 #include <list>
49 #include <vector>
50 #include <memory>
51 
53 
54 #define _IFT_XfemManager_Name "xfemmanager"
55 #define _IFT_XfemManager_numberOfEnrichmentItems "numberofenrichmentitems"
56 #define _IFT_XfemManager_numberOfNucleationCriteria "numberofnucleationcriteria"
57 #define _IFT_XfemManager_numberOfGpPerTri "numberofgppertri"
58 
60 #define _IFT_XfemManager_numberOfTriRefs "numberoftrirefs"
61 
62 #define _IFT_XfemManager_enrDofScaleFac "enrdofscalefac"
63 
64 #define _IFT_XfemManager_debugVTK "debugvtk"
65 #define _IFT_XfemManager_VTKExport "vtkexport"
66 #define _IFT_XfemManager_VTKExportFields "exportfields"
67 
68 
69 //#define ENABLE_XFEM_CPP11
70 
71 namespace oofem {
72 class Domain;
73 class EnrichmentItem;
74 class IntArray;
75 class Element;
76 class DataStream;
77 class DynamicInputRecord;
78 class NucleationCriterion;
79 //class InternalStateValueType;
80 
81 //
82 // The following types determine the state types associated with xfem
83 //
84 #define XFEMStateType_DEF \
85  ENUM_ITEM_WITH_VALUE(XFEMST_Undefined, 0) \
86  ENUM_ITEM_WITH_VALUE(XFEMST_Enrichment, 1) \
87  ENUM_ITEM_WITH_VALUE(XFEMST_LevelSetPhi, 2) \
88  ENUM_ITEM_WITH_VALUE(XFEMST_LevelSetGamma, 3) \
89  ENUM_ITEM_WITH_VALUE(XFEMST_NodeEnrMarker, 4) \
90  ENUM_ITEM_WITH_VALUE(XFEMST_NumIntersecPoints, 5)
91 
94 };
95 
96 #undef ENUM_ITEM
97 #undef ENUM_ITEM_WITH_VALUE
98 #undef enumitem_h
99 
100 const char *__XFEMStateTypeToString(XFEMStateType _value);
101 
109 class OOFEM_EXPORT XfemManager
110 {
111 protected:
114  std :: vector< std :: unique_ptr< EnrichmentItem > >enrichmentItemList;
115 
117 
119 
125 
130 
131  /* Scale factor for the enrichment dofs. Implies that the corresponding
132  dofs must be scaled with 1/factor in the input file
133  */
135 
137 
139  bool mDebugVTK;
140 
145  std :: vector< std :: vector< int > >mNodeEnrichmentItemIndices;
146  std :: unordered_map< int, std :: vector< int > >mElementEnrichmentItemIndices;
147 
152  std :: vector< int >mMaterialModifyingEnrItemIndices;
153 
157  std::vector< std :: unique_ptr< NucleationCriterion > > mNucleationCriteria;
158 
159  // IDs of all potential enriched dofs
161 
162 public:
163 
167  IntArray vtkExportFields; // make private later
168  InternalStateValueType giveXFEMStateValueType(XFEMStateType type);
169 
171  XfemManager(Domain *domain);
173  virtual ~XfemManager();
174  XfemManager(const XfemManager &) = delete;
175 
176  XfemManager &operator=(const XfemManager &) = delete;
177 
178  int giveNumGpPerTri() const { return mNumGpPerTri; }
179  int giveNumTriRefs() const { return mNumTriRef;}
180  double giveEnrDofScaleFactor() const {return mEnrDofScaleFac;}
181 
182  bool isElementEnriched(const Element *elem);
183 
184  inline EnrichmentItem *giveEnrichmentItem(int n) { return enrichmentItemList [ n - 1 ].get(); }
185  int giveNumberOfEnrichmentItems() const { return ( int ) enrichmentItemList.size(); }
186 
187  inline NucleationCriterion *giveNucleationCriterion(int n) { return mNucleationCriteria [ n - 1 ].get(); }
188  int giveNumberOfNucleationCriteria() const { return ( int ) mNucleationCriteria.size(); }
189 
190  void createEnrichedDofs();
191  const IntArray &giveEnrichedDofIDs() const {return mXFEMPotentialDofIDs;}
192  IntArray giveEnrichedDofIDs(const DofManager &iDMan) const;
193 
195  virtual IRResultType initializeFrom(InputRecord *ir);
196  virtual void giveInputRecord(DynamicInputRecord &input);
197 
198  virtual int instanciateYourself(DataReader &dr);
199  virtual const char *giveClassName() const { return "XfemManager"; }
200  virtual const char *giveInputRecordName() const { return _IFT_XfemManager_Name; }
201 
202  Domain *giveDomain() { return this->domain; }
203  void setDomain(Domain *ipDomain);
204 
213  contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
222  contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
223 
224 
228  virtual void updateYourself(TimeStep *tStep);
229 
230  virtual void propagateFronts(bool &oAnyFronHasPropagated);
231  void initiateFronts(bool &oAnyFronHasPropagated, TimeStep *tStep);
232  bool hasPropagatingFronts();
233  bool hasInitiationCriteria();
234 
236  void clearEnrichmentItems();
237 
238  void appendEnrichmentItems(std :: vector< std :: unique_ptr< EnrichmentItem > > &iEIlist);
239 
240  void nucleateEnrichmentItems(bool &oNewItemsWereNucleated);
241  bool hasNucleationCriteria();
242 
243  bool giveVtkDebug() const { return mDebugVTK; }
244  void setVtkDebug(bool iDebug) { mDebugVTK = iDebug; }
245 
246  void updateNodeEnrichmentItemMap();
247 
248  const std :: vector< int > &giveNodeEnrichmentItemIndices(int iNodeIndex) const { return mNodeEnrichmentItemIndices [ iNodeIndex - 1 ]; }
249  void giveElementEnrichmentItemIndices(std :: vector< int > &oElemEnrInd, int iElementIndex) const;
250 
251  const std :: vector< int > &giveMaterialModifyingEnrItemIndices() const { return mMaterialModifyingEnrItemIndices; }
252 };
253 } // end namespace oofem
254 #endif // xfemmanager_h
const std::vector< int > & giveMaterialModifyingEnrItemIndices() const
Definition: xfemmanager.h:251
std::vector< std::unique_ptr< NucleationCriterion > > mNucleationCriteria
Nucleation of new enrichment items.
Definition: xfemmanager.h:157
IntArray mXFEMPotentialDofIDs
Definition: xfemmanager.h:160
Abstract class representing entity, which is included in the FE model using one (or more) global func...
int giveNumGpPerTri() const
Definition: xfemmanager.h:178
Class and object Domain.
Definition: domain.h:115
int giveNumTriRefs() const
Number of Gauss points per sub-triangle in cut elements.
Definition: xfemmanager.h:179
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
std::vector< int > mMaterialModifyingEnrItemIndices
Keep track of enrichment items that may assign a different material to some Gauss points...
Definition: xfemmanager.h:152
const std::vector< int > & giveNodeEnrichmentItemIndices(int iNodeIndex) const
Definition: xfemmanager.h:248
Abstract base class for all finite elements.
Definition: element.h:145
InternalStateValueType
Determines the type of internal variable.
NucleationCriterion * giveNucleationCriterion(int n)
Definition: xfemmanager.h:187
Base class for dof managers.
Definition: dofmanager.h:113
Class representing the abstraction for input data source.
Definition: datareader.h:50
virtual const char * giveInputRecordName() const
Definition: xfemmanager.h:200
int mNumTriRef
The number of times a subtriangle should be refined.
Definition: xfemmanager.h:129
Class implementing an array of integers.
Definition: intarray.h:61
bool giveVtkDebug() const
Definition: xfemmanager.h:243
int giveNumberOfEnrichmentItems() const
Definition: xfemmanager.h:185
#define _IFT_XfemManager_Name
Definition: xfemmanager.h:54
std::vector< std::unique_ptr< EnrichmentItem > > enrichmentItemList
Enrichment item list.
Definition: xfemmanager.h:114
virtual const char * giveClassName() const
Definition: xfemmanager.h:199
int numberOfNucleationCriteria
Definition: xfemmanager.h:118
double giveEnrDofScaleFactor() const
Definition: xfemmanager.h:180
void setVtkDebug(bool iDebug)
Definition: xfemmanager.h:244
std::unordered_map< int, std::vector< int > > mElementEnrichmentItemIndices
Definition: xfemmanager.h:146
const char * __XFEMStateTypeToString(XFEMStateType _value)
Definition: cltypes.C:351
This class manages the xfem part.
Definition: xfemmanager.h:109
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
IntArray vtkExportFields
List with the fields that should be exported to VTK.
Definition: xfemmanager.h:167
int giveNumberOfNucleationCriteria() const
Definition: xfemmanager.h:188
Class representing the general Input Record.
Definition: inputrecord.h:101
XFEMStateType
Definition: xfemmanager.h:92
bool mDebugVTK
If extra debug vtk files should be written.
Definition: xfemmanager.h:139
Class representing the a dynamic Input Record.
EnrichmentItem * giveEnrichmentItem(int n)
Definition: xfemmanager.h:184
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
int mNumGpPerTri
The number of Gauss points to be used in each sub-triangle when subdividing cut elements.
Definition: xfemmanager.h:124
the oofem namespace is to define a context or scope in which all oofem names are defined.
const IntArray & giveEnrichedDofIDs() const
Definition: xfemmanager.h:191
Domain * giveDomain()
Definition: xfemmanager.h:202
std::vector< std::vector< int > > mNodeEnrichmentItemIndices
Let the XfemManager keep track of enrichment items enriching each node and each element, to allow more efficient computations.
Definition: xfemmanager.h:145
Class representing solution step.
Definition: timestep.h:80

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