v0.14.0
Loading...
Searching...
No Matches
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
22namespace 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 */
44 MoFEMErrorCode getOptions();
45
46 /**
47 * @brief Set cutting volume from bit ref level
48 *
49 * @param bit
50 * @return MoFEMErrorCode
51 */
52 MoFEMErrorCode setVolume(const BitRefLevel &bit);
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 */
76 MoFEMErrorCode setCutSurfaceFromFile();
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
111 MoFEMErrorCode findContactFromPrisms(const BitRefLevel bit,
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
147 MoFEMErrorCode getFrontEdgesAndElements(const BitRefLevel bit,
148 const int verb = 1,
149 const bool debug = false);
150 MoFEMErrorCode setFixEdgesAndCorners(const BitRefLevel bit);
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
164 MoFEMErrorCode getInterfacesPtr();
165
167 int getSkinOfTheBodyId() const { return skinOfTheBodyId; }
168 int getCrackSurfaceId() const { return crackSurfaceId; };
169 int getCrackFrontId() const { return crackFrontId; };
171
172 MoFEMErrorCode clearData();
173
174private:
175 MoFEMErrorCode setMeshOrgCoords();
176 MoFEMErrorCode getMeshOrgCoords();
177
184
185 CutMeshInterface *cutMeshPtr;
186 BitRefManager *bitRefPtr;
187 MeshsetsManager *meshsetMngPtr;
188
193
195 double tolCut;
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__
@ QUIET
@ VERBOSE
static const bool debug
auto bit
set bit
MoFEMErrorCode findBodySkin(const BitRefLevel bit, const int verb=1, const bool debug=false, std::string file_name="out_body_skin.vtk")
find body skin
MoFEMErrorCode findCrackFromPrisms(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, MoFEM::UnknownInterface **iface) const
Getting interface of core database.
Definition CPMeshCut.cpp:45
MoFEMErrorCode cutRefineAndSplit(const int verb=VERBOSE, bool debug=false)
Refine, cut, trim, merge and ref front and split.
MoFEMErrorCode findContactFromPrisms(const BitRefLevel bit, const int verb=1, const bool debug=false)
get contact elements
MoFEMErrorCode cutMesh(int &first_bit, const bool debug=false)
Ref, cut and trim, merge and do TetGen, if option is on.
MoFEMErrorCode copySurface(const std::string save_mesh="")
MoFEMErrorCode refineAndSplit(const int verb=1, const bool debug=false)
MoFEMErrorCode refineCrackTip(const int front_id, const int verb=1, const bool debug=false)
refine elements at crack tip
MoFEMErrorCode insertContactInterface(const int verb=1, const bool debug=false)
insert contact interface
const Range & getCornerNodes() const
MoFEMErrorCode setMeshOrgCoords()
MoFEMErrorCode getInterfacesPtr()
Definition CPMeshCut.cpp:77
MoFEMErrorCode getMeshOrgCoords()
MoFEMErrorCode rebuildCrackSurface(const double factor, const std::string save_mesh="", const int verb=QUIET, bool debug=false)
MoFEMErrorCode setFixEdgesAndCorners(const BitRefLevel bit)
CPMeshCut(CrackPropagation &cp)
Definition CPMeshCut.cpp:51
const Range & getCuttingSurface() const
Definition CPMeshCut.hpp:96
MeshsetsManager * meshsetMngPtr
const int getEdgesBlockSet() const
MoFEMErrorCode findCrack(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front
MoFEMErrorCode setCutSurfaceFromFile()
Set the cut surface from file.
MoFEMErrorCode getOptions()
Get options from command line.
Definition CPMeshCut.cpp:85
CrackPropagation & cP
Definition CPMeshCut.hpp:35
const Range & getFixedEdges() const
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.
std::vector< double > originalCoords
int getContactPrismsBlockSetId() const
MoFEMErrorCode addMortarContactPrisms(const int verb=1, const bool debug=false)
insert contact interface
MoFEMErrorCode getFrontEdgesAndElements(const BitRefLevel bit, const int verb=1, const bool debug=false)
get crack front edges and finite elements
MoFEMErrorCode splitFaces(const int verb=1, const bool debug=false)
split crack faces
const std::string & getCutSurfMeshName() const
MoFEMErrorCode setVolume(const BitRefLevel &bit)
Set cutting volume from bit ref level.
CutMeshInterface * cutMeshPtr
const std::vector< double > & getOrgCoords() const
std::vector< double > & getOrgCoords()
int getCuttingSurfaceSidesetId() const
base class for all interface classes