RINGMesh  Version 5.0.0
A programming library for geological model meshes
RINGMesh::SurfaceMeshBase< DIMENSION > Class Template Referenceabstract

#include <mesh.h>

Inheritance diagram for RINGMesh::SurfaceMeshBase< DIMENSION >:
RINGMesh::MeshBase< DIMENSION > RINGMesh::SurfaceMesh< DIMENSION > RINGMesh::GeogramSurfaceMesh< DIMENSION >

Public Member Functions

virtual index_t polygon_vertex (const ElementLocalVertex &polygon_local_vertex) const =0
 Gets the vertex index by polygon index and local vertex index. More...
 
virtual index_t nb_polygons () const =0
 Gets the number of all polygons in the whole Mesh. More...
 
virtual index_t nb_polygon_vertices (index_t polygon_id) const =0
 Gets the number of vertices in the polygon. More...
 
ElementLocalVertex next_polygon_vertex (const ElementLocalVertex &polygon_local_vertex) const
 Gets the next vertex index in the polygon vertex. More...
 
PolygonLocalEdge next_on_border (const PolygonLocalEdge &polygon_local_edge) const
 Get the next edge on the border. More...
 
ElementLocalVertex prev_polygon_vertex (const ElementLocalVertex &polygon_local_vertex) const
 Gets the previous vertex index in the polygon. More...
 
PolygonLocalEdge prev_on_border (const PolygonLocalEdge &polygon_local_edge) const
 Get the previous edge on the border. More...
 
index_t vertex_index_in_polygon (index_t polygon_index, index_t vertex_id) const
 Get the vertex index in a polygon. More...
 
index_t closest_vertex_in_polygon (index_t polygon_index, const vecn< DIMENSION > &query_point) const
 Compute closest vertex in a polygon to a point. More...
 
index_t polygon_from_vertex_ids (index_t in0, index_t in1) const
 Get the first polygon of the surface that has an edge linking the two vertices (ids in the surface) More...
 
std::vector< index_t > polygons_around_vertex (index_t vertex_id, bool border_only, index_t first_polygon) const
 Determines the polygons around a vertex. More...
 
virtual index_t polygon_adjacent (const PolygonLocalEdge &polygon_local_edge) const =0
 Gets an adjacent polygon index by polygon index and local edge index. More...
 
virtual GEO::AttributesManager & polygon_attribute_manager () const =0
 
virtual bool polygons_are_simplicies () const =0
 Tests whether all the polygons are triangles. when all the polygons are triangles, storage and access is optimized. More...
 
bool is_triangle (index_t polygon_id) const
 
PolygonType polygone_type (index_t polygon_id) const
 
bool is_edge_on_border (const PolygonLocalEdge &polygon_local_edge) const
 
bool is_polygon_on_border (index_t polygon_index) const
 
double polygon_edge_length (const PolygonLocalEdge &polygon_local_edge) const
 Gets the length of the edge starting at a given vertex. More...
 
vecn< DIMENSION > polygon_edge_barycenter (const PolygonLocalEdge &polygon_local_edge) const
 Gets the barycenter of the edge starting at a given vertex. More...
 
index_t polygon_edge_vertex (const PolygonLocalEdge &polygon_local_edge, index_t vertex_id) const
 Gets the vertex index on the polygon edge. More...
 
vecn< DIMENSION > polygon_barycenter (index_t polygon_id) const
 
virtual double polygon_area (index_t polygon_id) const =0
 
const NNSearch< DIMENSION > & polygon_nn_search () const
 return the NNSearch at polygons More...
 
const SurfaceAABBTree< DIMENSION > & polygon_aabb () const
 Creates an AABB tree for a Mesh polygons. More...
 
bool is_mesh_valid () const override
 
std::tuple< index_t, std::vector< index_t > > connected_components () const final
 
- Public Member Functions inherited from RINGMesh::MeshBase< DIMENSION >
virtual ~MeshBase ()=default
 
virtual void save_mesh (const std::string &filename) const =0
 
virtual void print_mesh_bounded_attributes () const =0
 
virtual const vecn< DIMENSION > & vertex (index_t v_id) const =0
 Gets a point. More...
 
virtual index_t nb_vertices () const =0
 
virtual GEO::AttributesManager & vertex_attribute_manager () const =0
 
const NNSearch< DIMENSION > & vertex_nn_search () const
 return the NNSearch at vertices More...
 
virtual MeshType type_name () const =0
 
virtual std::string default_extension () const =0
 

Static Public Member Functions

static std::unique_ptr< SurfaceMesh< DIMENSION > > create_mesh (const MeshType type="")
 

Protected Member Functions

 SurfaceMeshBase ()=default
 
- Protected Member Functions inherited from RINGMesh::MeshBase< DIMENSION >
 MeshBase ()=default
 

Protected Attributes

std::unique_ptr< NNSearch< DIMENSION > > nn_search_ {}
 
std::unique_ptr< SurfaceAABBTree< DIMENSION > > polygon_aabb_ {}
 
- Protected Attributes inherited from RINGMesh::MeshBase< DIMENSION >
std::unique_ptr< NNSearch< DIMENSION > > vertex_nn_search_ {}
 

Friends

class SurfaceMeshBuilder< DIMENSION >
 

Detailed Description

template<index_t DIMENSION>
class RINGMesh::SurfaceMeshBase< DIMENSION >

class for encapsulating surface mesh component

Definition at line 373 of file mesh.h.

Constructor & Destructor Documentation

◆ SurfaceMeshBase()

template<index_t DIMENSION>
RINGMesh::SurfaceMeshBase< DIMENSION >::SurfaceMeshBase ( )
protecteddefault

Member Function Documentation

◆ closest_vertex_in_polygon()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBase< DIMENSION >::closest_vertex_in_polygon ( index_t  polygon_index,
const vecn< DIMENSION > &  query_point 
) const

Compute closest vertex in a polygon to a point.

Parameters
[in]polygon_indexPolygon index
[in]query_pointCoordinates of the point to which distance is measured
Returns
Index of the vertex of
Parameters
polygon_indexclosest to
query_point

Definition at line 419 of file mesh.cpp.

◆ connected_components()

template<index_t DIMENSION>
std::tuple< index_t, std::vector< index_t > > RINGMesh::SurfaceMeshBase< DIMENSION >::connected_components ( ) const
finalvirtual

Implements RINGMesh::MeshBase< DIMENSION >.

Definition at line 546 of file mesh.cpp.

◆ create_mesh()

template<index_t DIMENSION>
std::unique_ptr< SurfaceMesh< DIMENSION > > RINGMesh::SurfaceMeshBase< DIMENSION >::create_mesh ( const MeshType  type = "")
static

Definition at line 244 of file mesh.cpp.

◆ is_edge_on_border()

template<index_t DIMENSION>
bool RINGMesh::SurfaceMeshBase< DIMENSION >::is_edge_on_border ( const PolygonLocalEdge polygon_local_edge) const
inline

Is the edge starting with the given vertex of the polygon on a border of the Surface?

Definition at line 569 of file mesh.h.

◆ is_mesh_valid()

template<index_t DIMENSION>
bool RINGMesh::SurfaceMeshBase< DIMENSION >::is_mesh_valid ( ) const
inlineoverridevirtual

Implements RINGMesh::MeshBase< DIMENSION >.

Definition at line 694 of file mesh.h.

◆ is_polygon_on_border()

template<index_t DIMENSION>
bool RINGMesh::SurfaceMeshBase< DIMENSION >::is_polygon_on_border ( index_t  polygon_index) const
inline

Is one of the edges of the polygon on the border of the surface?

Definition at line 578 of file mesh.h.

◆ is_triangle()

template<index_t DIMENSION>
bool RINGMesh::SurfaceMeshBase< DIMENSION >::is_triangle ( index_t  polygon_id) const
inline

return true if the polygon

Parameters
polygon_idis a triangle

Definition at line 547 of file mesh.h.

◆ nb_polygon_vertices()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBase< DIMENSION >::nb_polygon_vertices ( index_t  polygon_id) const
pure virtual

Gets the number of vertices in the polygon.

Parameters
polygon_id.
[in]polygon_idpolygon index

Implemented in RINGMesh::GeogramSurfaceMesh< DIMENSION >.

◆ nb_polygons()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBase< DIMENSION >::nb_polygons ( ) const
pure virtual

Gets the number of all polygons in the whole Mesh.

Implemented in RINGMesh::GeogramSurfaceMesh< DIMENSION >.

◆ next_on_border()

template<index_t DIMENSION>
PolygonLocalEdge RINGMesh::SurfaceMeshBase< DIMENSION >::next_on_border ( const PolygonLocalEdge polygon_local_edge) const

Get the next edge on the border.

Warning
the edge index is in fact the index of the vertex where the edge starts.

The returned border edge is the next in the way of polygon edges orientation.

Parameters
[in]polygon_local_edgeinput polygon index and its local edge index in the polygon
Returns
the next polygon index and the next edge index in the polygon
Precondition
the given polygon edge must be on border

Definition at line 265 of file mesh.cpp.

◆ next_polygon_vertex()

template<index_t DIMENSION>
ElementLocalVertex RINGMesh::SurfaceMeshBase< DIMENSION >::next_polygon_vertex ( const ElementLocalVertex polygon_local_vertex) const
inline

Gets the next vertex index in the polygon vertex.

Parameters
polygon_local_vertex.
[in]polygon_local_vertexpolygon index and the current local vertex index.

Definition at line 404 of file mesh.h.

◆ polygon_aabb()

template<index_t DIMENSION>
const SurfaceAABBTree< DIMENSION >& RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_aabb ( ) const
inline

Creates an AABB tree for a Mesh polygons.

Definition at line 684 of file mesh.h.

◆ polygon_adjacent()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_adjacent ( const PolygonLocalEdge polygon_local_edge) const
pure virtual

Gets an adjacent polygon index by polygon index and local edge index.

Parameters
[in]polygon_idthe polygon index.
[in]edge_idthe local edge index in
polygon_id.
Returns
the global polygon index adjacent to the
Parameters
edge_idof the polygon
polygon_id.
edge_id< number of edge of the polygon
polygon_id.

Implemented in RINGMesh::GeogramSurfaceMesh< DIMENSION >.

◆ polygon_area()

template<index_t DIMENSION>
virtual double RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_area ( index_t  polygon_id) const
pure virtual

Computes the Mesh polygon area

Parameters
[in]polygon_idthe polygon index
Returns
the polygon area

Implemented in RINGMesh::SurfaceMesh< 2 >, and RINGMesh::SurfaceMesh< 3 >.

◆ polygon_attribute_manager()

template<index_t DIMENSION>
virtual GEO::AttributesManager& RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_attribute_manager ( ) const
pure virtual

◆ polygon_barycenter()

template<index_t DIMENSION>
vecn< DIMENSION > RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_barycenter ( index_t  polygon_id) const
inline

Computes the Mesh polygon barycenter

Parameters
[in]polygon_idthe polygon index
Returns
the polygon center

Definition at line 645 of file mesh.h.

◆ polygon_edge_barycenter()

template<index_t DIMENSION>
vecn< DIMENSION > RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_edge_barycenter ( const PolygonLocalEdge polygon_local_edge) const
inline

Gets the barycenter of the edge starting at a given vertex.

Parameters
[in]polygon_local_edgeindex of the polygon and the local edge starting vertex index

Definition at line 609 of file mesh.h.

◆ polygon_edge_length()

template<index_t DIMENSION>
double RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_edge_length ( const PolygonLocalEdge polygon_local_edge) const
inline

Gets the length of the edge starting at a given vertex.

Parameters
[in]polygon_local_edgeindex of the polygon and its local edge starting vertex index

Definition at line 595 of file mesh.h.

◆ polygon_edge_vertex()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_edge_vertex ( const PolygonLocalEdge polygon_local_edge,
index_t  vertex_id 
) const
inline

Gets the vertex index on the polygon edge.

Parameters
[in]polygon_local_edgeindex of the polygon and the local index of the edge in the polygon
[in]vertex_idindex of the local vertex in the edge
edge_id(0 or 1)
Returns
the vertex index

Definition at line 626 of file mesh.h.

◆ polygon_from_vertex_ids()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_from_vertex_ids ( index_t  in0,
index_t  in1 
) const

Get the first polygon of the surface that has an edge linking the two vertices (ids in the surface)

Parameters
[in]in0Index of the first vertex in the surface
[in]in1Index of the second vertex in the surface
Returns
NO_ID or the index of the polygon

Definition at line 368 of file mesh.cpp.

◆ polygon_nn_search()

template<index_t DIMENSION>
const NNSearch< DIMENSION >& RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_nn_search ( ) const
inline

return the NNSearch at polygons

Definition at line 666 of file mesh.h.

◆ polygon_vertex()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_vertex ( const ElementLocalVertex polygon_local_vertex) const
pure virtual

Gets the vertex index by polygon index and local vertex index.

Parameters
[in]polygon_local_vertexthe polygon index and the local edge index in the polygon.

Implemented in RINGMesh::GeogramSurfaceMesh< DIMENSION >.

◆ polygone_type()

template<index_t DIMENSION>
PolygonType RINGMesh::SurfaceMeshBase< DIMENSION >::polygone_type ( index_t  polygon_id) const
inline

Definition at line 552 of file mesh.h.

◆ polygons_are_simplicies()

template<index_t DIMENSION>
virtual bool RINGMesh::SurfaceMeshBase< DIMENSION >::polygons_are_simplicies ( ) const
pure virtual

Tests whether all the polygons are triangles. when all the polygons are triangles, storage and access is optimized.

Returns
True if all polygons are triangles and False otherwise.

Implemented in RINGMesh::GeogramSurfaceMesh< DIMENSION >.

◆ polygons_around_vertex()

template<index_t DIMENSION>
std::vector< index_t > RINGMesh::SurfaceMeshBase< DIMENSION >::polygons_around_vertex ( index_t  vertex_id,
bool  border_only,
index_t  first_polygon 
) const

Determines the polygons around a vertex.

Parameters
[in]vertex_idIndex of the vertex in the surface
[in]border_onlyIf true only polygons on the border are considered
[in]first_polygon(Optional) Index of one polygon containing the vertex
P
Returns
Indices of the polygons containing
Parameters
P
Note
If a polygon containing the vertex is given, polygons around this vertex is search by propagation. Else, a first polygon is found by brute force algorithm, and then the other by propagation
Parameters
first_polygon.[PA]

Definition at line 440 of file mesh.cpp.

◆ prev_on_border()

template<index_t DIMENSION>
PolygonLocalEdge RINGMesh::SurfaceMeshBase< DIMENSION >::prev_on_border ( const PolygonLocalEdge polygon_local_edge) const

Get the previous edge on the border.

The returned border edge is the previous in the way of polygon edges orientation.

Parameters
[in]pInput polygon index
[in]eEdge index in the polygon
Returns
the previous polygon index and the previous edge index in the polygon (tuple).
Precondition
the surface must be correctly oriented and the given polygon edge must be on border
Warning
the edge index is in fact the index of the vertex where the edge starts.

Definition at line 315 of file mesh.cpp.

◆ prev_polygon_vertex()

template<index_t DIMENSION>
ElementLocalVertex RINGMesh::SurfaceMeshBase< DIMENSION >::prev_polygon_vertex ( const ElementLocalVertex polygon_local_vertex) const
inline

Gets the previous vertex index in the polygon.

Parameters
polygon_id.
[in]polygon_local_vertexpolygon index and its current local vertex index

Definition at line 443 of file mesh.h.

◆ vertex_index_in_polygon()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBase< DIMENSION >::vertex_index_in_polygon ( index_t  polygon_index,
index_t  vertex_id 
) const

Get the vertex index in a polygon.

Parameters
polygon_indexfrom its global index in the SurfaceMesh
vertex_id
Returns
NO_ID or index of the vertex in the polygon

Definition at line 404 of file mesh.cpp.

Friends And Related Function Documentation

◆ SurfaceMeshBuilder< DIMENSION >

template<index_t DIMENSION>
friend class SurfaceMeshBuilder< DIMENSION >
friend

Definition at line 375 of file mesh.h.

Member Data Documentation

◆ nn_search_

template<index_t DIMENSION>
std::unique_ptr< NNSearch< DIMENSION > > RINGMesh::SurfaceMeshBase< DIMENSION >::nn_search_ {}
mutableprotected

Definition at line 736 of file mesh.h.

◆ polygon_aabb_

template<index_t DIMENSION>
std::unique_ptr< SurfaceAABBTree< DIMENSION > > RINGMesh::SurfaceMeshBase< DIMENSION >::polygon_aabb_ {}
mutableprotected

Definition at line 737 of file mesh.h.


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