ug4
subdivision_volumes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2021: G-CSC, Goethe University Frankfurt
3  * Author: Martin Stepniewski
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__SUBDIVISION_VOLUMES__
34 #define __H__UG__SUBDIVISION_VOLUMES__
35 
36 #include <vector>
37 #include <cassert>
38 #include "lib_grid/lg_base.h"
44 
45 #ifdef UG_PARALLEL
51 #endif
52 
54 
55 namespace ug
56 {
57 
58 
60 // Global boundary refinement rule setup
62 
65 {
66  LINEAR, // the default value
71 };
72 
75 
78 
79 
81 
88 void CheckValences(MultiGrid& mg, MGSubsetHandler& markSH, const char* filename);
89 
90 
92 
96 
97 
99 
127 void SplitOctahedronToTetrahedrons( Grid& grid, Octahedron* oct, Volume* parentVol,
128  std::vector<Tetrahedron*>& vTetsOut, int bestDiag);
129 
130 
132 
141 void TetrahedralizeHybridTetOctGrid(MultiGrid& mg, int bestDiag);
142 
143 
145 
151 template <class TAPosition>
152 void ProjectHierarchyToSubdivisionLimit(MultiGrid& mg, TAPosition& aPos);
153 
154 
156 
168 template <class TAPosition>
169 void CalculateSmoothCreaseManifoldPosInParentLevelLoopScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
170  MGSubsetHandler& linearManifoldSH,
171  TAPosition& aSmoothBndPosEvenVrt,
172  TAPosition& aSmoothBndPosOddVrt,
173  AInt& aNumManifoldEdges);
174 
175 
177 
188 template <class TAPosition>
189 void CalculateSmoothManifoldPosInParentLevelLoopScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
190  MGSubsetHandler& linearManifoldSH,
191  TAPosition& aSmoothBndPosEvenVrt,
192  TAPosition& aSmoothBndPosOddVrt,
193  AInt& aNumManifoldEdges);
194 
195 
197 
207 template <class TAPosition>
208 void CalculateSmoothManifoldPosInTopLevelAveragingScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
209  MGSubsetHandler& linearManifoldSH,
210  TAPosition& aSmoothBndPos_tri,
211  TAPosition& aSmoothBndPos_quad);
212 
213 
215 
225 template <class TAPosition>
226 void CalculateSmoothManifoldPosInParentLevelButterflyScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
227  MGSubsetHandler& linearManifoldSH,
228  TAPosition& aSmoothBndPosOddVrt,
229  AInt& aNumManifoldEdges);
230 
231 
233 
242 void CalculateSmoothVolumePosInTopLevel(MultiGrid& mg, MGSubsetHandler& markSH,
243  APosition& aSmoothVolPos_toc,
244  APosition& aSmoothVolPos_prism,
245  APosition& aSmoothVolPos_hex);
246 
247 
249 
257  APosition& aSmoothVolPos_toc);
258 
259 
261 
269 void CalculateNumElemsVertexAttachmentInTopLevel(MultiGrid& mg, AInt& aNumElems_toc, AInt& aNumElems_prism, AInt& aNumElems_hex);
270 
271 
273 
283  AInt& aNumManifoldEdges, bool bCreaseSurf);
284 
285 
287 
295 void CalculateNumManifoldFacesVertexAttachmentInTopLevel(MultiGrid& mg, MGSubsetHandler& markSH, AInt& aNumManifoldFaces_tri, AInt& aNumManifoldFaces_quad);
296 
297 
299 
305 void InitLinearManifoldSubsetHandler(MultiGrid& mg, MGSubsetHandler& sh,
306  MGSubsetHandler& linearManifoldSH,
307  const char* linearManifoldSubsets);
308 
309 
311 
321 template <class TAPosition>
322 void ApplySmoothManifoldPosToTopLevelLoopScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
323  MGSubsetHandler& linearManifoldSH, bool bCreaseSurf);
324 
325 
327 
335 template <class TAPosition>
336 void ApplySmoothManifoldPosToTopLevelButterflyScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
337  MGSubsetHandler& linearManifoldSH);
338 
339 
341 
349 template <class TAPosition>
350 void ApplySmoothManifoldPosToTopLevelAveragingScheme(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& markSH,
351  MGSubsetHandler& linearManifoldSH);
352 
353 
355 
362 void ApplySmoothVolumePosToTopLevel(MultiGrid& mg, MGSubsetHandler& markSH,
363  bool bConstrained);
364 
365 
367 
379 template <class TAPosition>
380 void ApplySmoothSubdivisionSurfacesToTopLevel(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& sh,
381  MGSubsetHandler& markSH, MGSubsetHandler& linearManifoldSH,
382  bool bCreaseSurf);
383 
384 
386 
397  MGSubsetHandler& linearManifoldSH, bool bConstrained);
398 
399 
401 
411 template <class TAPosition>
412 void ApplySmoothSubdivisionSurfacesToTopLevel(MultiGrid& mg, TAPosition& aPos, MGSubsetHandler& sh,
413  MGSubsetHandler& markSH, const char* linearManifoldSubsets,
414  bool bCreaseSurf);
415 
417  const char* linearManifoldSubsets);
418 
419 
421  const char* linearManifoldSubsets);
422 
423 
424 }// end of namespace
425 
426 #endif
the ug namespace
void ApplySmoothSubdivisionVolumesToTopLevel(MultiGrid &mg, MGSubsetHandler &sh, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, bool bConstrained)
Function to create a smooth subdivision volumes hierarchy.
Definition: subdivision_volumes.cpp:2955
void ApplySmoothManifoldPosToTopLevelLoopScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, bool bCreaseSurf)
Toplevel vertex repositioning function for subdivision surfaces refinement (by C. Loop,...
Definition: subdivision_volumes.cpp:2304
GlobalBoundaryRefinementRule GetBoundaryRefinementRule()
get procedure for boundary refinement rule variable
Definition: subdivision_volumes.cpp:51
void PrintSubdivisionVolumesRefinementMask()
Function for printing the subdivision volumes tet-oct refinement mask.
Definition: subdivision_volumes.cpp:141
void CalculateNumManifoldEdgesVertexAttachmentInParentLevel(MultiGrid &mg, MGSubsetHandler &markSH, AInt &aNumManifoldEdges, bool bCreaseSurf)
Function for calculating the number of associated manifold edges of all parent level vertices.
Definition: subdivision_volumes.cpp:2033
void CalculateSmoothVolumePosInTopLevel(MultiGrid &mg, MGSubsetHandler &markSH, APosition &aSmoothVolPos_toc, APosition &aSmoothVolPos_prism, APosition &aSmoothVolPos_hex)
Toplevel vertex smoothing function for subdivision volumes refinement.
Definition: subdivision_volumes.cpp:1638
void CheckValences(MultiGrid &mg, MGSubsetHandler &markSH, const char *filename)
Function for checking the number of associated volumes of all edges.
Definition: subdivision_volumes.cpp:58
void ApplySmoothManifoldPosToTopLevelAveragingScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH)
Toplevel vertex repositioning function for subdivision surfaces refinement (Averaging scheme)
Definition: subdivision_volumes.cpp:2625
Attachment< int > AInt
Definition: common_attachments.h:55
void CalculateNumManifoldFacesVertexAttachmentInTopLevel(MultiGrid &mg, MGSubsetHandler &markSH, AInt &aNumManifoldFaces_tri, AInt &aNumManifoldFaces_quad)
Function for calculating the number of associated manifold faces of all toplevel manifold vertices.
Definition: subdivision_volumes.cpp:2122
void ApplyConstrainedSmoothSubdivisionVolumesToTopLevel(MultiGrid &mg, MGSubsetHandler &sh, MGSubsetHandler &markSH, const char *linearManifoldSubsets)
Definition: subdivision_volumes.cpp:3037
void CalculateSmoothManifoldPosInParentLevelButterflyScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, TAPosition &aSmoothBndPosOddVrt, AInt &aNumManifoldEdges)
Parent level vertex smoothing function for subdivision surfaces refinement (Butterfly scheme)
Definition: subdivision_volumes.cpp:1216
void ApplySmoothSubdivisionSurfacesToTopLevel(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &sh, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, bool bCreaseSurf)
Function to create a smooth subdivision volumes hierarchy.
Definition: subdivision_volumes.cpp:2894
void CalculateSmoothManifoldPosInParentLevelLoopScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, TAPosition &aSmoothBndPosEvenVrt, TAPosition &aSmoothBndPosOddVrt, AInt &aNumManifoldEdges)
Parent level vertex smoothing function for subdivision surfaces refinement (by C. Loop,...
Definition: subdivision_volumes.cpp:879
void InitLinearManifoldSubsetHandler(MultiGrid &mg, MGSubsetHandler &sh, MGSubsetHandler &linearManifoldSH, const char *linearManifoldSubsets)
Procedure to initialize the linear boundary manifold subsets SubsetHandler with user-specified subset...
Definition: subdivision_volumes.cpp:2189
APosition3 APosition
Definition: common_attachments.h:76
void TetrahedralizeHybridTetOctGrid(MultiGrid &mg, int bestDiag)
Conversion function for hybrid tetra-/octahedral multigrids.
Definition: subdivision_volumes.cpp:460
void SetBoundaryRefinementRule(GlobalBoundaryRefinementRule refRule)
setting procedure for global boundary refinement rule variable
Definition: subdivision_volumes.cpp:44
void ProjectHierarchyToSubdivisionLimit(MultiGrid &mg, TAPosition &aPos)
Projection function for smooth subdivision (volumes+surface) refinement.
Definition: subdivision_volumes.cpp:516
MultiGridSubsetHandler MGSubsetHandler
Definition: subset_handler_multi_grid.h:377
void CalculateNumElemsVertexAttachmentInTopLevel(MultiGrid &mg, AInt &aNumElems_toc, AInt &aNumElems_prism, AInt &aNumElems_hex)
Function for calculating the number of associated volumes of all toplevel vertices.
Definition: subdivision_volumes.cpp:1964
void CalculateConstrainedSmoothVolumePosInTopLevel(MultiGrid &mg, MGSubsetHandler &markSH, APosition &aSmoothVolPos_toc)
Toplevel vertex smoothing function for subdivision volumes refinement.
Definition: subdivision_volumes.cpp:1803
void CalculateSmoothCreaseManifoldPosInParentLevelLoopScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, TAPosition &aSmoothBndPosEvenVrt, TAPosition &aSmoothBndPosOddVrt, AInt &aNumManifoldEdges)
Parent level vertex smoothing function for subdivision crease surfaces refinement (by C....
Definition: subdivision_volumes.cpp:587
GlobalBoundaryRefinementRule
enumeration for identification of global boundary refinement rule to be used
Definition: subdivision_volumes.h:65
@ SUBDIV_SURF_BUTTERFLY_SCHEME
Definition: subdivision_volumes.h:69
@ SUBDIV_VOL
Definition: subdivision_volumes.h:70
@ SUBDIV_SURF_AVERAGING_SCHEME
Definition: subdivision_volumes.h:68
@ LINEAR
Definition: subdivision_volumes.h:66
@ SUBDIV_SURF_LOOP_SCHEME
Definition: subdivision_volumes.h:67
void SplitOctahedronToTetrahedrons(Grid &grid, Octahedron *oct, Volume *parentVol, std::vector< Tetrahedron * > &vTetsOut, int bestDiag)
Function for splitting an octahedron to 4 sub-tetrahedrons.
Definition: subdivision_volumes.cpp:283
void CalculateSmoothManifoldPosInTopLevelAveragingScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH, TAPosition &aSmoothBndPos_tri, TAPosition &aSmoothBndPos_quad)
Toplevel vertex smoothing function for subdivision surfaces refinement (Averaging scheme)
Definition: subdivision_volumes.cpp:1101
void ApplySmoothManifoldPosToTopLevelButterflyScheme(MultiGrid &mg, TAPosition &aPos, MGSubsetHandler &markSH, MGSubsetHandler &linearManifoldSH)
Toplevel vertex repositioning function for subdivision surfaces refinement (Butterfly scheme)
Definition: subdivision_volumes.cpp:2481
void ApplySmoothVolumePosToTopLevel(MultiGrid &mg, MGSubsetHandler &markSH, bool bConstrained)
Toplevel vertex repositioning function for subdivision volumes refinement.
Definition: subdivision_volumes.cpp:2752