ug4
volume util

contains methods to manipulate volumes More...

Functions

template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter (const VolumeVertices *vol, TAAPosVRT &aaPos, TAAWeightVRT &aaWeight)
 returns the weighted center of the vertices of the given volume More...
 
template<class TVertexPositionAttachmentAccessor >
UG_API TVertexPositionAttachmentAccessor::ValueType ug::CalculateCenter (const VolumeVertices *vol, TVertexPositionAttachmentAccessor &aaPosVRT)
 calculates the center of a volume by averaging the positions of its corners More...
 
number ug::CalculateHexahedronAspectRatio (Grid &grid, Hexahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 calculates the aspect ratio of a hexahedral element More...
 
UG_API number ug::CalculateHexahedronVolToRMSFaceAreaRatio (Grid &grid, Hexahedron *hex, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 
number ug::CalculateMinVolumeHeight (Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 calculates the minimal height of a volume element of type tetrahedron More...
 
number ug::CalculatePyramidAspectRatio (Grid &grid, Pyramid *pyr, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 calculates the aspect ratio of a pyramidal element Pyramid aspect ratio (AR) is the ratio of the height of the pyramid and the average length of the base's (quadrilateral) edges. The AR can be less than 1. The height is the distance from the base to the top of the pyramid in normal direction. More...
 
number ug::CalculateTetrahedronAspectRatio (Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 calculates the aspect ratio of a tetrahedral element More...
 
UG_API number ug::CalculateTetrahedronRootMeanSquareFaceArea (Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 
UG_API number ug::CalculateTetrahedronVolToRMSFaceAreaRatio (Grid &grid, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 
bool ug::CompareVertices (const VolumeVertices *vv1, const VolumeVertices *vv2)
 Checks whether vv1 and vv2 contain the same vertices. More...
 
template<class TAAPos >
UG_API bool ug::ContainsPoint (Volume *vol, const vector3 &p, TAAPos aaPos)
 Checks whether a given point lies in the given volume element. More...
 
template<class TVolIter >
void ug::ConvertToTetrahedra (Grid &grid, TVolIter volsBegin, TVolIter volsEnd)
 Converts all volumes in the given range to tetrahedra. More...
 
void ug::GetNeighbours (std::vector< Volume * > &vVolsOut, Grid &grid, Volume *v, int side, bool clearContainer=true)
 collects neighbours of the given side of a volume. More...
 
Vertexug::GetVertex (Volume *v, size_t i)
 returns the i'th vertex of a volume More...
 
void ug::InsertCenterVertex (Grid &g, Volume *vol, Vertex *vrt, bool eraseOldVol)
 Refines the volume by connecting its sides with the new center. More...
 
size_t ug::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. More...
 
UG_API bool ug::PointIsInsideTetrahedron (const vector3 &v, Tetrahedron *tet, Grid::VertexAttachmentAccessor< APosition > &aaPos)
 returns true if the point lies inside the tetrahedron More...
 
bool ug::VolumeContains (Volume *v, EdgeVertices *ev)
 returns true if the given volume contains the given edge More...
 
bool ug::VolumeContains (Volume *v, FaceVertices *fv)
 returns true if the given volume contains the given face More...
 
bool ug::VolumeContains (VolumeVertices *v, Vertex *vrt)
 returns true if the given volume contains the given vertex More...
 
size_t ug::NumVertices (Vertex *elem)
 Returns the number of vertices of the given geometric object. More...
 
size_t ug::NumVertices (Edge *elem)
 Returns the number of vertices of the given geometric object. More...
 
size_t ug::NumVertices (Face *elem)
 Returns the number of vertices of the given geometric object. More...
 
size_t ug::NumVertices (Volume *elem)
 Returns the number of vertices of the given geometric object. More...
 

Detailed Description

contains methods to manipulate volumes

Function Documentation

◆ CalculateCenter() [1/2]

template<class TAAPosVRT , class TAAWeightVRT >
UG_API TAAPosVRT::ValueType ug::CalculateCenter ( const VolumeVertices vol,
TAAPosVRT &  aaPos,
TAAWeightVRT &  aaWeight 
)

returns the weighted center of the vertices of the given volume

TAAWeightVRT has to be an attachment to the vertices of the grid in which v is contained, with ValueType number (or compatible).

References ug::VolumeVertices::num_vertices(), ug::VecScale(), ug::VecScaleAppend(), ug::VecSet(), and ug::VolumeVertices::vertices().

◆ CalculateCenter() [2/2]

template<class TVertexPositionAttachmentAccessor >
UG_API TVertexPositionAttachmentAccessor::ValueType ug::CalculateCenter ( const VolumeVertices vol,
TVertexPositionAttachmentAccessor &  aaPosVRT 
)

calculates the center of a volume by averaging the positions of its corners

References ug::VolumeVertices::num_vertices(), ug::VecAdd(), ug::VecScale(), ug::VecSet(), and ug::VolumeVertices::vertices().

◆ CalculateHexahedronAspectRatio()

UG_API number ug::CalculateHexahedronAspectRatio ( Grid grid,
Hexahedron hex,
Grid::VertexAttachmentAccessor< AVector3 > &  aaPos 
)

calculates the aspect ratio of a hexahedral element

Max distance to face center

Min distance to node of hexaeder

References ug::CalculateCenter(), ug::CalculateNormal(), ug::CollectAssociated(), ug::Hexahedron::num_vertices(), ug::SMALL, UG_COND_WARNING, ug::VecDistance(), ug::VecDot(), ug::VecSubtract(), and ug::Hexahedron::vertex().

Referenced by ug::CalculateAspectRatio().

◆ CalculateHexahedronVolToRMSFaceAreaRatio()

UG_API number ug::CalculateHexahedronVolToRMSFaceAreaRatio ( Grid grid,
Hexahedron hex,
Grid::VertexAttachmentAccessor< APosition > &  aaPos 
)

References UG_THROW.

Referenced by ug::CalculateVolToRMSFaceAreaRatio().

◆ CalculateMinVolumeHeight()

◆ CalculatePyramidAspectRatio()

UG_API number ug::CalculatePyramidAspectRatio ( Grid grid,
Pyramid pyr,
Grid::VertexAttachmentAccessor< APosition > &  aaPos 
)

calculates the aspect ratio of a pyramidal element Pyramid aspect ratio (AR) is the ratio of the height of the pyramid and the average length of the base's (quadrilateral) edges. The AR can be less than 1. The height is the distance from the base to the top of the pyramid in normal direction.

Parameters
[in]grid
[in]pyr
[in]aaPos
Returns
AR of pyramid as number

References ug::CalculateNormal(), ug::Grid::get_element(), ug::VecDistance(), ug::VecDot(), and ug::Pyramid::vertex().

Referenced by ug::CalculateAspectRatio().

◆ CalculateTetrahedronAspectRatio()

UG_API number ug::CalculateTetrahedronAspectRatio ( Grid grid,
Tetrahedron tet,
Grid::VertexAttachmentAccessor< AVector3 > &  aaPos 
)

◆ CalculateTetrahedronRootMeanSquareFaceArea()

UG_API number ug::CalculateTetrahedronRootMeanSquareFaceArea ( Grid grid,
Tetrahedron tet,
Grid::VertexAttachmentAccessor< APosition > &  aaPos 
)

◆ CalculateTetrahedronVolToRMSFaceAreaRatio()

◆ CompareVertices()

UG_API bool ug::CompareVertices ( const VolumeVertices vv1,
const VolumeVertices vv2 
)

Checks whether vv1 and vv2 contain the same vertices.

Can be used to compare Volume with Volume, VolumeDescriptor with VolumeDescriptor or Volume with VolumeDescriptor.

Before calling this method one should consider to compare the hashes of vv1 and vv2 (if(hash_key(vv1) == hash_key(vv2))...)

References ug::VolumeVertices::num_vertices(), and ug::VolumeVertices::vertices().

Referenced by ug::FaceContains(), and ug::VolumeContains().

◆ ContainsPoint()

template<class TAAPos >
UG_API bool ug::ContainsPoint ( Volume vol,
const vector3 p,
TAAPos  aaPos 
)

Checks whether a given point lies in the given volume element.

Note
This method assumes that the given volume element is convex and has planar sides.

References ug::CalculateNormalNoNormalize(), ug::Volume::edge_desc(), ug::EdgeLength(), ug::Volume::face_desc(), ug::Volume::num_faces(), p, ug::SMALL, ug::VecDot(), ug::VecSubtract(), and ug::FaceDescriptor::vertex().

◆ ConvertToTetrahedra()

◆ GetNeighbours()

UG_API void ug::GetNeighbours ( std::vector< Volume * > &  vVolsOut,
Grid grid,
Volume v,
int  side,
bool  clearContainer = true 
)

collects neighbours of the given side of a volume.

This algorithm uses Grid::mark.

if VOLOPT_AUTOGENERATE_FACES and FACEOPT_STORE_ASSOCIATED_VOLUMES are activated in grid, performance is considerably better.

collects all volumes that are adjacent to the given side of v.

References ug::Grid::associated_volumes_begin(), ug::Grid::associated_volumes_end(), ug::Grid::begin_marking(), ug::Grid::end_marking(), ug::Volume::face_desc(), ug::FACEOPT_STORE_ASSOCIATED_VOLUMES, ug::Grid::get_face(), ug::Grid::is_marked(), ug::Grid::mark(), ug::FaceDescriptor::num_vertices(), ug::VolumeVertices::num_vertices(), ug::Grid::option_is_enabled(), ug::FaceDescriptor::vertex(), ug::VolumeVertices::vertex(), and ug::VOLOPT_AUTOGENERATE_FACES.

◆ GetVertex()

Vertex * ug::GetVertex ( Volume v,
size_t  i 
)
inline

returns the i'th vertex of a volume

This function simply returns the i'th vertex of a volume

References boost::num_vertices(), UG_ASSERT, and ug::VolumeVertices::vertex().

◆ InsertCenterVertex()

void ug::InsertCenterVertex ( Grid g,
Volume vol,
Vertex vrt,
bool  eraseOldVol 
)

Refines the volume by connecting its sides with the new center.

Make sure that the specified vertex is belongs to the specified grid, and that its position lies inside the specified volume (self-intersections would occur if it would lie outside). The original volume may optionally be deleted.

References ug::Grid::create(), ug::Grid::erase(), ug::Volume::face_desc(), ug::Volume::num_faces(), ug::FaceDescriptor::num_vertices(), UG_THROW, and ug::FaceDescriptor::vertex().

◆ IntersectPlaneWithTetrahedron()

size_t ug::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.

This method evaluates the intersection points of a tetrahedron with a plane. There are 3 or 4 points, the number of the points is returned. If there are 4 intersection points, there order in intsOut corresponds to either the clockwise or counterclockwise ordering of the corners of the quadrilateral.

Note that the ordering of the corners of the tetrahedron is important and must correspond to the standard ordering!

Proper return values: 0, 3 or 4.

Parameters
intsOutintersection points
planePointa point on the plane
planeNormala normal to the plane
tcoordinates of the corners of the tetrahedron (order is important!)

References ug::hex_rules::EDGE_VRT_INDS, ug::hex_rules::NUM_EDGES, ug::tet_rules::OPPOSED_EDGE, p, ug::RayPlaneIntersection(), s, UG_THROW, and ug::VecSubtract().

◆ NumVertices() [1/4]

size_t ug::NumVertices ( Edge elem)
inline

Returns the number of vertices of the given geometric object.

Valid template arguments are Vertex, Edge, Face, Volume and derived types.

unifies access to geometric objects.

References ug::EdgeVertices::num_vertices().

◆ NumVertices() [2/4]

size_t ug::NumVertices ( Face elem)
inline

Returns the number of vertices of the given geometric object.

Valid template arguments are Vertex, Edge, Face, Volume and derived types.

unifies access to geometric objects.

References ug::FaceVertices::num_vertices().

◆ NumVertices() [3/4]

size_t ug::NumVertices ( Vertex elem)
inline

Returns the number of vertices of the given geometric object.

Valid template arguments are Vertex, Edge, Face, Volume and derived types.

unifies access to geometric objects.

Referenced by ug::CalculateBoundingBox(), ug::CollectCornerCoordinates(), and ug::MarkForRefinement_ContainsSurfaceNode().

◆ NumVertices() [4/4]

size_t ug::NumVertices ( Volume elem)
inline

Returns the number of vertices of the given geometric object.

Valid template arguments are Vertex, Edge, Face, Volume and derived types.

unifies access to geometric objects.

References ug::VolumeVertices::num_vertices().

◆ PointIsInsideTetrahedron()

bool ug::PointIsInsideTetrahedron ( const vector3 v,
Tetrahedron tet,
Grid::VertexAttachmentAccessor< APosition > &  aaPos 
)
inline

returns true if the point lies inside the tetrahedron

References ug::PointIsInsideTetrahedron(), and ug::Tetrahedron::vertex().

◆ VolumeContains() [1/3]

UG_API bool ug::VolumeContains ( Volume v,
EdgeVertices ev 
)

returns true if the given volume contains the given edge

returns true if the given volume contains the given edge

References ug::CompareVertices(), ug::Volume::edge_desc(), and ug::Volume::num_edges().

◆ VolumeContains() [2/3]

UG_API bool ug::VolumeContains ( Volume v,
FaceVertices f 
)

returns true if the given volume contains the given face

returns true if the given volume contains the given face

References ug::CompareVertices(), ug::Volume::face_desc(), ug::hash_key(), and ug::Volume::num_faces().

Referenced by ug::CollectVolumes().

◆ VolumeContains() [3/3]

bool ug::VolumeContains ( VolumeVertices v,
Vertex vrt 
)