v0.14.0
CPMeshCut.hpp
Go to the documentation of this file.
1 /** \file CPCutMesh.hpp
2  \brief Cutting mesh
3 */
4 
5 /* This file is part of MoFEM.
6  * MoFEM is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
18 
19 #ifndef __CP_CUTMESH_HPP__
20 #define __CP_CUTMESH_HPP__
21 
22 namespace FractureMechanics {
23 
25 
26  /**
27  * \brief Getting interface of core database
28  * @param uuid unique ID of interface of CPMeshCut solely
29  * @param iface returned pointer to interface
30  * @return error code
31  */
32  MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
33  MoFEM::UnknownInterface **iface) const;
34 
37  virtual ~CPMeshCut() {}
38 
39  /**
40  * @brief Get options from command line
41  *
42  * @return MoFEMErrorCode
43  */
45 
46  /**
47  * @brief Set cutting volume from bit ref level
48  *
49  * @param bit
50  * @return MoFEMErrorCode
51  */
53 
54  /**
55  * @brief Refine mesh close to crack surface and crack front
56  *
57  * @param verb
58  * @param vol pointer to volumes to be refined (can be set to null if set
59  * somwere else)
60  * @param make_front make crack front from skin surface
61  * @param update_front update crack surface information only in vicinity of
62  * crack front
63  * @param debug
64  * @return MoFEMErrorCode
65  */
66  MoFEMErrorCode refineMesh(const Range *vol, const bool make_front,
67  const int verb = QUIET, const bool debug = false);
68 
69  /**
70  * @brief Set the cut surface from file
71  *
72  * Load cutting mesh from file.
73  *
74  * @return MoFEMErrorCode
75  */
77 
78  MoFEMErrorCode copySurface(const std::string save_mesh = "");
79 
80  MoFEMErrorCode rebuildCrackSurface(const double factor,
81  const std::string save_mesh = "",
82  const int verb = QUIET,
83  bool debug = false);
84 
85  /**
86  * @brief Ref, cut and trim, merge and do TetGen, if option is on.
87  *
88  * This is running cut mesh interface function
89  *
90  * @param first_bit
91  * @param debug
92  * @return MoFEMErrorCode
93  */
94  MoFEMErrorCode cutMesh(int &first_bit, const bool debug = false);
95 
96  inline const Range &getCuttingSurface() const { return sUrface; }
97 
98  /// \brief find body skin
99  MoFEMErrorCode findBodySkin(const BitRefLevel bit, const int verb = 1,
100  const bool debug = false,
101  std::string file_name = "out_body_skin.vtk");
102  /// \brief get crack front
103  MoFEMErrorCode findCrack(const BitRefLevel bit, const int verb = 1,
104  const bool debug = false);
105 
106  /// \brief get crack front
107  MoFEMErrorCode findCrackFromPrisms(const BitRefLevel bit, const int verb = 1,
108  const bool debug = false);
109 
110  /// \brief get contact elements
112  const int verb = 1,
113  const bool debug = false);
114 
115  /// \brief split crack faces
116  MoFEMErrorCode splitFaces(const int verb = 1, const bool debug = false);
117 
118  /// \brief insert contact interface
119  MoFEMErrorCode insertContactInterface(const int verb = 1,
120  const bool debug = false);
121 
122  /// \brief insert contact interface
123  MoFEMErrorCode addMortarContactPrisms(const int verb = 1,
124  const bool debug = false);
125 
126  /// \brief refine elements at crack tip
127  MoFEMErrorCode refineCrackTip(const int front_id, const int verb = 1,
128  const bool debug = false);
129 
130  MoFEMErrorCode refineAndSplit(const int verb = 1, const bool debug = false);
131 
132  /**
133  * @brief Refine, cut, trim, merge and ref front and split
134  *
135  * \note This functions squashes bits, and do refine of crack front after mesh
136  * is cutted. That refinement improves approximation of the fields but
137  * not geometry of crack front.
138  *
139  * @param verb
140  * @param debug
141  * @return MoFEMErrorCode
142  */
143  MoFEMErrorCode cutRefineAndSplit(const int verb = VERBOSE,
144  bool debug = false);
145 
146  /// \brief get crack front edges and finite elements
148  const int verb = 1,
149  const bool debug = false);
151 
152  std::vector<double> &getOrgCoords() { return originalCoords; }
153  const std::vector<double> &getOrgCoords() const { return originalCoords; }
154 
155  inline const Range &getFixedEdges() const { return fixedEdges; }
156  inline const Range &getCornerNodes() const { return cornerNodes; }
157  inline const std::string &getCutSurfMeshName() const {
158  return cutSurfMeshName;
159  }
160  inline const int getEdgesBlockSet() const {
161  return edgesBlockSetFlg == PETSC_TRUE ? edgesBlockSet : 0;
162  }
163 
165 
167  int getSkinOfTheBodyId() const { return skinOfTheBodyId; }
168  int getCrackSurfaceId() const { return crackSurfaceId; };
169  int getCrackFrontId() const { return crackFrontId; };
171 
173 
174 private:
177 
178  PetscBool edgesBlockSetFlg;
184 
185  CutMeshInterface *cutMeshPtr;
186  BitRefManager *bitRefPtr;
187  MeshsetsManager *meshsetMngPtr;
188 
193 
195  double tolCut;
196  double tolCutClose;
197  double tolTrimClose;
200 
201  PetscBool debugCut;
203 
204  double sHift[3];
209 
210  std::vector<double> originalCoords;
211  std::string cutSurfMeshName;
212 };
213 } // namespace FractureMechanics
214 
215 #endif //__CP_CUTMESH_HPP__
FractureMechanics::CPMeshCut::sHift
double sHift[3]
Definition: CPMeshCut.hpp:204
FractureMechanics::CPMeshCut::getCuttingSurface
const Range & getCuttingSurface() const
Definition: CPMeshCut.hpp:96
FractureMechanics::CPMeshCut::cornerNodes
Range cornerNodes
Definition: CPMeshCut.hpp:190
FractureMechanics::CPMeshCut::getInterfacesPtr
MoFEMErrorCode getInterfacesPtr()
Definition: CPMeshCut.cpp:77
FractureMechanics::CPMeshCut::refineCrackTip
MoFEMErrorCode refineCrackTip(const int front_id, const int verb=1, const bool debug=false)
refine elements at crack tip
Definition: CPMeshCut.cpp:2044
FractureMechanics::CPMeshCut::findCrackFromPrisms
MoFEMErrorCode findCrackFromPrisms(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front
Definition: CPMeshCut.cpp:1513
FractureMechanics::CPMeshCut::rebuildCrackSurface
MoFEMErrorCode rebuildCrackSurface(const double factor, const std::string save_mesh="", const int verb=QUIET, bool debug=false)
Definition: CPMeshCut.cpp:344
FractureMechanics::CPMeshCut::cutMesh
MoFEMErrorCode cutMesh(int &first_bit, const bool debug=false)
Ref, cut and trim, merge and do TetGen, if option is on.
Definition: CPMeshCut.cpp:1204
FractureMechanics::CPMeshCut::refineMesh
MoFEMErrorCode refineMesh(const Range *vol, const bool make_front, const int verb=QUIET, const bool debug=false)
Refine mesh close to crack surface and crack front.
Definition: CPMeshCut.cpp:218
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
FractureMechanics::CPMeshCut::vertexBlockSet
int vertexBlockSet
Definition: CPMeshCut.hpp:180
FractureMechanics::CPMeshCut::cutRefineAndSplit
MoFEMErrorCode cutRefineAndSplit(const int verb=VERBOSE, bool debug=false)
Refine, cut, trim, merge and ref front and split.
Definition: CPMeshCut.cpp:2278
FractureMechanics::CPMeshCut::copySurface
MoFEMErrorCode copySurface(const std::string save_mesh="")
Definition: CPMeshCut.cpp:322
FractureMechanics::CPMeshCut::nbRefBeforTrim
int nbRefBeforTrim
Definition: CPMeshCut.hpp:199
FractureMechanics::CPMeshCut::crackFrontId
int crackFrontId
Definition: CPMeshCut.hpp:208
FractureMechanics::CPMeshCut::~CPMeshCut
virtual ~CPMeshCut()
Definition: CPMeshCut.hpp:37
FractureMechanics::CPMeshCut::splitFaces
MoFEMErrorCode splitFaces(const int verb=1, const bool debug=false)
split crack faces
Definition: CPMeshCut.cpp:1622
FractureMechanics::CPMeshCut
Definition: CPMeshCut.hpp:24
FractureMechanics::CPMeshCut::vertexNodeSet
int vertexNodeSet
Definition: CPMeshCut.hpp:181
FractureMechanics::CPMeshCut::originalCoords
std::vector< double > originalCoords
Definition: CPMeshCut.hpp:210
FractureMechanics::CPMeshCut::getOptions
MoFEMErrorCode getOptions()
Get options from command line.
Definition: CPMeshCut.cpp:85
FractureMechanics::CPMeshCut::setCutSurfaceFromFile
MoFEMErrorCode setCutSurfaceFromFile()
Set the cut surface from file.
Definition: CPMeshCut.cpp:301
FractureMechanics::CPMeshCut::insertContactInterface
MoFEMErrorCode insertContactInterface(const int verb=1, const bool debug=false)
insert contact interface
Definition: CPMeshCut.cpp:1873
FractureMechanics::CPMeshCut::getCrackFrontId
int getCrackFrontId() const
Definition: CPMeshCut.hpp:169
FractureMechanics::CPMeshCut::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, MoFEM::UnknownInterface **iface) const
Getting interface of core database.
Definition: CPMeshCut.cpp:45
FractureMechanics::CPMeshCut::getOrgCoords
std::vector< double > & getOrgCoords()
Definition: CPMeshCut.hpp:152
FractureMechanics::CPMeshCut::getCutSurfMeshName
const std::string & getCutSurfMeshName() const
Definition: CPMeshCut.hpp:157
VERBOSE
@ VERBOSE
Definition: definitions.h:222
FractureMechanics::CPMeshCut::tolCutClose
double tolCutClose
Definition: CPMeshCut.hpp:196
FractureMechanics::CPMeshCut::setMeshOrgCoords
MoFEMErrorCode setMeshOrgCoords()
Definition: CPMeshCut.cpp:2405
FractureMechanics::CPMeshCut::contactPrismsBlockSetId
int contactPrismsBlockSetId
Definition: CPMeshCut.hpp:183
FractureMechanics::CPMeshCut::setFixEdgesAndCorners
MoFEMErrorCode setFixEdgesAndCorners(const BitRefLevel bit)
Definition: CPMeshCut.cpp:1173
FractureMechanics::CPMeshCut::removePathologicalFrontTris
PetscBool removePathologicalFrontTris
Definition: CPMeshCut.hpp:202
bit
auto bit
set bit
Definition: hanging_node_approx.cpp:75
FractureMechanics::CPMeshCut::cP
CrackPropagation & cP
Definition: CPMeshCut.hpp:35
FractureMechanics::CPMeshCut::crackSurfaceId
int crackSurfaceId
Definition: CPMeshCut.hpp:207
FractureMechanics::CPMeshCut::findBodySkin
MoFEMErrorCode findBodySkin(const BitRefLevel bit, const int verb=1, const bool debug=false, std::string file_name="out_body_skin.vtk")
find body skin
Definition: CPMeshCut.cpp:1383
FractureMechanics::CPMeshCut::getOrgCoords
const std::vector< double > & getOrgCoords() const
Definition: CPMeshCut.hpp:153
FractureMechanics::CPMeshCut::cuttingSurfaceSidesetId
int cuttingSurfaceSidesetId
Definition: CPMeshCut.hpp:205
FractureMechanics::CPMeshCut::findCrack
MoFEMErrorCode findCrack(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front
Definition: CPMeshCut.cpp:1447
FractureMechanics::CPMeshCut::debugCut
PetscBool debugCut
Definition: CPMeshCut.hpp:201
FractureMechanics::CPMeshCut::meshsetMngPtr
MeshsetsManager * meshsetMngPtr
Definition: CPMeshCut.hpp:187
FractureMechanics::CPMeshCut::getCornerNodes
const Range & getCornerNodes() const
Definition: CPMeshCut.hpp:156
debug
static const bool debug
Definition: dm_create_subdm.cpp:12
FractureMechanics::CPMeshCut::nbRefBeforCut
int nbRefBeforCut
Definition: CPMeshCut.hpp:198
FractureMechanics::CPMeshCut::getSkinOfTheBodyId
int getSkinOfTheBodyId() const
Definition: CPMeshCut.hpp:167
FractureMechanics::CPMeshCut::refineAndSplit
MoFEMErrorCode refineAndSplit(const int verb=1, const bool debug=false)
Definition: CPMeshCut.cpp:2168
FractureMechanics::CPMeshCut::getMeshOrgCoords
MoFEMErrorCode getMeshOrgCoords()
Definition: CPMeshCut.cpp:2433
FractureMechanics::CPMeshCut::cutMeshPtr
CutMeshInterface * cutMeshPtr
Definition: CPMeshCut.hpp:185
FractureMechanics::CPMeshCut::crackedBodyBlockSetId
int crackedBodyBlockSetId
Definition: CPMeshCut.hpp:182
FractureMechanics::CPMeshCut::tolTrimClose
double tolTrimClose
Definition: CPMeshCut.hpp:197
FractureMechanics::CPMeshCut::skinOfTheBodyId
int skinOfTheBodyId
Definition: CPMeshCut.hpp:206
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
FractureMechanics::CPMeshCut::getFixedEdges
const Range & getFixedEdges() const
Definition: CPMeshCut.hpp:155
Range
FractureMechanics::CPMeshCut::fRont
Range fRont
Definition: CPMeshCut.hpp:191
FractureMechanics::CPMeshCut::cutSurfMeshName
std::string cutSurfMeshName
Definition: CPMeshCut.hpp:211
FractureMechanics::CPMeshCut::getFrontEdgesAndElements
MoFEMErrorCode getFrontEdgesAndElements(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front edges and finite elements
Definition: CPMeshCut.cpp:2348
FractureMechanics::CPMeshCut::findContactFromPrisms
MoFEMErrorCode findContactFromPrisms(const BitRefLevel bit, const int verb=1, const bool debug=false)
get contact elements
Definition: CPMeshCut.cpp:2000
FractureMechanics::CPMeshCut::CPMeshCut
CPMeshCut(CrackPropagation &cp)
Definition: CPMeshCut.cpp:51
FractureMechanics::CPMeshCut::bitRefPtr
BitRefManager * bitRefPtr
Definition: CPMeshCut.hpp:186
FractureMechanics::CPMeshCut::getContactPrismsBlockSetId
int getContactPrismsBlockSetId() const
Definition: CPMeshCut.hpp:170
FractureMechanics::CrackPropagation
Definition: CrackPropagation.hpp:77
FractureMechanics::CPMeshCut::fixedEdges
Range fixedEdges
Definition: CPMeshCut.hpp:189
FractureMechanics::CPMeshCut::getCrackSurfaceId
int getCrackSurfaceId() const
Definition: CPMeshCut.hpp:168
FractureMechanics::CPMeshCut::addMortarContactPrisms
MoFEMErrorCode addMortarContactPrisms(const int verb=1, const bool debug=false)
insert contact interface
Definition: CPMeshCut.cpp:1749
FractureMechanics::CPMeshCut::edgesBlockSetFlg
PetscBool edgesBlockSetFlg
Definition: CPMeshCut.hpp:178
FractureMechanics::CPMeshCut::setVolume
MoFEMErrorCode setVolume(const BitRefLevel &bit)
Set cutting volume from bit ref level.
Definition: CPMeshCut.cpp:209
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
QUIET
@ QUIET
Definition: definitions.h:221
FractureMechanics::CPMeshCut::fractionLevel
int fractionLevel
Definition: CPMeshCut.hpp:194
FractureMechanics::CPMeshCut::sUrface
Range sUrface
Definition: CPMeshCut.hpp:192
FractureMechanics::CPMeshCut::edgesBlockSet
int edgesBlockSet
Definition: CPMeshCut.hpp:179
FractureMechanics::CPMeshCut::tolCut
double tolCut
Definition: CPMeshCut.hpp:195
FractureMechanics
Definition: AnalyticalFun.hpp:15
FractureMechanics::CPMeshCut::getCuttingSurfaceSidesetId
int getCuttingSurfaceSidesetId() const
Definition: CPMeshCut.hpp:166
FractureMechanics::CPMeshCut::getEdgesBlockSet
const int getEdgesBlockSet() const
Definition: CPMeshCut.hpp:160
FractureMechanics::CPMeshCut::clearData
MoFEMErrorCode clearData()
Definition: CPMeshCut.cpp:2459