v0.16.3
Loading...
Searching...
No Matches
MeshRefinement.hpp
Go to the documentation of this file.
1/** \file MeshRefinement.hpp
2 * \brief Interface for mesh refinement
3 *
4 * \ingroup mofem_refiner
5 */
6
7#ifndef __MESHREFINE_HPP__
8#define __MESHREFINE_HPP__
9
10namespace MoFEM {
11
12/** \brief Mesh refinement interface
13
14 Currently this class is abstraction to Core interface. In future should be
15 outsourced as independent interface.
16
17 \bug Not working on partitioned meshes
18 \bug Need to be implemented as a stand alone interface not as a part of core
19 structure which should be only basic database
20 \bug If outsourced, class member functions should follow name convention
21 \bug Spelling mistakes will be corrected with names fix to follow name
22 convetion
23
24 \ingroup mofem_refiner
25 */
27
28 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
29 UnknownInterface **iface) const;
30
32 MeshRefinement(const MoFEM::Core &core);
33
34 virtual ~MeshRefinement() = default;
35
36 /** Derive parents of a linear simplicial subdivision from vertex ancestry.
37 * source_entities contains the selected source vertices, edges, faces and
38 * tetrahedra, including their closure. child_entities contains the output
39 * entities and their closure; adjacency must already be updated.
40 * vertex_parents maps every output vertex not retained from the source to
41 * its containing source edge, face or volume. Geometry is the caller's
42 * responsibility. Higher-dimensional parents are the unique source entity
43 * of lowest dimension containing all corner vertices topologically.
44 * Validate all assignments before updating parent tags, refinement indices
45 * and output_bit. Retained source entities keep their existing ancestry.
46 * No meshset transfer or parallel communication is performed.
47 */
49 const Range &source_entities, const Range &child_entities,
50 const std::map<EntityHandle, EntityHandle> &vertex_parents,
51 const BitRefLevel &output_bit, int verb = QUIET);
52
53 /** Representative lineage for reconnection of existing vertices.
54 * Source/child closures and complete source incidence must be local. Choose
55 * a common source carrier of lowest eligible dimension, or an incident source
56 * cell when no common carrier exists; ties use sorted vertex GLOBAL_IDs.
57 * moved_vertices maps a new child vertex, which replaces a moved source
58 * vertex, to that source vertex. The source vertex becomes its parent and
59 * stands in for it when parents of incident children are chosen.
60 * This records topology only; no geometry, meshset or field transfer.
61 */
63 const Range &source_entities, const Range &child_entities,
64 const BitRefLevel &output_bit, int verb = QUIET,
65 const std::map<EntityHandle, EntityHandle> &moved_vertices = {});
66
67 /**
68 * \brief make vertices in the middle of edges in meshset and add them to
69 * refinement levels defined by bit
70 *
71 * Takes entities fromm meshsets and queried recursively (get entities from
72 * meshsets in meshsets, usually have to be used for CUBIT meshset).
73 * If meshset does not contain any edges, get entities in dimension 3 and get
74 * edge adjacencies.
75 *
76 * \param EntityHandle meshset
77 * \param BitRefLevel bitLevel
78 * \param recursive If true, meshsets containing meshsets are queried
79 * recursively. Returns the contents of meshsets, but not the meshsets
80 * themselves if true.
81 */
82 MoFEMErrorCode addVerticesInTheMiddleOfEdges(const EntityHandle meshset,
83 const BitRefLevel &bit,
84 const bool recursive = false,
85 int verb = QUIET,
86 EntityHandle start_v = 0);
87
88 /**
89 * \brief make vertices in the middle of edges in meshset and add them to
90 * Refinement levels defined by bit
91 *
92 * Takes entities from meshsets and queried recursively (get entities from
93 * meshsets in meshsets, usually have to be used for CUBIT meshset).
94 * If meshset does not contain any edges, get entities in dimension 3 and get
95 * edge adjacencies.
96 *
97 * \param Range consisting edges for refine
98 * \param BitRefLevel bitLevel
99 * \param recursive If true, meshsets containing meshsets are queried
100 * recursively. Returns the contents of meshsets, but not the meshsets
101 * themselves if true.
102 */
104 const BitRefLevel &bit,
105 int verb = QUIET,
106 EntityHandle start_v = 0);
107
108 /**\brief refine TET in the meshset
109 *
110 * \param EntityHandle meshset
111 * \param BitRefLevel bitLevel
112 * \param verb verbosity level
113 */
114 MoFEMErrorCode refineTets(const EntityHandle meshset, const BitRefLevel &bit,
115 int verb = QUIET, const bool debug = false);
116
117 /**\brief refine TET in the meshset
118 *
119 * \param Range of tets to refine
120 * \param BitRefLevel bitLevel
121 * \param BitRefLevel bitLevel
122 * \param verb verbosity level
123 */
124 MoFEMErrorCode refineTets(const Range &tets, const BitRefLevel &bit,
125 int verb = QUIET, const bool debug = false);
126
127 /**\brief refine TET in the meshset
128 *
129 * \param Range of tets to refine
130 * \param BitRefLevel bitLevel
131 * \param BitRefLevel bitLevel
132 * \param verb verbosity level
133 */
135 const BitRefLevel &bit,
136 int verb = QUIET,
137 const bool debug = false);
138
139 /**\brief refine TET in the meshset
140 *
141 * \param Range of tets to refine
142 * \param BitRefLevel bitLevel
143 * \param BitRefLevel bitLevel
144 * \param verb verbosity level
145 */
146 MoFEMErrorCode refineTetsHangingNodes(const EntityHandle meshset,
147 const BitRefLevel &bit,
148 int verb = QUIET,
149 const bool debug = false);
150
151 /**\brief refine PRISM in the meshset
152 *
153 * \param EntityHandle meshset
154 * \param BitRefLevel bitLevel
155 */
156 MoFEMErrorCode refinePrisms(const EntityHandle meshset,
157 const BitRefLevel &bit, int verb = QUIET);
158
159 /**\brief refine meshset, i.e. add child of refined entities to meshset
160 *
161 * \param EntityHandle meshset where to save the child refined entities
162 * \param BitRefLevel bitLevel
163 * \param recursive If true, meshsets containing meshsets are queried
164 * recursively. Returns the contents of meshsets, but not the meshsets
165 * themselves if true.
166 */
167 MoFEMErrorCode refineMeshset(const EntityHandle meshset,
168 const BitRefLevel &bit,
169 const bool recursive = false, int verb = QUIET);
170
171 /**\brief refine triangles in the meshset
172 *
173 * \param EntityHandle meshset
174 * \param BitRefLevel bitLevel
175 * \param verb verbosity level
176 */
177 MoFEMErrorCode refineTris(const EntityHandle meshset, const BitRefLevel &bit,
178 int verb = QUIET, const bool debug = false);
179
180 /**\brief refine TRI in the meshset
181 *
182 * \param meshset of entities to refine
183 * \param BitRefLevel bit level of created entities
184 * \param verb verbosity level
185 */
186 MoFEMErrorCode refineTris(const Range &tris, const BitRefLevel &bit,
187 int verb = QUIET, const bool debug = false);
188
190 int verb = QUIET, const bool debug = false);
191
192 /**\brief refine TRI in the meshset
193 *
194 * \param Range of entities to refine
195 * \param BitRefLevel bit level of created entities
196 * \param verb verbosity level
197 */
198 MoFEMErrorCode refineTrisHangingNodes(const EntityHandle meshset,
199 const BitRefLevel &bit,
200 int verb = QUIET,
201 const bool debug = false);
202
203 /**\brief refine TRI in the meshset
204 *
205 * \param Range of entities to refine
206 * \param BitRefLevel bit level of created entities
207 * \param verb verbosity level
208 */
210 const BitRefLevel &bit,
211 int verb = QUIET,
212 const bool debug = false);
213
214private:
215 struct SetParent {
216 map<EntityHandle, EntityHandle> parentsToChange;
217 MoFEMErrorCode operator()(const EntityHandle ent, const EntityHandle parent,
218 const RefEntity_multiIndex *ref_ents_ptr,
220
222 };
223
224
225 /**
226 * @brief Functions setting edges for refinemnt on enetity level
227 *
228 */
229 using SetEdgeBitsFun = boost::function<
230
231 MoFEMErrorCode(moab::Interface &moab,
233 &ref_parent_ents_view,
234 EntityHandle tet, BitRefEdges &parent_edges_bit,
235 EntityHandle *edge_new_nodes, int *split_edges
236
237 )>;
238
239 /**\brief refine TET in the meshset
240 *
241 * \param Range of tets to refine
242 * \param BitRefLevel bitLevel
243 * \param verb verbosity level
244 */
245 MoFEMErrorCode refineTets(const Range &tets, const BitRefLevel &bit,
246 SetEdgeBitsFun set_edge_bits, int verb,
247 const bool debug);
248
249 MoFEMErrorCode refineTris(const Range &tris, const BitRefLevel &bit,
250 SetEdgeBitsFun set_edge_bits, int verb,
251 const bool debug);
252};
253
254} // namespace MoFEM
255
256#endif // __MESHREFINE_HPP__
257
258/**
259 * \defgroup mofem_refiner MeshRefinement
260 * \brief Refine mesh by splitting edges
261 *
262 */
std::vector< int > parent
@ QUIET
static const bool debug
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition Types.hpp:34
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_non_unique< const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, hashed_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< boost::shared_ptr< RefEntity >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex_view_by_ordered_parent_entity
Core (interface) class.
Definition Core.hpp:83
MoFEMErrorCode operator()(const EntityHandle ent, const EntityHandle parent, const RefEntity_multiIndex *ref_ents_ptr, MoFEM::Core &cOre)
map< EntityHandle, EntityHandle > parentsToChange
Mesh refinement interface.
MoFEMErrorCode refineHexToTets(const Range &hexes, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
MoFEMErrorCode refineTetsHangingNodes(const Range &tets, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TET in the meshset
virtual ~MeshRefinement()=default
MoFEMErrorCode setTopologicalParents(const Range &source_entities, const Range &child_entities, const BitRefLevel &output_bit, int verb=QUIET, const std::map< EntityHandle, EntityHandle > &moved_vertices={})
MoFEMErrorCode refineTets(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TET in the meshset
MoFEMErrorCode setParents(const Range &source_entities, const Range &child_entities, const std::map< EntityHandle, EntityHandle > &vertex_parents, const BitRefLevel &output_bit, int verb=QUIET)
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode addVerticesInTheMiddleOfEdges(const EntityHandle meshset, const BitRefLevel &bit, const bool recursive=false, int verb=QUIET, EntityHandle start_v=0)
make vertices in the middle of edges in meshset and add them to refinement levels defined by bit
MoFEMErrorCode refinePrisms(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET)
refine PRISM in the meshset
MoFEMErrorCode refineTrisHangingNodes(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TRI in the meshset
boost::function< MoFEMErrorCode(moab::Interface &moab, RefEntity_multiIndex_view_by_ordered_parent_entity &ref_parent_ents_view, EntityHandle tet, BitRefEdges &parent_edges_bit, EntityHandle *edge_new_nodes, int *split_edges)> SetEdgeBitsFun
Functions setting edges for refinemnt on enetity level.
MoFEMErrorCode refineTris(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine triangles in the meshset
MoFEMErrorCode refineMeshset(const EntityHandle meshset, const BitRefLevel &bit, const bool recursive=false, int verb=QUIET)
refine meshset, i.e. add child of refined entities to meshset
base class for all interface classes