Xfem
The Xfem Plugin
Loading...
Searching...
No Matches
xfemMesh.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_MESH_H_
25#define _GEMA_XFEM_MESH_H_
26
27#include <gmElementMesh.h>
28
29#include "xfemElement.h"
30#include "xfemMeshLoader.h"
31
32#include "xfemLuaMesh.h"
33#include "xfemLuaElement.h"
34#include "xfemGaussAccessor.h"
35
36#include <gmpCellMesh.h>
37
40class XfemSubElement;
41class XfemFracture;
42
43
49class XfemMesh : public GmElementMesh
50{
51public:
53
54 virtual ~XfemMesh();
55
56 virtual void printValues(const GmLogCategory& logger, int options);
57
59 virtual const XfemElement* element(int index) const { return (XfemElement*)cell(index); }
60
62 virtual XfemElement* element(int index) { return (XfemElement*)cell(index); }
63
64 virtual bool enrichElement(XfemElement* e);
65
67
70
71 virtual int numRegularSubElements (const XfemElement* e) const;
72 virtual int numFractureSubElements(const XfemElement* e) const;
73 virtual const XfemSubElement* subElement (const XfemElement* e, int index) const;
74 virtual const XfemSubElement* fractureSubElement (const XfemElement* e, int index) const;
75 virtual void clearSubElements();
76 virtual void clearSubElements(XfemElement* e);
77 virtual int addSubElement (XfemElement* e, XfemSubElement* se, int ruleSet = 0);
78 virtual void removeSubElement(XfemElement* e, int index);
79 virtual void updateSubElementCoordinates(XfemElement* e, int index, const GmMatrix& seNaturalCoords,
80 int ruleSet = 0);
81
82 const GmIntegrationRule* enrichedElementRegularIntegrationRule (const XfemElement* e, int ruleSet) const;
84
87 {
88 return enrichedGaussAttributeAccessor(id, 0, true, desiredUnit, logger);
89 }
90
91 virtual XfemGaussAccessor* enrichedGaussAttributeAccessor(QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory& logger) const;
92
94 virtual const QList<XfemFracture*>& naturalFractures() const { return _naturalFractures; }
95
98
100 virtual void clearNaturalFractures();
101
103 virtual GmVector getElemCutInfo( int id) const { return _elemCutInfo.at(id); }
104
107
110
112 virtual int sizeElemCutInfo() { return _elemCutInfo.size(); }
113
115 virtual int getTotalNumDOF(int id) const { return _totalDofSet.at(id); }
116
118 virtual void addTotalNumDOF(QList<int> eCI) { _totalDofSet.append(eCI); }
119
122
124 virtual int sizeTotalNumDOF() { return _totalDofSet.size(); }
125
127 virtual QString getNodeStateVarIds(int id) const { return _nodeStateVarIds.at(id); }
128
130 virtual void addNodeStateVarIds(QStringList eCI) { _nodeStateVarIds.append(eCI); }
131
133 virtual void deleteNodeStateVarIds() { _nodeStateVarIds.clear(); }
134
136 virtual int sizeNodeStateVarIds() const { return _nodeStateVarIds.size(); }
137
139 void setCubicLaw(bool cubicLaw) { _cubicLaw = cubicLaw; }
140
142 virtual bool getCubicLaw() const { return _cubicLaw; }
143
145 void setMultiPhasic(bool multiPhasic) { _multiPhasic = multiPhasic; }
146
148 virtual bool getMultiPhasic() const { return _multiPhasic; }
149
151 void setNonIsoThermal(bool nonIsoThermal) { _nonIsoThermal = nonIsoThermal; }
152
154 virtual bool getNonIsoThermal() const { return _nonIsoThermal; }
155
157 void setSaturationRelativePermeabilityModel(char nonIsoThermal) { _SaRelPer = nonIsoThermal; }
158
160 virtual bool getSaturationRelativePermeabilityModel() const { return _SaRelPer; }
161
163 virtual QList<int> getNodeTopologicalMap(int i) const { return _nodeTopologicalMap.at(i); }
164
166 virtual void addNodeTopologicalMap(QList<int> eCI) { _nodeTopologicalMap.append(eCI); }
167
169 virtual QList<int> getElemTopologicalMap(int i) const { return _elemTopologicalMap.at(i); }
170
172 virtual void addElemTopologicalMap(QList<int> eCI) { _elemTopologicalMap.append(eCI); }
173
175 virtual QList<QPair<int, QList<int>>> getfaceTopologicalMap(int i) const { return _faceTopologicalMap.at(i); }
176
178 virtual void addFaceTopologicalMap(QList<QPair<int, QList<int>>> eCI) { _faceTopologicalMap.append(eCI); }
179
180
181protected:
183
184 virtual void clearXfemData();
185
186private:
191 QStringList _nodeStateVarIds; // list with the state variable ids in the model
192 bool _cubicLaw; // Boolean to define whether cubic law or constant fracture permeability is used
193 bool _multiPhasic; // Boolean to define whether multiphasic analysis is carried out
194 bool _nonIsoThermal; // Boolean to define whether non-isothermal analysis is carried out
195 char _SaRelPer; // Char defining the Saturation and Relative Permeability Model
196 QList<QList<int>> _nodeTopologicalMap;// Node list with element id who contain them
197 QList<QList<int>> _elemTopologicalMap;// list of element neighbors with element id who contain them
198 QList<QList<QPair<int, QList<int>>>>_faceTopologicalMap;// list of element neighbors for each face of the element
199};
200
201
202
205
206
210{
211public:
212 XfemGemaMesh(GmSimulationData* simulation, QString id, QString description, const GmLogCategory& logger)
213 : XfemGemaMeshBase(simulation, id, description, logger) {}
214
215 // Comments on the base class
216 virtual const char* pluginName() const { return "Xfem"; }
217
218 // Comments on the base class
219 virtual const char* pluginType() const { return "mesh"; }
220
221 // Comments on the base class
222 virtual bool hasCapability(QString capabilityName) const
223 {
224 if(capabilityName == "stateDump")
225 return false;
226 return (capabilityName == "enrichment") || XfemGemaMeshBase::hasCapability(capabilityName);
227 }
228
229 // Comments on the base class
230 virtual void pushProxy(lua_State* L, const GmLogCategory& logger) { LuaProxy::pushObject(L, new XfemLuaMesh(this, logger)); }
231
232 virtual void clear();
233
234protected:
235
237 virtual GmpMeshLoader<XfemVector>* meshLoader() { return new XfemMeshLoader(simulationData(), logger()); }
238
244 virtual GmpCellAllocator cellAllocator(bool ghostSupport, bool hSupport) const
245 {
246 Q_UNUSED(ghostSupport); Q_UNUSED(hSupport);
247 assert(!hSupport); // No support for XFEM hierarchical elements!!!!
248
249 return GmpCellFactory<XfemGemaElement, XfemElement, XfemLuaElement, GmpCellMeshData<XfemVector>>;
250 }
251
253 virtual int cellSize(bool ghostSupport, bool hSupport) const
254 {
255 Q_UNUSED(ghostSupport); Q_UNUSED(hSupport);
256 assert(!hSupport); // No support for XFEM hierarchical elements!!!!
257
258 return GmpCellSize<XfemGemaElement, XfemElement, XfemLuaElement, GmpCellMeshData<XfemVector>>();
259 }
260
261#ifdef ENABLE_TESTS
262 friend Q_DECL_EXPORT XfemMesh* TEST_XfemBuildTestMesh(GmSimulationData*, const GmLogCategory&);
263#endif
264};
265
266
267#endif
268
virtual const GmCell * cell(int cellIndex) const=0
virtual const GmLogCategory & logger() const
QString description() const
Basic interface for an XFEM element.
Definition xfemElement.h:44
A class used to store per element data needed only in enriched elements.
Definition xfemEnrichedElementData.h:38
A simple class to represent a natural fracture.
Definition xfemFracture.h:35
The XfemGaussAccessor class is a proxy object to a value accesor implementing a more convenient inter...
Definition xfemGaussAccessor.h:41
Implementation of the XfemMesh interface based on the standard GeMA mesh plugin.
Definition xfemMesh.h:210
virtual GmpMeshLoader< XfemVector > * meshLoader()
Returns the custom mesh loader used to load XFem mesh data. This function should be replaced for usin...
Definition xfemMesh.h:237
virtual GmpCellAllocator cellAllocator(bool ghostSupport, bool hSupport) const
Returns the function responsible for allocating and initializing a new XFEM element.
Definition xfemMesh.h:244
virtual int cellSize(bool ghostSupport, bool hSupport) const
Returns the size of a cell object.
Definition xfemMesh.h:253
A special integration rule for handling refined xfem elements.
Definition xfemIntegrationRule.h:38
A proxy class to export XfemMesh methods to the Lua environment.
Definition xfemLuaMesh.h:33
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition xfemMesh.h:50
virtual const XfemSubElement * subElement(const XfemElement *e, int index) const
Returns a subelement of an enriched element.
Definition xfemMesh.cpp:129
virtual int numFractureSubElements(const XfemElement *e) const
Returns the number of fracture sub-elements of the given enriched element (0 for non enriched ones)
Definition xfemMesh.cpp:112
virtual XfemEnrichedElementData * enrichedElementData(const XfemElement *e) const
Returns the enriched element private data or NULL if the element has not been enriched.
Definition xfemMesh.cpp:97
QList< int > _totalDofSet
list with the total number of DOF in the model
Definition xfemMesh.h:190
virtual void addTotalNumDOF(QList< int > eCI)
Adds a the list with the total number of DOF.
Definition xfemMesh.h:118
virtual int getTotalNumDOF(int id) const
Returns the list with the total number of DOF at a specific position.
Definition xfemMesh.h:115
void setSaturationRelativePermeabilityModel(char nonIsoThermal)
Set the Char defining the Saturation and Relative Permeability Model.
Definition xfemMesh.h:157
virtual bool enrichElement(XfemElement *e)
Marks the given element as enriched.
Definition xfemMesh.cpp:78
virtual GmGaussValueSetGroup * createGaussValueSetGroup(GmSimulationData *simulation, GmElementMesh *mesh)
Overrides the standard GmElementMesh::createGaussValueSetGroup() implementation to create XfemGaussVa...
Definition xfemMesh.cpp:393
const QMap< int, XfemEnrichedElementData * > & enrichedElementMap() const
Returns the map storing data for every enriched element in the mesh. Use carefully.
Definition xfemMesh.h:69
QList< GmVector > _elemCutInfo
vector with element information {iElem, # of fractures per element}
Definition xfemMesh.h:189
virtual void removeSubElement(XfemElement *e, int index)
Removes an existing sub-element from the enriched element. This removal will automatically trigger an...
Definition xfemMesh.cpp:271
virtual int numRegularSubElements(const XfemElement *e) const
Returns the number of regular (non fracture) sub-elements of the given enriched element (0 for non en...
Definition xfemMesh.cpp:104
virtual bool getMultiPhasic() const
Returns the Boolean to define whether multiPhasic analysis is carried out.
Definition xfemMesh.h:148
virtual int sizeElemCutInfo()
Returns the size of elemCutInfo list.
Definition xfemMesh.h:112
QList< XfemFracture * > _naturalFractures
The set of mesh natural fractures.
Definition xfemMesh.h:188
virtual bool getSaturationRelativePermeabilityModel() const
Returns the Char defining the Saturation and Relative Permeability Model.
Definition xfemMesh.h:160
void setCubicLaw(bool cubicLaw)
Set the cubic Law Boolean to define whether cubic law or constant fracture permeability is used.
Definition xfemMesh.h:139
virtual void addNodeStateVarIds(QStringList eCI)
Adds list with the state variable ids in the model.
Definition xfemMesh.h:130
void setMultiPhasic(bool multiPhasic)
Set the multiPhasic Boolean to define whether multiPhasic analysis is carried out.
Definition xfemMesh.h:145
virtual bool getCubicLaw() const
Returns the Boolean to define whether cubic law or constant fracture permeability is used.
Definition xfemMesh.h:142
virtual const QList< XfemFracture * > & naturalFractures() const
Returns the list of mesh natural fractures.
Definition xfemMesh.h:94
const GmIntegrationRule * enrichedElementRegularIntegrationRule(const XfemElement *e, int ruleSet) const
Returns the elements regular integration rule with support for enriched elements.
Definition xfemMesh.cpp:345
virtual void addElemCutInfo(QList< GmVector > eCI)
Adds a vector with element cut information.
Definition xfemMesh.h:106
virtual XfemElement * element(int index)
Returns a mesh cell already converted to an XfemElement. Non const version.
Definition xfemMesh.h:62
virtual void deleteElemCutInfo()
delete element cut information
Definition xfemMesh.h:109
virtual void clearXfemData()
Clears Xfem related data from the mesh.
Definition xfemMesh.cpp:433
const GmIntegrationRule * enrichedElementFractureIntegrationRule(const XfemSubElement *se, int ruleSet) const
Returns the integration rule for the given fracture sub-element.
Definition xfemMesh.cpp:360
virtual XfemGaussAccessor * enrichedGaussAttributeAccessor(QString id, Unit desiredUnit, const GmLogCategory &logger) const
Equivalent to call enrichedGaussAttributeAccessor(id, 0, true, desiredUnit, logger)
Definition xfemMesh.h:86
virtual bool getNonIsoThermal() const
Returns the Boolean to define whether nonIsoThermal analysis is carried out.
Definition xfemMesh.h:154
virtual QList< int > getElemTopologicalMap(int i) const
Returns the list of element neighborns of element id who contain the node i.
Definition xfemMesh.h:169
virtual void addNodeTopologicalMap(QList< int > eCI)
Adds the list of element id who contain the node i.
Definition xfemMesh.h:166
virtual void updateSubElementCoordinates(XfemElement *e, int index, const GmMatrix &seNaturalCoords, int ruleSet=0)
Updates the set of natural coordinates from a sub-element, provided that the sub-element type remains...
Definition xfemMesh.cpp:320
virtual void printValues(const GmLogCategory &logger, int options)
Overrides printValues to add subelement information.
Definition xfemMesh.cpp:399
virtual void clearNaturalFractures()
Remove all natural fractures from the mesh.
Definition xfemMesh.cpp:203
virtual int addSubElement(XfemElement *e, XfemSubElement *se, int ruleSet=0)
Adds a new sub-element to the xfem element. This addition will automatically trigger an update in the...
Definition xfemMesh.cpp:225
virtual QList< int > getNodeTopologicalMap(int i) const
Returns the list of element id who contain the node i.
Definition xfemMesh.h:163
virtual QList< QPair< int, QList< int > > > getfaceTopologicalMap(int i) const
Returns the list of neighborn element for each face of the element i.
Definition xfemMesh.h:175
void setNonIsoThermal(bool nonIsoThermal)
Set the nonIsoThermal Boolean to define whether nonIsoThermal analysis is carried out.
Definition xfemMesh.h:151
virtual void addFaceTopologicalMap(QList< QPair< int, QList< int > > > eCI)
Adds the list of neighborn element for each face of the element i.
Definition xfemMesh.h:178
virtual void deleteTotalNumDOF()
delete element cut information
Definition xfemMesh.h:121
virtual int sizeNodeStateVarIds() const
Returns the size of list with the state variable ids in the model.
Definition xfemMesh.h:136
virtual QString getNodeStateVarIds(int id) const
Returns the list with the state variable ids in the model.
Definition xfemMesh.h:127
XfemMesh(GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
Constructor. Will be called by the plugin loading code.
Definition xfemMesh.cpp:44
virtual void addNaturalFracture(XfemFracture *f)
Adds a new natural fracture to the mesh. The mesh takes ownership of the fracture object.
Definition xfemMesh.h:97
virtual void deleteNodeStateVarIds()
delete list with the state variable ids in the model
Definition xfemMesh.h:133
virtual int sizeTotalNumDOF()
Returns the size of elemCutInfo list.
Definition xfemMesh.h:124
virtual GmVector getElemCutInfo(int id) const
Returns the list with element information {iElem, # of fractures per element}.
Definition xfemMesh.h:103
QMap< int, XfemEnrichedElementData * > _elementMap
Map storing individual data for enriched elements.
Definition xfemMesh.h:187
virtual const XfemSubElement * fractureSubElement(const XfemElement *e, int index) const
Returns a fracture sub-element with an indexing starting from zero for the first fracture sub-element...
Definition xfemMesh.cpp:141
virtual void addElemTopologicalMap(QList< int > eCI)
Adds the list of element neighborns of element id who contain the node i.
Definition xfemMesh.h:172
virtual const XfemElement * element(int index) const
Returns a mesh cell already converted to an XfemElement.
Definition xfemMesh.h:59
virtual void clearSubElements()
Clears all subelements from the mesh. This will automatically clear element integration rules and dat...
Definition xfemMesh.cpp:152
virtual ~XfemMesh()
Destructor.
Definition xfemMesh.cpp:62
Class responsible for loading mesh data for an XFem mesh.
Definition xfemMeshLoader.h:38
A class used to represent an enriched element subelement, defining an integration region inside the e...
Definition xfemSubElement.h:39
arma::mat GmMatrix
arma::vec GmVector
GmCell *(* GmpCellAllocator)(void *addr, int meshId, GmCellType type, int hindex, int id, int offset)
void append(const T &value)
const T & at(int i) const const
void clear()
int size() const const
Declaration of the XfemElement class.
Declaration of the XfemGaussAccessor class.
Declaration of the XfemLuaElement class.
Declaration of the XfemLuaMesh class.
GmpCellMeshBase< XfemMesh, XfemVector > XfemGemaMeshBase
Aux typedef for defining the base class for the XfemGemaMesh class.
Definition xfemMesh.h:204
Declaration of the XfemMeshLoader class.