Xfem
The Xfem Plugin
xfemFracture.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 
25 #ifndef _GEMA_XFEM_FRACTURE_H_
26 #define _GEMA_XFEM_FRACTURE_H_
27 
28 #include <assert.h>
29 #include <QList>
30 #include "gmVector.h"
31 #include <gmMatrixUtils.h>
32 
35 {
36 public:
37  XfemFracture(int npoints, int ndim, double* coordinates, const QString& fracType = QString("HydraFrac"), const QString& fracState = QString("Open"));
38 
39  virtual ~XfemFracture();
40 
41  XfemFracture(const XfemFracture& other)
42  {
43  _npoints = other._npoints;
44  _ndim = other._ndim;
46  _headIp = other._headIp;
47  _tailIp = other._tailIp;
48  _crackPath = other._crackPath;
50  _elemCutPos = other._elemCutPos;
52  _changedElem = other._changedElem;
54  _head = other._head;
55  _tail = other._tail;
56  _headProp = other._headProp;
57  _tailProp = other._tailProp;
59  _fracType = other._fracType;
60  _fracState = other._fracState;
61  _coordinates = new double[_npoints*_ndim];
62  memcpy(_coordinates, other._coordinates, _npoints*_ndim*sizeof(double));
63  }
64 
66  int numPoints() const { return _npoints; }
68  int numCrackPoints() const { return _npointsCrack; }
70  int numCrackPaths() const { return _crackPath.size(); }
72  int numSubCrackPaths() const { return _subCrackPath.size(); }
74  int numElemCutPos() const { return _elemCutPos.size(); }
76  int numSubElemCutPos() const { return _subElemCutPos.size(); }
78  int numElemHeadIp() const { return _headIp.size(); }
80  int numElemTailIp() const { return _tailIp.size(); }
82  int numChangedElem() const { return _changedElem.size(); }
84  int numfrontNodeBool() const { return _frontNodeBool.size(); }
86  int numfrontNodeProp() const { return _frontNodeProp.size(); }
88  int pointDimension() const { return _ndim; }
90  void fixedHead() { _head = false; _headProp = false; } // verificar depois
92  bool checkHeadStatus() const { return _head; }
94  void fixedTail() { _tail = false; _tailProp = false; } // verificar depois
96  bool checkTailStatus() const { return _tail; }
98  void headProp(bool setHead=true) { _headProp = setHead; }
100  bool checkHeadProp() const { return _headProp; }
102  void tailProp(bool setTail=true) { _tailProp = setTail; }
104  bool checkTailProp() const { return _tailProp; }
106  QString checkFracType() const { return _fracType; }
108  QString checkFracState() const { return _fracState; }
112  void changeCrackDOFset() { _changedCrack = true; }
114  bool checkCrackDOFset() const { return _changedCrack; }
115 
120  const double* coordinates(int index) const { assert(index >= 0 && index < _npoints); return _coordinates + index * _ndim; }
121  // add crack coordinates
122  void appendCrackCoordinates(QList<GmVector> B, bool type = true);
123  // add crack coordinates
124  void insertCrackCoordinates(GmVector C, int index);
125  // replace crack coordinates
126  void replaceCrackCoordinates(GmVector B, int index);
127  // split crack coordinates
128  void splitCrackCoordinates(int index2, int index, bool type = true);
129  // get crack coordiantes
130  void virtual getCrackCoodinates(GmVector& S1, int n) const;
131  // Add crack path
132  void appendCrackPath(GmVector Cr, bool type = true);
133  // Add a point to a crack path, splitting it in two
134  void splitCrackPath(int path, int node);
135  // Add list with sub-crack paths
136  void insertSubCrackPath(int path, GmVector A, GmVector B);
137  // Get sub-crack path data
138  void virtual getCrackPath(GmVector& A, int n) const;
139  // Add sub-crack path
140  void appendSubCrackPath(GmVector Cr, bool type = true);
141  // Get sub-crack path data
142  void virtual getSubCrackPath(GmVector& A, int n) const;
143  // Add Changed Elements
144  void appendChangedElem(QList<int> n);
145  // Get Changed Elements
146  void virtual getChangedElem(QList<int>& data) const;
147  // Clear changed element list
148  void clearChangedElem() { _changedElem.clear(); }
149  // Add crack front nodes
150  void appendCrackFrontNodes(QList<QList<int>> n);
151  // Get crack front nodes
152  void virtual getCrackFrontNodes(QList<QList<int>>& data) const;
153  //Replace crack front node list at a specific location
154  void replaceCrackFrontNodes(QList<int> n, int index);
155  // Clear crack front nodes
156  void clearCrackFrontNodes() { _crackFront.clear(); }
157  // Add Integration Points belonging to the region around crack front
158  void appendCrackFrontIp(QList<QList<QPair<int, QList<QList<int>>>>> crackFrontSeglist);
159  // Get crack front ip
160  void virtual getCrackFrontIp(QList<QList<QPair<int, QList<QList<int>>>>>& crackFrontSeglist) const;
161  // Clear crack front ip
162  void clearCrackFrontIp() { _crackFrontSeglist.clear(); }
163  // Add crack front node booleans
164  void appendFrontNodeBool(QPair<int, bool> n);
165  // Get crack front node booleans
166  void virtual getFrontNodeBool(int n, QPair<int, bool>& data) const;
167  //Replace crack front node booleans at a specific location
168  void replaceFrontNodeBool(int n, QPair<int, bool> data);
169  // Clear crack front node booleans
170  void clearFrontNodeBool() { _frontNodeBool.clear(); }
171  // Add crack front node propagation
172  void appendFrontNodeProp(QPair<int, bool> n);
173  // Get crack front node propagation
174  void virtual getFrontNodeProp(int n, QPair<int, bool>& data) const;
175  //Replace crack front node booleans at a specific location
176  void replaceFrontNodeProp(int n, QPair<int, bool> data);
177  // Clear crack front node propagation
178  void clearFrontNodeProp() { _frontNodeProp.clear(); }
179  // Add ip head info
180  void setHeadIp(QList<GmVector> B);
181  // Get head ip data
182  void virtual getHeadIp(GmVector& A, int n) const;
183  // Clear head ip list
184  void clearHeadIp() { _headIp.clear(); }
185  // Add ip tail info
186  void setTailIp(QList<GmVector> B);
187  // Get tailip data
188  void virtual getTailIp(GmVector& A, int n) const;
189  // Clear tail ip list
190  void clearTailIp() { _tailIp.clear(); }
191  // Add element cut information
192  void appendElemCutPos(GmVector cut, bool type = true);
193  // Add a point to a element cut information, splitting it in two
194  void splitElemCutPos(int path, int edge);
195  // Get element cut information
196  void virtual getElemCutPos(GmVector& S1, int n) const;
197  // Add subelement cut information
198  void appendSubElemCutPos(GmVector cut, bool type = true);
199  // Get subelement cut information
200  void virtual getSubElemCutPos(GmVector& S1, int n) const;
201  // Add list with subelement cut information
202  void insertSubElemCutPos(int path, GmVector A, GmVector B);
203 
204 private:
205  int _npoints;
206  int _ndim;
216  double* _coordinates;
218  bool _head;
219  bool _tail;
220  bool _headProp;
221  bool _tailProp;
223  QString _fracType; // Strhig to define if this fracture is a Hydraulic or a natural one
224  QString _fracState; // Strhig to define if this fracture is open or closed
227  QList<QPair<int, bool>> _frontNodeBool;//Crack front node list (TRUE defines that it's available to propagate)
228  QList<QPair<int, bool>> _frontNodeProp;//Crack front node list (TRUE defines that it has to propagate)
229 };
230 
231 #endif
bool checkHeadStatus() const
Check Head activation status.
Definition: xfemFracture.h:92
void clear()
bool _head
head of the fracture(TRUE defines that it's available to propagate)
Definition: xfemFracture.h:218
int numfrontNodeProp() const
Return the number of crack front node that will propagate.
Definition: xfemFracture.h:86
bool _tailProp
tail of the fracture(TRUE defines that it's going to propagate)
Definition: xfemFracture.h:221
bool checkTailStatus() const
Check tail activation status.
Definition: xfemFracture.h:96
void tailProp(bool setTail=true)
Set true the propagation of tail tip.
Definition: xfemFracture.h:102
bool _headProp
head of the fracture(TRUE defines that it's going to propagate)
Definition: xfemFracture.h:220
QList< GmVector > _crackPath
Vector with information about crak path {elem, ghostNode1, ghostNode2}.
Definition: xfemFracture.h:210
int numChangedElem() const
Return the number of changed elements.
Definition: xfemFracture.h:82
int numSubElemCutPos() const
Return the number of subelemCutPos vector.
Definition: xfemFracture.h:76
int _npoints
Number of points in the fracture definition.
Definition: xfemFracture.h:205
int numElemCutPos() const
Return the number of elemCutPos vector.
Definition: xfemFracture.h:74
int pointDimension() const
Returns the dimension of each fracture point. Equal to the mesh dimension.
Definition: xfemFracture.h:88
int _ndim
The dimension of each coordinate.
Definition: xfemFracture.h:206
int numElemHeadIp() const
Return the number of elements in headIp.
Definition: xfemFracture.h:78
int size() const const
QList< GmVector > _tailIp
Vector with information about tail ip index {elem, ipIndex1, ipIndex2,..}.
Definition: xfemFracture.h:209
QList< GmVector > _elemCutPos
Vector with information about fracture position {elem, side1, side2}.
Definition: xfemFracture.h:212
double * _coordinates
Coordinate vector. Size = _ndim * _npoints. Values stored by point.
Definition: xfemFracture.h:216
QList< QList< QPair< int, QList< QList< int > > > > > _crackFrontSeglist
list of IP and Element id for the crack front node to the fracture object
Definition: xfemFracture.h:226
XfemFracture(const XfemFracture &other)
Definition: xfemFracture.h:41
bool checkTailProp() const
Check tail Propagation status.
Definition: xfemFracture.h:104
void fixedHead()
Set false the activation of head tip.
Definition: xfemFracture.h:90
int numCrackPaths() const
Return the number of crack paths.
Definition: xfemFracture.h:70
A simple class to represent a natural fracture.
Definition: xfemFracture.h:34
bool _changedCrack
Crack DOF set must be changed as this fracture intersect other one or coexist in the same element wit...
Definition: xfemFracture.h:222
int numElemTailIp() const
Return the number of elements in tailIp.
Definition: xfemFracture.h:80
QList< GmVector > _subCrackPath
Vector with information about crak path {elem, ghostNode1, ghostNode2} for results visualization.
Definition: xfemFracture.h:211
QList< GmVector > _headIp
Vector with information about head ip index {elem, ipIndex1, ipIndex2,..}.
Definition: xfemFracture.h:208
const double * coordinates(int index) const
Returns a vector with the given point coordinates. The vector size is equal to the mesh dimension....
Definition: xfemFracture.h:120
void headProp(bool setHead=true)
Set true the propagation of head tip.
Definition: xfemFracture.h:98
QString checkFracType() const
Check fracture type status.
Definition: xfemFracture.h:106
int numfrontNodeBool() const
Return the number of crack front node booleans.
Definition: xfemFracture.h:84
void setIntactCrackDOFset()
Crack DOF set must be changed as this fracture intersect other one or coexist in the same element wit...
Definition: xfemFracture.h:110
int numPoints() const
Returns the number of points in the fracture definition.
Definition: xfemFracture.h:66
QList< GmVector > _crackCoordinates
subCrack coordinates vector. Size = _ndim * _npointsCrack. Values stored by point.
Definition: xfemFracture.h:214
bool _isStrongFrac
Strong fracture (TRUE defines as strong fracture)
Definition: xfemFracture.h:217
int numCrackPoints() const
Returns the number of crack points into the fracture.
Definition: xfemFracture.h:68
virtual ~XfemFracture()
Destructor.
Definition: xfemFracture.cpp:66
QList< GmVector > _subElemCutPos
Vector with information about fracture position {elem, side1, side2} for results visualization.
Definition: xfemFracture.h:213
QString checkFracState() const
Check fracture state status.
Definition: xfemFracture.h:108
void fixedTail()
Set false the activation of tail tip.
Definition: xfemFracture.h:94
bool _tail
tail of the fracture(TRUE defines that it's available to propagate)
Definition: xfemFracture.h:219
bool checkHeadProp() const
Check Head Propagation status.
Definition: xfemFracture.h:100
arma::vec GmVector
QList< int > _changedElem
List with changed elements as fracture propagates.
Definition: xfemFracture.h:215
XfemFracture(int npoints, int ndim, double *coordinates, const QString &fracType=QString("HydraFrac"), const QString &fracState=QString("Open"))
Constructor for a fracture definition based on a set of points defining its geometry.
Definition: xfemFracture.cpp:45
QList< QList< int > > _crackFront
list with crack front nodes
Definition: xfemFracture.h:225
int _npointsCrack
Number of intersection into the mesh for each fracture.
Definition: xfemFracture.h:207
int numSubCrackPaths() const
Return the number of sub-crack paths.
Definition: xfemFracture.h:72
bool checkCrackDOFset() const
Check crack DOF set status.
Definition: xfemFracture.h:114