Xfem
The Xfem Plugin
xfemEnrichedElementData.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_XFEM_ENRICHED_ELEMENTDATA_H_
25 #define _GEMA_XFEM_ENRICHED_ELEMENTDATA_H_
26 
27 #include <qglobal.h>
28 
29 #include <gmCell.h>
30 
32 class GmIntegrationRule;
33 class XfemSubElement;
34 class GmElementDof;
35 
38 {
39 public:
41 
42  virtual ~XfemEnrichedElementData();
43 
46 
48  int numRegularSubElements() const { return _nRegular; }
49 
51  int numFractureSubElements() const { return _subElements.size() - _nRegular; }
52 
54  int numElemInterInfo() const { return _elemInterInfo.size() ; }
55 
57  int numDofSet() const { return _dofSet.size(); }
58 
60  int numInteractingCraks() const { return _interactingCraks.size(); }
61 
63  int numSubCraks() const { return _subCrackInfo.size(); }
64 
66  int numNodalLevelSet() const { return _nodalLevelSet.size(); }
67 
69  int numGaussLevelSet() const { return _gaussLevelSet.size(); }
70 
72  int numNodedofSet() const { return _NodedofSet.size(); }
73 
75  int numGaussDofSet() const { return _gaussLevelSetInter.size(); }
76 
78  int numTopDofSet() const { return _TopLevelSetInter.size(); }
79 
81  int numBotDofSet() const { return _BottomLevelSetInter.size(); }
82 
83  // Return the number of Fracture segments info about hydraulic or Natural and Open or closed states
84  int numSubCrackState() const { return _subCrackState.size(); }
85 
86  // Return the number of Fracture segment info about reactivation of cracks
87  int numSubCrackReactivation() const { return _crackReactivation.size(); }
88 
89  // Return the number of edge nodes cut by crack front nodes
90  int numCrackFrontNodes() const { return _crackFront.size(); }
91 
92  // Return the number of nearest element to crack front nodes
93  int numNearestElem() const { return _nearestElem.size(); }
94 
99  XfemSubElement* subElement(int index) const { return _subElements.at(index); }
100 
104  XfemSubElement* fractureSubElement(int index) const { return _subElements.at(index + _nRegular); }
105 
107  GmElementDof* dofMap() { return _dofMap; }
108 
110  void setDofMap(GmElementDof* dofMap) { assert(!_dofMap); _dofMap = dofMap; }
111 
113  void clearDofMap(){ _dofMap = NULL; }
114 
115  // Add Element Intersection Information
116  void appendElemInterInfo(GmVector Cr, bool type = true);
117 
118  //Get Element Intersection information {Crack's id, first crack node, second crack node} at a specific position
119  void virtual getElemInterInfo(GmVector& A, int n) const;
120 
121  // Add Element Intersection Information
122  void appendSubCrackInfo(GmVector Cr, bool type = true);
123 
124  // Adds list with sub-crack paths
125  void insertSubCrackInfo(int path, GmVector A, GmVector B);
126 
127  //Get Element Intersection information {Crack's id, first crack node, second crack node} at a specific position
128  void virtual getSubCrackInfo(GmVector& A, int n) const;
129 
130  // Add DOF sets to be used per element
131  void appendDofSet(GmVector Cr, bool type = true);
132 
133  // Add DOF sets to be used for an node that has different DOF set compared to other nodes of the same element
134  void appendNodeDofSet(QList<GmVector> list, double n, bool type = true);
135 
136  // A list with Fracture segment info about hydraulic or Natural and Open or closed states
137  void appendSubCrackState(bool fracType, bool fracState, bool type = true);
138 
139  // A list with Fracture segment info about hydraulic or Natural and Open or closed states
140  void appendSubCrackReactivation(bool fracType, bool type = true);
141 
142  //Get DOF sets to be used per element at a specific position
143  void virtual getDofSet(GmVector& A, int n) const;
144 
145  // get DOF sets to be used for an node that has different DOF set compared to other nodes of the same element
146  void getNodeDofSet(QList<QPair<double, QList<GmVector>>>& list, int n)const;
147 
148  // get list with Fracture segment info about hydraulic or Natural and Open or closed states
149  void getSubCrackState(QList<QPair<bool, bool>>& list, int n) const;
150 
151  // get list with Fracture segment info about hydraulic or Natural and Open or closed states
152  void getSubCrackReactivation(bool& list, int n) const;
153 
154  //replace DOF sets to be used per element at a specific position
155  void virtual replaceDofSet(GmVector A, int n);
156 
157  // replace crack state pair in list of segment info about hydraulic or Natural and Open or closed states
158  void replaceSubCrackState(bool fracType, bool fracState, int index);
159 
160  // replace crack state pair in list of segment info about hydraulic or Natural and Open or closed states
161  void replaceSubCrackReactivation(bool fracType, int index);
162 
164  void deleteDofSet(){ _dofSet.clear(); }
165 
167  void deleteNodeDof(){ _NodedofSet.clear(); }
168 
169  // get list with Fracture segment info about hydraulic or Natural and Open or closed states
170  void deleteSubCrackState(){ _subCrackState.clear(); }
171 
172  // Add Element Intersection Information
173  void appendInteractingCraks(GmVector Cr, bool type = true);
174 
175  //Get Element Intersection information {Crack's id, first crack node, second crack node} at a specific position
176  void virtual getInteractingCraks(GmVector& A, int n) const;
177 
178  // Add list with information about the number of DOF per element
179  void appendnumAddDOF(int Cr, bool type = true);
180 
181  //Replace the number of DOF per element information at specific position on the list
182  void replaceNumAddDOF(int Cr, int index);
183 
184  //Get the number of additional DOF per element at a specific position
185  void virtual getnumAddDOF(int& A, int n) const;
186 
187  // delete Element Intersection Information
188  void deleteNumAddDOF(){ _numAddDOF.clear(); }
189 
190  // Add list with crack front nodes
191  void appendCrackFrontNodes(int Cr, int Cr2, bool type = true);
192 
193  // Replace crack front nodes at specific position on the list
194  void replaceCrackFrontNodes(int Cr, int Cr2, int index);
195 
196  // Get crack front nodes at a specific position
197  void virtual getCrackFrontNodes(QPair<int, int>& crack, int n) const;
198 
199  // delete list with edge nodes cut by crack front nodes
200  void deleteCrackFrontNodes(int id) { _crackFront.removeAt(id); }
201 
202  // Add list with enrichment functions for element nodes
203  void addNodalLevelSet(QList<QList<int>> nodalLevelSet);
204 
205  //Get the list with enrichment functions for element nodes
206  void virtual getNodalLevelSet(int n, QList<int>& nodalLevelSet) const;
207 
208  //Replace the list of nodalLevelSet
209  void replaceNodalLevelSet(int n, QList<int> nodalLevelSet);
210 
211  // delete Element Intersection Information
212  void deleteNodalLevelSet(){ _nodalLevelSet.clear(); }
213 
214  // Add list with crack front nodes and the nearest element to them
215  void addNearestElement(QList<int> nodalLevelSet);
216 
217  //Get the list with crack front nodes and the nearest element to them
218  void virtual getNearestElement(int n, QList<int>& nodalLevelSet) const;
219 
220  // Add list with enrichment functions for gauss points
221  void addGaussLevelSet(QList<int> gaussLevelSet);
222 
223  //Get the list with enrichment functions for gauss points
224  void virtual getGaussLevelSet(int n, QList<int>& gaussLevelSet) const;
225 
226  // delete Element Intersection Information
227  void deleteGaussLevelSet(){ _gaussLevelSet.clear(); }
228 
229  // Add list with enrichment functions for element nodes
230  void addTopLevelSet(QList<int> TopLevelSet);
231 
232  //Get the list with enrichment functions for element nodes
233  void virtual getTopLevelSet(int n, QList<int>& TopLevelSet) const;
234 
235  // delete Element Intersection Information
236  void deleteTopLevelSet(){ _TopLevelSet.clear(); }
237 
238  // Add list with enrichment functions for element nodes
239  void addBottomLevelSet(QList<int> BottomLevelSet);
240 
241  //Get the list with enrichment functions for element nodes
242  void virtual getBottomLevelSet(int n, QList<int>& BottomLevelSet) const;
243 
244  // delete Element Intersection Information
245  void deleteBottomLevelSet(){ _BottomLevelSet.clear(); }
246 
247  // Add list with enrichment functions for gauss points
248  void addGaussLevelSetInter(int n, QList<QList<int>> gaussLevelSetInter);
249 
250  //Get the list with enrichment functions for gauss points
251  void virtual getGaussLevelSetInter(int n, QPair<int, QList<QList<int>>>& gaussLevelSetInter) const;
252 
253  // delete Element Intersection Information
254  void deleteGaussLevelSetInter(){ _gaussLevelSetInter.clear(); }
255 
256  //Replace the list of gaussLevelSet
257  void replaceGaussLevelSetInter(int n, QPair<int, QList<QList<int>>> gaussLevelSetInter);
258 
259  // Add list with enrichment functions for element nodes
260  void addTopLevelSetInter(int n, QList<QList<int>> TopLevelSetInter);
261 
262  //Get the list with enrichment functions for element nodes
263  void virtual getTopLevelSetInter(int n, QPair<int, QList<QList<int>>>& TopLevelSetInter) const;
264 
265  // delete Element Intersection Information
266  void deleteTopLevelSetInter(){ _TopLevelSetInter.clear(); }
267 
268  //Replace the list of TopLevelSet
269  void replaceTopLevelSetInter(int n, QPair<int, QList<QList<int>>> TopLevelSetInter);
270 
271  // Add list with enrichment functions for element nodes
272  void addBottomLevelSetInter(int n, QList<QList<int>> BottomLevelSetInter);
273 
274  //Get the list with enrichment functions for element nodes
275  void virtual getBottomLevelSetInter(int n, QPair<int, QList<QList<int>>>& BottomLevelSetInter) const;
276 
277  // delete Element Intersection Information
278  void deleteBottomLevelSetInter(){ _BottomLevelSetInter.clear(); }
279 
280  //Replace the list of TopLevelSet
281  void replaceBottomLevelSetInter(int n, QPair<int, QList<QList<int>>> BottomLevelSetInter);
282 
283 #if defined ENABLE_TESTS
284  void validateInternalStructure();
285 #endif
286 
287 private:
288  Q_DISABLE_COPY(XfemEnrichedElementData)
289 
290  // IMPORTANT: Functions used for adding / removing subelements are marked private since
291  // they should not be called directly. Their conuterparts in the XfemMesh
292  // interface should be used instead since they can adjust other values
293  // needed for maintaining mesh consistency when adding subelements.
294  friend class XfemMesh;
295 
296  void clearSubElements();
297  int addSubElement (GmCellType type, XfemSubElement* se, const GmIntegrationRule* seIr);
298  void removeSubElement(int index);
299  void updateSubElement(GmCellType type, XfemSubElement* se, const GmIntegrationRule* seIr, const GmMatrix& seNaturalCoords);
300 
301 
302  XfemIntegrationRule* _ir; // Enriched element private integration rule for regular (non fracture) sub elements
303  QList<XfemSubElement*> _subElements; // A list with subelements from this element. Regular (non fracture) sub elements come first in the list.
304  int _nRegular; // The number of "regular (or non fracture) sub-elements. Those are the first sub-elements in _subElements.
305  GmElementDof* _dofMap; // The element dof mapping
306  QList<GmVector> _elemInterInfo; // A list with information about id of intersected fractures and crack nodes contained in a element {Crack's id, first crack node, second crack node}
307  QList<GmVector> _subCrackInfo; // A list with information about id of intersected fractures and crack nodes contained in a element {Crack's id, first crack node, second crack node}
308  QList<GmVector> _interactingCraks; // A list with information abaout strong and weak crack and location of the weak crack regarding the strong one for level set computation
309  QList<int> _numAddDOF; // A list with the number of additional DOF per element
310  QList<GmVector> _dofSet; // A list with DOF sets to be used per element {Crack's id, DOF}
311  QList<QPair<double, QList<GmVector>>> _NodedofSet; // A list with node id and list with specific dof list different to the other nodes of the same element
312  QList<QList<int>> _nodalLevelSet; // A list with enrichment functions for element nodes
313  QList<QList<int>> _gaussLevelSet; // A list with enrichment functions for element gauss points
314  QList<QList<int>> _TopLevelSet; // A list with enrichment functions for element nodes
315  QList<QList<int>> _BottomLevelSet; // A list with enrichment functions for element gauss points
316  QList<QPair<int, QList<QList<int>>>> _gaussLevelSetInter; // A list with enrichment functions for element gauss points when this element is neighborn to a crack intersection
317  QList<QPair<int, QList<QList<int>>>> _TopLevelSetInter; // A list with enrichment functions for element nodes when this element is neighborn to a crack intersection
318  QList<QPair<int, QList<QList<int>>>> _BottomLevelSetInter; // A list with enrichment functions for element gauss points when this element is neighborn to a crack intersection
319  QList<QPair<bool, bool>> _subCrackState; // A list with Fracture segment info about hydraulic or Natural and Open or closed states
320  bool _changeCrackState; // Boolean to define when to evaluate a change in fracture state from close to open
321  QList<bool> _crackReactivation; // Boolean to define when to evaluate a change in fracture state from close to open
322  QList<QPair<int, int>> _crackFront; // A list with edge nodes cut by a crack front node
323  QList<QList<int>> _nearestElem; // A list with crack front nodes and the nearest element to them
324 };
325 
326 #endif
327 
void clear()
int numNodedofSet() const
Return the number of nodes with specific DOF sets compared to other nodes of the same element.
Definition: xfemEnrichedElementData.h:72
GmElementDof * dofMap()
Return the map with element nodes + ghost nodes dofs.
Definition: xfemEnrichedElementData.h:107
int addSubElement(GmCellType type, XfemSubElement *se, const GmIntegrationRule *seIr)
Adds the given sub-element to this element, adjusting the set of element integration points (for regu...
Definition: xfemEnrichedElementData.cpp:107
int numSubCraks() const
Return the number of this element Intersection nodes with other cracks.
Definition: xfemEnrichedElementData.h:63
int numDofSet() const
Return the number of this element Intersection data.
Definition: xfemEnrichedElementData.h:57
void clearSubElements()
Removes all sub elements along with all their integration points.
Definition: xfemEnrichedElementData.cpp:70
int numBotDofSet() const
Return the number of nodes with specific DOF sets compared to other integration points of the same el...
Definition: xfemEnrichedElementData.h:81
const T & at(int i) const const
void removeAt(int i)
int numNodalLevelSet() const
Return the number of this element enrichment functions for nodes.
Definition: xfemEnrichedElementData.h:66
XfemSubElement * subElement(int index) const
Return a pointer to the given sub-element. Valid indices are from 0 to numRegularSubElements() + numF...
Definition: xfemEnrichedElementData.h:99
void clearDofMap()
clear dof map of enriched elements changed later due to intersection with another crack
Definition: xfemEnrichedElementData.h:113
void updateSubElement(GmCellType type, XfemSubElement *se, const GmIntegrationRule *seIr, const GmMatrix &seNaturalCoords)
Updates the given sub-element node coordinates, adjusting the position of the relevant element integr...
Definition: xfemEnrichedElementData.cpp:206
int size() const const
int numRegularSubElements() const
Return the number of regular (non fracture) sub-elements of this element.
Definition: xfemEnrichedElementData.h:48
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition: xfemMesh.h:49
int numElemInterInfo() const
Return the number of this element Intersection data.
Definition: xfemEnrichedElementData.h:54
virtual ~XfemEnrichedElementData()
Destructor.
Definition: xfemEnrichedElementData.cpp:60
A special integration rule for handling refined xfem elements.
Definition: xfemIntegrationRule.h:37
int numTopDofSet() const
Return the number of nodes with specific DOF sets compared to other integration points of the same el...
Definition: xfemEnrichedElementData.h:78
int numFractureSubElements() const
Return the number of fracture sub-elements of this element.
Definition: xfemEnrichedElementData.h:51
A class used to represent an enriched element subelement, defining an integration region inside the e...
Definition: xfemSubElement.h:38
int numInteractingCraks() const
Return the number of this element Intersection nodes with other cracks.
Definition: xfemEnrichedElementData.h:60
GmCellType
int numGaussLevelSet() const
Return the number of this element enrichment functions for gauss points.
Definition: xfemEnrichedElementData.h:69
XfemSubElement * fractureSubElement(int index) const
Return a fracture sub-element with an indexing starting from zero for the first fracture sub-element....
Definition: xfemEnrichedElementData.h:104
XfemEnrichedElementData(XfemIntegrationRule *ir)
Constructor.
Definition: xfemEnrichedElementData.cpp:47
void setDofMap(GmElementDof *dofMap)
Set the dof map for this enriched element. Should be called once. Takes ownership of the map.
Definition: xfemEnrichedElementData.h:110
XfemIntegrationRule * regularIntegrationRule() const
Return the integration rule tied to this enriched element for integration over regular (non fracture)...
Definition: xfemEnrichedElementData.h:45
void deleteDofSet()
delete element DOF information
Definition: xfemEnrichedElementData.h:164
arma::vec GmVector
A class used to store per element data needed only in enriched elements.
Definition: xfemEnrichedElementData.h:37
arma::mat GmMatrix
void deleteNodeDof()
delete specific node DOF information
Definition: xfemEnrichedElementData.h:167
void removeSubElement(int index)
Removes the given sub-element from this element, adjusting the set of element integration points.
Definition: xfemEnrichedElementData.cpp:155
int numGaussDofSet() const
Return the number of nodes with specific DOF sets compared to other integration points of the same el...
Definition: xfemEnrichedElementData.h:75