ug4
ug::Volume Class Reference

Volumes are 3-dimensional objects. More...

#include <grid_base_objects.h>

+ Inheritance diagram for ug::Volume:

Public Types

typedef Volume grid_base_object
 
typedef void higher_dim_base_object
 
typedef Face lower_dim_base_object
 
typedef Face side
 
typedef Volume sideof
 
- Public Types inherited from ug::IVertexGroup
typedef Vertex *const * ConstVertexArray
 

Public Member Functions

virtual int base_object_id () const
 
virtual bool collapse_edge (std::vector< Volume * > &vNewVolumesOut, int edgeIndex, Vertex *newVertex, std::vector< Vertex * > *pvSubstituteVertices=NULL)
 
virtual int container_section () const
 
virtual Edgecreate_edge (int index)
 create the edge with index i and return it. More...
 
virtual Facecreate_face (int index)
 create the face with index i and return it. More...
 
virtual EdgeDescriptor edge_desc (int index) const
 
virtual void edge_desc (int index, EdgeDescriptor &edOut) const
 
virtual FaceDescriptor face_desc (int index) const
 
virtual void face_desc (int index, FaceDescriptor &fdOut) const
 
virtual int get_edge_index_from_vertices (const size_t vi0, const size_t vi1) const
 returns the local index of the edge which connects the two vertex indices. More...
 
virtual int get_face_edge_index (const size_t faceInd, const size_t faceEdgeInd) const
 returns the local index of the j-th edge of the i-th face of the volume More...
 
virtual void get_flipped_orientation (VolumeDescriptor &vdOut) const
 
int get_local_side_index (FaceVertices *f) const
 returns the local index of the given face or -1, if the face is not part of the volume. More...
 
virtual std::pair< GridBaseObjectId, int > get_opposing_object (Vertex *vrt) const
 returns an index to the obbject, which lies on the opposite side of the volume to the given vertex. More...
 
virtual bool get_opposing_side (FaceVertices *f, FaceDescriptor &fdOut) const
 retrieves the face-descriptor for the opposing side to the specified one. More...
 
virtual void get_vertex_indices_of_edge (size_t &ind1Out, size_t &ind2Out, size_t edgeInd) const
 returns the local indices of an edge of the volume. More...
 
virtual void get_vertex_indices_of_face (std::vector< size_t > &indsOut, size_t side) const
 returns the local indices of a face of the volume. More...
 
virtual bool is_regular_ref_rule (int edgeMarks) const
 returns true if the specified edgeMarks would lead to a regular refinement More...
 
virtual uint num_edges () const
 
virtual uint num_faces () const
 
uint num_sides () const
 
virtual ReferenceObjectID reference_object_id () const
 
virtual bool refine (std::vector< Volume * > &vNewVolumesOut, Vertex **ppNewVertexOut, Vertex **newEdgeVertices, Vertex **newFaceVertices, Vertex *newVolumeVertex, const Vertex &prototypeVertex, Vertex **pSubstituteVertices=NULL, vector3 *corners=NULL, bool *isSnapPoint=NULL)
 
virtual ~Volume ()
 
- Public Member Functions inherited from ug::GridObject
virtual GridObjectcreate_empty_instance () const
 create an instance of the derived type More...
 
uint grid_data_index () const
 Returns the grid attachment data index of a geometric object. More...
 
virtual bool is_constrained () const
 returns true if the object is constrained by other objects. More...
 
virtual bool is_constraining () const
 returns the id of the reference-object. More...
 
virtual ~GridObject ()
 
virtual void remove_constraint_link (const Vertex *vrt)
 removes a constraint link to the grid object. More...
 
virtual void remove_constraint_link (const Edge *e)
 removes a constraint link to the grid object. More...
 
virtual void remove_constraint_link (const Face *f)
 removes a constraint link to the grid object. More...
 
- Public Member Functions inherited from ug::VolumeVertices
virtual size_t num_vertices () const
 
Vertexoperator[] (size_t index) const
 returns the i-th vertex. More...
 
size_t size () const
 returns the number of vertices. More...
 
virtual Vertexvertex (size_t index) const
 
virtual ConstVertexArray vertices () const
 
virtual ~VolumeVertices ()
 
- Public Member Functions inherited from ug::IVertexGroup
Vertexoperator[] (size_t index) const
 returns the i-th vertex. More...
 
size_t size () const
 returns the number of vertices. More...
 
virtual ~IVertexGroup ()
 

Static Public Member Functions

static bool type_match (GridObject *pObj)
 

Static Public Attributes

static const int BASE_OBJECT_ID = VOLUME
 
static const bool CAN_BE_SIDE = false
 
static const int dim = 3
 reference dimension More...
 
static const bool HAS_SIDES = true
 

Protected Member Functions

virtual void set_vertex (uint index, Vertex *pVrt)
 
- Protected Member Functions inherited from ug::GridObject
void set_grid_data_index (uint index)
 ATTENTION: Use this method with extreme care! More...
 

Friends

class Grid
 

Additional Inherited Members

- Protected Attributes inherited from ug::GridObject
uint m_gridDataIndex
 

Detailed Description

Volumes are 3-dimensional objects.

Base class for all 3-dimensional objects. Volumes connect four or more vertices.

default implementations of all methods are featured to allow empty instances of this class. This is required to allow the use of this class for compile-time method selection by dummy-parameters. It is cruical that derived classes overload those methods.

Member Typedef Documentation

◆ grid_base_object

◆ higher_dim_base_object

◆ lower_dim_base_object

◆ side

◆ sideof

Constructor & Destructor Documentation

◆ ~Volume()

virtual ug::Volume::~Volume ( )
inlinevirtual

Member Function Documentation

◆ base_object_id()

virtual int ug::Volume::base_object_id ( ) const
inlinevirtual

Implements ug::GridObject.

References ug::VOLUME.

◆ collapse_edge()

virtual bool ug::Volume::collapse_edge ( std::vector< Volume * > &  vNewVolumesOut,
int  edgeIndex,
Vertex newVertex,
std::vector< Vertex * > *  pvSubstituteVertices = NULL 
)
inlinevirtual

The collapse_edge method creates new geometric objects by collapsing the specified edge. The user that calls this function is responsible to either register the new volumes with a grid (the grid from which the vertices are), or to take responsibility for deletion of the acquired memory (delete each element in vNewFacesOut).

  • edgeIndex specifies the edge which shall be collapsed. edgeIndex has to lie between 0 and this->num_edges().
  • Vertices adjacent to the collapsed edge will be replaced by newVertex.
  • If you specify pvSubstituteVertices, the created volumes will reference the vertices in pvSubstituteVertices. Note that pvSubstituteVertices has to contain exactly as many vertices as the volume in which you collapse the edge. Vertices with the same index correlate.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

Referenced by ug::CollapseEdge().

◆ container_section()

◆ create_edge()

virtual Edge* ug::Volume::create_edge ( int  index)
inlinevirtual

create the edge with index i and return it.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

Referenced by ug::Grid::register_volume(), and ug::Grid::volume_autogenerate_edges().

◆ create_face()

virtual Face* ug::Volume::create_face ( int  index)
inlinevirtual

create the face with index i and return it.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

Referenced by ug::Grid::register_volume(), and ug::Grid::volume_autogenerate_faces().

◆ edge_desc() [1/2]

◆ edge_desc() [2/2]

virtual void ug::Volume::edge_desc ( int  index,
EdgeDescriptor edOut 
) const
inlinevirtual

◆ face_desc() [1/2]

◆ face_desc() [2/2]

virtual void ug::Volume::face_desc ( int  index,
FaceDescriptor fdOut 
) const
inlinevirtual

◆ get_edge_index_from_vertices()

virtual int ug::Volume::get_edge_index_from_vertices ( const size_t  vi0,
const size_t  vi1 
) const
inlinevirtual

returns the local index of the edge which connects the two vertex indices.

Default implementation throws a UGError

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_THROW.

Referenced by ug::HangingNodeRefinerBase< TSelector >::assign_hnode_marks(), and ug::IRefiner::get_local_face_mark().

◆ get_face_edge_index()

virtual int ug::Volume::get_face_edge_index ( const size_t  faceInd,
const size_t  faceEdgeInd 
) const
inlinevirtual

returns the local index of the j-th edge of the i-th face of the volume

Default implementation throws a UGError

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_THROW.

◆ get_flipped_orientation()

void ug::Volume::get_flipped_orientation ( VolumeDescriptor vdOut) const
virtual

Writes vertices to the volume-descriptor so that it defines a volume with flipped orientation. If you want to flip the orientation of a volume in a grid, please consider using the grids flip_orientation method.

Please note: The default implementation returns the original volume and has to be reimplemented by derived classes.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

Referenced by ug::Grid::flip_orientation().

◆ get_local_side_index()

int ug::Volume::get_local_side_index ( FaceVertices f) const

returns the local index of the given face or -1, if the face is not part of the volume.

References ug::CompareVertices(), face_desc(), and num_sides().

◆ get_opposing_object()

virtual std::pair<GridBaseObjectId, int> ug::Volume::get_opposing_object ( Vertex vrt) const
inlinevirtual

returns an index to the obbject, which lies on the opposite side of the volume to the given vertex.

The method returs a pair <GridBaseObjectId, int>, where GridBaseObjectId is either VERTEX, EDGE, or FACE and where the second entry specifies the local index of the object in the given volume.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_THROW.

Referenced by ug::CalculateConstrainedSmoothVolumePosInTopLevel(), ug::CalculateSmoothVolumePosInTopLevel(), and ug::Grid::get_opposing_object().

◆ get_opposing_side()

virtual bool ug::Volume::get_opposing_side ( FaceVertices f,
FaceDescriptor fdOut 
) const
inlinevirtual

retrieves the face-descriptor for the opposing side to the specified one.

If no opposing side exists false is returned. If an opposing side exists, the method returns true and fills the specified descriptor.

Reimplemented in ug::Prism, and ug::Hexahedron.

Referenced by ug::GetOpposingSide().

◆ get_vertex_indices_of_edge()

virtual void ug::Volume::get_vertex_indices_of_edge ( size_t &  ind1Out,
size_t &  ind2Out,
size_t  edgeInd 
) const
inlinevirtual

returns the local indices of an edge of the volume.

Default implementation throws a UGError

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_THROW.

Referenced by ug::ExpandFractures3d().

◆ get_vertex_indices_of_face()

virtual void ug::Volume::get_vertex_indices_of_face ( std::vector< size_t > &  indsOut,
size_t  side 
) const
inlinevirtual

returns the local indices of a face of the volume.

Default implementation throws a UGError

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_THROW.

Referenced by ug::ExpandFractures3d().

◆ is_regular_ref_rule()

virtual bool ug::Volume::is_regular_ref_rule ( int  edgeMarks) const
inlinevirtual

returns true if the specified edgeMarks would lead to a regular refinement

A regular refinement leads to new elements which are all similar to the original element. I.e. which are of the same type and which have similar angles.

Note
this method does not perform refinement. Use 'refine' with the specified edges instead.
Parameters
edgeMarksIf the i-th edge shall be refined, the expression 'edgeMarks & (1<<i) != 0' has to be true. You can specify multiple refine-edges using or-combinations: 'edgeMarks = (1<<i) | (1<<j)' would indicate that the i-th and the j-th edge shall be refined.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

◆ num_edges()

◆ num_faces()

◆ num_sides()

◆ reference_object_id()

virtual ReferenceObjectID ug::Volume::reference_object_id ( ) const
inlinevirtual

A reference object represents a class of geometric objects. Tetrahedrons, Triangles etc are such classes. Reference ids should be defined in the file in which concrete geometric objects are defined.

Implements ug::GridObject.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References ug::ROID_UNKNOWN.

Referenced by ug::CalculateAspectRatio(), ug::CalculateConstrainedSmoothVolumePosInTopLevel(), ug::CalculateNumElemsVertexAttachmentInTopLevel(), ug::CalculateSmoothVolumePosInTopLevel(), ug::CalculateVolToRMSFaceAreaRatio(), ug::CalculateVolume(), ug::ConvertToTetrahedra(), and ug::GlobalMultiGridRefiner::perform_refinement().

◆ refine()

virtual bool ug::Volume::refine ( std::vector< Volume * > &  vNewVolumesOut,
Vertex **  ppNewVertexOut,
Vertex **  newEdgeVertices,
Vertex **  newFaceVertices,
Vertex newVolumeVertex,
const Vertex prototypeVertex,
Vertex **  pSubstituteVertices = NULL,
vector3 corners = NULL,
bool *  isSnapPoint = NULL 
)
inlinevirtual

The refine method can be used to create new elements by inserting new vertices on the volume.

New volumes will be returned in vNewFacesOut. If a new vertex has to be created from the prototypeVertex (this happens in more complicated situations) the pointer to the new vertex is returned in ppNewVertexOut. ppNewVertexOut contains NULL if no new vertex has been created.

The user that calls this function is responsible to either register the new volumes and the new vertex with a grid (the grid from which the referenced vertices are), or to take responsibility for deletion of the acquired memory (delete each element in vNewVolumesOut and ppNewVertexOut - if it is not NULL).

  • Specify vertices that shall be inserted on edges with vNewEdgeVertices. Vertices are inserted on the edge that corresponds to its index. Use NULL to indicate that no vertex shall be inserted on the associated edge.
  • Specify vertices that shall be inserted on faces with vNewFaceVertices. Vertices are inserted on the face that corresponds to its index. Use NULL to indicate that no vertex shall be inserted on the associated face.
  • If newVolumeVertex is not NULL, newVolumeVertex will be inserted in the center of the volume.
  • via the prototypeVertex you can specify the vertex-type of the vertex that is auto-inserted if the refine operation is too complex. In most cases this will be an instance of a standard vertex (a concrete type is required. Vertex will not do). The prototypeVertex has not to be registered at any grid - it may be a temporary instance.
  • If you specify pvSubstituteVertices, the created volumes will reference the vertices in pvSubstituteVertices. Note that pvSubstituteVertices has to contain exactly as many vertices as the refined Face. Vertices with the same index correlate.
  • You may optionally specify an array containing the corner positions of the element. If specified, those corners are used during regular tetrahedron refinement only (only if all edges are refined). They are used to choose the best refinement rule for interior child tetrahedrons, thus improving interior angles.
  • You may optionally specify 'isSnapPoint', a list of booleans of length 'num_vertices()'. Each quadrilateral side may contain at most one snap-point. New edges on quadrilateral faces will then connect the snap-point and the newly introduced edge-vertex. Note that a snap-point must not be a corner of a refined edge.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

Referenced by ug::AdaptiveRegularRefiner_MultiGrid::create_closure_elements_3d(), ug::CreateEdgeSplitGeometry(), ug::GlobalFracturedMediaRefiner::perform_refinement(), ug::GlobalMultiGridRefiner::perform_refinement(), ug::Refine(), and ug::HangingNodeRefinerBase< TSelector >::refine_volume_with_normal_vertex().

◆ set_vertex()

virtual void ug::Volume::set_vertex ( uint  index,
Vertex pVrt 
)
inlineprotectedvirtual

creates the volumes that result from the splitting of the edge with index 'splitEdgeIndex'. creates the volumes that result from the collapsing of the edge with index 'splitEdgeIndex'.

Reimplemented in ug::Octahedron, ug::Pyramid, ug::Prism, ug::Hexahedron, and ug::Tetrahedron.

References UG_ASSERT.

Referenced by ug::Grid::create_by_cloning(), ug::Grid::flip_orientation(), ug::Grid::register_and_replace_element(), and ug::Grid::replace_vertex().

◆ type_match()

static bool ug::Volume::type_match ( GridObject pObj)
inlinestatic

Friends And Related Function Documentation

◆ Grid

friend class Grid
friend

Member Data Documentation

◆ BASE_OBJECT_ID

const int ug::Volume::BASE_OBJECT_ID = VOLUME
static

◆ CAN_BE_SIDE

const bool ug::Volume::CAN_BE_SIDE = false
static

◆ dim

const int ug::Volume::dim = 3
static

reference dimension

◆ HAS_SIDES

const bool ug::Volume::HAS_SIDES = true
static

The documentation for this class was generated from the following files: