ug4
volume_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015: G-CSC, Goethe University Frankfurt
3  * Authors: Sebastian Reiter, 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__LIB_GRID__VOLUME_UTIL__
34 #define __H__LIB_GRID__VOLUME_UTIL__
35 
36 #include <vector>
37 #include "lib_grid/grid/grid.h"
40 
41 namespace ug
42 {
43 
53 // GetNeighbours - sreiter
55 
63 UG_API
64 void GetNeighbours(std::vector<Volume*>& vVolsOut, Grid& grid, Volume* v,
65  int side, bool clearContainer = true);
66 
67 
69 // CalculateVolumeMinHeight - mstepnie
71 UG_API
72 number CalculateMinVolumeHeight(Tetrahedron* tet,
73  Grid::VertexAttachmentAccessor<APosition>& aaPos);
74 
75 
77 // CalculateTetrahedronAspectRatio - mstepnie
79 UG_API
80 number CalculateTetrahedronAspectRatio(Grid& grid, Tetrahedron* tet,
81  Grid::VertexAttachmentAccessor<APosition>& aaPos);
82 
84 // CalculateHexahedronAspectRatio
86 UG_API
87 number CalculateHexahedronAspectRatio(Grid& grid, Hexahedron* tet,
88  Grid::VertexAttachmentAccessor<APosition>& aaPos);
89 
91 // CalculatePyramidAspectRatio
103 UG_API
105 (
106  Grid& grid,
107  Pyramid* pyr,
108  Grid::VertexAttachmentAccessor<APosition>& aaPos
109 );
110 
111 
113 // CalculateTetrahedronRootMeanSquareFaceArea - mstepnie
115 UG_API
117  Tetrahedron* tet,
118  Grid::VertexAttachmentAccessor<APosition>& aaPos);
119 
120 
122 // CalculateTetrahedronVolToRMSFaceAreaRatio - mstepnie
124 UG_API
126  Tetrahedron* tet,
127  Grid::VertexAttachmentAccessor<APosition>& aaPos);
128 
130 // CalculateTetrahedronVolToRMSFaceAreaRatio - sgrein
132 UG_API
134  Hexahedron* hex,
135  Grid::VertexAttachmentAccessor<APosition>& aaPos);
136 
137 
138 
139 
141 // PointIsInsideTetrahedron - sreiter
143 UG_API
144 inline bool
145 PointIsInsideTetrahedron(const vector3& v, Tetrahedron* tet,
146  Grid::VertexAttachmentAccessor<APosition>& aaPos);
147 
148 
151 
164 (
165  vector3 intsOut[4],
166  const vector3& planePoint,
167  const vector3& planeNormal,
168  const vector3 t[4]
169 );
170 
173 
176 template <class TAAPos>
177 UG_API bool
178 ContainsPoint(Volume* vol, const vector3& p, TAAPos aaPos);
179 
180 
183 template<class TVertexPositionAttachmentAccessor>
184 UG_API
185 typename TVertexPositionAttachmentAccessor::ValueType
186 CalculateCenter(const VolumeVertices* vol, TVertexPositionAttachmentAccessor& aaPosVRT);
187 
190 
193 template<class TAAPosVRT, class TAAWeightVRT>
194 UG_API
195 typename TAAPosVRT::ValueType
196 CalculateCenter(const VolumeVertices* vol, TAAPosVRT& aaPos, TAAWeightVRT& aaWeight);
197 
198 
201 
206 void InsertCenterVertex(Grid& g, Volume* vol, Vertex* vrt, bool eraseOldVol);
207 
208 
211 template <class TVolIter>
212 void ConvertToTetrahedra (
213  Grid& grid,
214  TVolIter volsBegin,
215  TVolIter volsEnd);
216 
217 }// end of namespace
218 
221 // include implementation
222 #include "volume_util_impl.hpp"
223 
224 #endif
UG_API bool ContainsPoint(const EdgeVertices *e, const vector_t &p, TAAPos aaPos)
Returns true if the given point lies on the given edge.
Definition: edge_util_impl.hpp:513
void GetNeighbours(std::vector< Face * > &vFacesOut, Grid &grid, Face *f, int side, bool clearContainer)
collects neighbours of the given side of a face.
Definition: face_util.cpp:363
void InsertCenterVertex(Grid &g, Face *f, Vertex *vrt, bool eraseOldFace)
Refines the face by connecting its sides with the new center.
Definition: face_util.cpp:394
void ConvertToTetrahedra(Grid &grid, TVolIter volsBegin, TVolIter volsEnd)
Converts all volumes in the given range to tetrahedra.
Definition: volume_util_impl.hpp:162
UG_API number CalculateHexahedronVolToRMSFaceAreaRatio(Grid &grid, Hexahedron *hex, Grid::VertexAttachmentAccessor< APosition > &aaPos)
Definition: volume_util.cpp:313
UG_API number CalculateTetrahedronVolToRMSFaceAreaRatio(Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
Definition: volume_util.cpp:285
number CalculateMinVolumeHeight(Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
calculates the minimal height of a volume element of type tetrahedron
Definition: volume_util.cpp:109
UG_API number CalculateTetrahedronRootMeanSquareFaceArea(Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
Definition: volume_util.cpp:257
number CalculatePyramidAspectRatio(Grid &grid, Pyramid *pyr, Grid::VertexAttachmentAccessor< AVector3 > &aaPos)
calculates the aspect ratio of a pyramidal element Pyramid aspect ratio (AR) is the ratio of the heig...
Definition: volume_util.cpp:228
size_t IntersectPlaneWithTetrahedron(vector3 intsOut[4], const vector3 &planePoint, const vector3 &planeNormal, const vector3 t[4])
Returns the number of intersections and the intersection points in intsOut.
Definition: volume_util.cpp:325
number CalculateHexahedronAspectRatio(Grid &grid, Hexahedron *hex, Grid::VertexAttachmentAccessor< AVector3 > &aaPos)
calculates the aspect ratio of a hexahedral element
Definition: volume_util.cpp:171
number CalculateTetrahedronAspectRatio(Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< AVector3 > &aaPos)
calculates the aspect ratio of a tetrahedral element
Definition: volume_util.cpp:138
#define UG_API
Definition: ug_config.h:65
double number
Definition: types.h:124
void CalculateCenter(vector_t &centerOut, const vector_t *pointSet, size_t numPoints)
calculates the center of a point-set
Definition: math_util_impl.hpp:98
bool PointIsInsideTetrahedron(const vector_t &v, const vector_t &v0, const vector_t &v1, const vector_t &v2, const vector_t &v3)
Returns true if the point lies inside or on the boundary of a tetrahedron.
Definition: math_util_impl.hpp:1110
MathVector< 3, number > vector3
a 3d vector
Definition: ugmath_types.h:72
the ug namespace