v0.13.0
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 /*
8  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  * License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
15  */
16 
17 #ifndef __MESHREFINE_HPP__
18 #define __MESHREFINE_HPP__
19 
20 namespace MoFEM {
21 
22 /** \brief Mesh refinement interface
23 
24  Currently this class is abstraction to Core interface. In future should be
25  outsourced as independent interface.
26 
27  \bug Not working on partitioned meshes
28  \bug Need to be implemented as a stand alone interface not as a part of core
29  structure which should be only basic database
30  \bug If outsourced, class member functions should follow name convention
31  \bug Spelling mistakes will be corrected with names fix to follow name
32  convetion
33 
34  \ingroup mofem_refiner
35  */
37 
38  MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
39  UnknownInterface **iface) const;
40 
42  MeshRefinement(const MoFEM::Core &core);
43 
44  virtual ~MeshRefinement() = default;
45 
46  /**
47  * \brief make vertices in the middle of edges in meshset and add them to
48  * refinement levels defined by bit
49  *
50  * Takes entities fromm meshsets and queried recursively (get entities from
51  * meshsets in meshsets, usually have to be used for CUBIT meshset).
52  * If meshset does not contain any edges, get entities in dimension 3 and get
53  * edge adjacencies.
54  *
55  * \param EntityHandle meshset
56  * \param BitRefLevel bitLevel
57  * \param recursive If true, meshsets containing meshsets are queried
58  * recursively. Returns the contents of meshsets, but not the meshsets
59  * themselves if true.
60  */
62  const BitRefLevel &bit,
63  const bool recursive = false,
64  int verb = QUIET,
65  EntityHandle start_v = 0);
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 from 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 Range consisting edges for refine
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  */
83  const BitRefLevel &bit,
84  int verb = QUIET,
85  EntityHandle start_v = 0);
86 
87  /**\brief refine TET in the meshset
88  *
89  * \param EntityHandle meshset
90  * \param BitRefLevel bitLevel
91  * \param verb verbosity level
92  */
94  int verb = QUIET, const bool debug = false);
95 
96  /**\brief refine TET in the meshset
97  *
98  * \param Range of tets to refine
99  * \param BitRefLevel bitLevel
100  * \param BitRefLevel bitLevel
101  * \param verb verbosity level
102  */
103  MoFEMErrorCode refineTets(const Range &tets, const BitRefLevel &bit,
104  int verb = QUIET, const bool debug = false);
105 
106  /**\brief refine TET in the meshset
107  *
108  * \param Range of tets to refine
109  * \param BitRefLevel bitLevel
110  * \param BitRefLevel bitLevel
111  * \param verb verbosity level
112  */
113  MoFEMErrorCode refineTetsHangingNodes(const Range &tets,
114  const BitRefLevel &bit,
115  int verb = QUIET,
116  const bool debug = false);
117 
118  /**\brief refine TET in the meshset
119  *
120  * \param Range of tets to refine
121  * \param BitRefLevel bitLevel
122  * \param BitRefLevel bitLevel
123  * \param verb verbosity level
124  */
126  const BitRefLevel &bit,
127  int verb = QUIET,
128  const bool debug = false);
129 
130  /**\brief refine PRISM in the meshset
131  *
132  * \param EntityHandle meshset
133  * \param BitRefLevel bitLevel
134  */
136  const BitRefLevel &bit, int verb = QUIET);
137 
138  /**\brief refine meshset, i.e. add child of refined entities to meshset
139  *
140  * \param EntityHandle meshset where to save the child refined entities
141  * \param BitRefLevel bitLevel
142  * \param recursive If true, meshsets containing meshsets are queried
143  * recursively. Returns the contents of meshsets, but not the meshsets
144  * themselves if true.
145  */
147  const BitRefLevel &bit,
148  const bool recursive = false, int verb = QUIET);
149 
150  /**\brief refine TET in the meshset
151  *
152  * \param EntityHandle meshset
153  * \param BitRefLevel bitLevel
154  * \param verb verbosity level
155  */
156  MoFEMErrorCode refineTris(const EntityHandle meshset, const BitRefLevel &bit,
157  int verb = QUIET, const bool debug = false);
158 
159  /**\brief refine TRI in the meshset
160  *
161  * \param Range of tets to refine
162  * \param BitRefLevel bitLevel
163  * \param BitRefLevel bitLevel
164  * \param verb verbosity level
165  */
166  MoFEMErrorCode refineTris(const Range &tris, const BitRefLevel &bit,
167  int verb = QUIET, const bool debug = false);
168 
169  /**\brief refine TRI in the meshset
170  *
171  * \param Range of tets to refine
172  * \param BitRefLevel bitLevel
173  * \param BitRefLevel bitLevel
174  * \param verb verbosity level
175  */
177  const BitRefLevel &bit,
178  int verb = QUIET,
179  const bool debug = false);
180 
181  /**\brief refine TRI in the meshset
182  *
183  * \param Range of tets to refine
184  * \param BitRefLevel bitLevel
185  * \param BitRefLevel bitLevel
186  * \param verb verbosity level
187  */
188  MoFEMErrorCode refineTrisHangingNodes(const Range &tris,
189  const BitRefLevel &bit,
190  int verb = QUIET,
191  const bool debug = false);
192 
193 private:
194  struct SetParent {
195  map<EntityHandle, EntityHandle> parentsToChange;
196  MoFEMErrorCode operator()(const EntityHandle ent, const EntityHandle parent,
197  const RefEntity_multiIndex *ref_ents_ptr,
198  MoFEM::Core &cOre);
199 
200  MoFEMErrorCode operator()(const RefEntity_multiIndex *ref_ents_ptr);
201  };
202 
203 
204  /**
205  * @brief Functions setting edges for refinemnt on enetity level
206  *
207  */
208  using SetEdgeBitsFun = boost::function<
209 
212  &ref_parent_ents_view,
213  EntityHandle tet, BitRefEdges &parent_edges_bit,
214  EntityHandle *edge_new_nodes, int *split_edges
215 
216  )>;
217 
218  /**\brief refine TET in the meshset
219  *
220  * \param Range of tets to refine
221  * \param BitRefLevel bitLevel
222  * \param verb verbosity level
223  */
224  MoFEMErrorCode refineTets(const Range &tets, const BitRefLevel &bit,
225  SetEdgeBitsFun set_edge_bits, int verb,
226  const bool debug);
227 
228  MoFEMErrorCode refineTris(const Range &tris, const BitRefLevel &bit,
229  SetEdgeBitsFun set_edge_bits, int verb,
230  const bool debug);
231 };
232 
233 } // namespace MoFEM
234 
235 #endif // __MESHREFINE_HPP__
236 
237 /**
238  * \defgroup mofem_refiner MeshRefinement
239  * \brief Refine mesh by splitting edges
240  *
241  */
@ QUIET
Definition: definitions.h:221
static const bool debug
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
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition: Types.hpp:45
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1965
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:92
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 refineTetsHangingNodes(const Range &tets, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TET in the meshset
virtual ~MeshRefinement()=default
MoFEMErrorCode refineTets(const EntityHandle meshset, const BitRefLevel &bit, int verb=QUIET, const bool debug=false)
refine TET in the meshset
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
MeshRefinement(const MoFEM::Core &core)
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 TET 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