ug4
|
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... | |
Vertex * | ug::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... | |
contains methods to manipulate volumes
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().
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().
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().
UG_API number ug::CalculateHexahedronVolToRMSFaceAreaRatio | ( | Grid & | grid, |
Hexahedron * | hex, | ||
Grid::VertexAttachmentAccessor< APosition > & | aaPos | ||
) |
References UG_THROW.
Referenced by ug::CalculateVolToRMSFaceAreaRatio().
UG_API number ug::CalculateMinVolumeHeight | ( | Tetrahedron * | tet, |
Grid::VertexAttachmentAccessor< APosition > & | aaPos | ||
) |
calculates the minimal height of a volume element of type tetrahedron
References ug::CalculateNormal(), ug::DistancePointToPlane(), ug::Tetrahedron::face_desc(), ug::Tetrahedron::get_opposing_object(), ug::FaceDescriptor::vertex(), and ug::Tetrahedron::vertex().
Referenced by ug::CalculateTetrahedronAspectRatio(), and ug::TetrahedronAspectRatio().
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.
[in] | grid | |
[in] | pyr | |
[in] | aaPos |
AR
of pyramid as number References ug::CalculateNormal(), ug::Grid::get_element(), ug::VecDistance(), ug::VecDot(), and ug::Pyramid::vertex().
Referenced by ug::CalculateAspectRatio().
UG_API number ug::CalculateTetrahedronAspectRatio | ( | Grid & | grid, |
Tetrahedron * | tet, | ||
Grid::VertexAttachmentAccessor< AVector3 > & | aaPos | ||
) |
calculates the aspect ratio of a tetrahedral element
References ug::CalculateMinVolumeHeight(), ug::CollectAssociated(), ug::EdgeLength(), and ug::FindLongestEdge().
Referenced by ug::AssignTetrahedronAttributesByAspectRatio(), and ug::CalculateAspectRatio().
UG_API number ug::CalculateTetrahedronRootMeanSquareFaceArea | ( | Grid & | grid, |
Tetrahedron * | tet, | ||
Grid::VertexAttachmentAccessor< APosition > & | aaPos | ||
) |
References ug::CollectAssociated(), and ug::FaceArea().
Referenced by ug::CalculateTetrahedronVolToRMSFaceAreaRatio().
UG_API number ug::CalculateTetrahedronVolToRMSFaceAreaRatio | ( | Grid & | grid, |
Tetrahedron * | tet, | ||
Grid::VertexAttachmentAccessor< APosition > & | aaPos | ||
) |
References ug::CalculateTetrahedronRootMeanSquareFaceArea(), ug::CalculateTetrahedronVolume(), and ug::Tetrahedron::vertex().
Referenced by ug::CalculateVolToRMSFaceAreaRatio().
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().
UG_API bool ug::ContainsPoint | ( | Volume * | vol, |
const vector3 & | p, | ||
TAAPos | aaPos | ||
) |
Checks whether a given point lies in the given volume element.
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().
void ug::ConvertToTetrahedra | ( | Grid & | grid, |
TVolIter | volsBegin, | ||
TVolIter | volsEnd | ||
) |
Converts all volumes in the given range to tetrahedra.
References ug::Grid::associated_elements(), ug::Grid::begin_marking(), ug::prism_rules::ConvertToTetrahedra(), ug::pyra_rules::ConvertToTetrahedra(), ug::Grid::create(), ug::PointerConstArray< TPtr >::empty(), end_for, ug::Grid::end_marking(), ug::Grid::erase(), for_each_in_vec, ug::GOID_TETRAHEDRON, ug::Grid::is_marked(), ug::Grid::mark(), ug::hex_rules::MAX_NUM_CONVERT_TO_TETS_INDS_OUT, ug::prism_rules::MAX_NUM_CONVERT_TO_TETS_INDS_OUT, ug::pyra_rules::MAX_NUM_CONVERT_TO_TETS_INDS_OUT, ug::FaceVertices::num_vertices(), ug::Volume::reference_object_id(), ug::ROID_HEXAHEDRON, ug::ROID_PRISM, ug::ROID_PYRAMID, UG_COND_THROW, UG_STATIC_ASSERT, UG_THROW, ug::FaceVertices::vertex(), and ug::VolumeVertices::vertices().
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.
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().
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().
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.
intsOut | intersection points |
planePoint | a point on the plane |
planeNormal | a normal to the plane |
t | coordinates 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().
|
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().
|
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().
|
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().
|
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().
|
inline |
returns true if the point lies inside the tetrahedron
References ug::PointIsInsideTetrahedron(), and ug::Tetrahedron::vertex().
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().
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().
bool ug::VolumeContains | ( | VolumeVertices * | v, |
Vertex * | vrt | ||
) |
returns true if the given volume contains the given vertex
returns true if the given volume contains the given vertex
References ug::VolumeVertices::num_vertices(), and ug::VolumeVertices::vertices().
Referenced by ug::grid_unit_tests::CheckAssociatedEdgesOfVolumes(), ug::grid_unit_tests::CheckAssociatedVolumesOfEdges(), ug::Grid::get_associated_vols_raw(), ug::NumAssociatedVolumes(), and ug::Grid::replace_vertex_is_valid().