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

#include <mesh_builder.h>

Inheritance diagram for RINGMesh::SurfaceMeshBuilder< DIMENSION >:
RINGMesh::MeshBaseBuilder< DIMENSION > RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >

Public Member Functions

void remove_isolated_vertices ()
 Remove vertices not connected to any mesh element. More...
 
Polygon related methods
void create_polygons (const std::vector< index_t > &polygons, const std::vector< index_t > &polygon_ptr)
 
index_t create_polygon (const std::vector< index_t > &vertices)
 Creates a polygon. More...
 
index_t create_triangles (index_t nb_triangles)
 Creates a contiguous chunk of triangles. More...
 
index_t create_quads (index_t nb_quads)
 Creates a contiguous chunk of quads. More...
 
void set_polygon_vertex (const PolygonLocalEdge &polygon_local_edge, index_t vertex_id)
 Sets a vertex of a polygon by local vertex index. More...
 
void set_polygon_adjacent (const PolygonLocalEdge &polygon_local_edge, index_t specifies)
 Sets an adjacent polygon by both its polygon. More...
 
void clear_polygons (bool keep_attributes, bool keep_memory)
 Removes all the polygons and attributes. More...
 
void connect_polygons ()
 Retrieve the adjacencies of polygons. More...
 
void connect_polygons (const std::vector< index_t > &polygons_to_connect)
 
void permute_polygons (const std::vector< index_t > &permutation)
 
void delete_polygons (const std::vector< bool > &to_delete, bool remove_isolated_vertices)
 Deletes a set of polygons. More...
 
SurfaceMesh algorithms
virtual void remove_small_connected_components (double min_area, index_t min_polygons)=0
 Removes the connected components that have an area smaller than a given threshold. More...
 
virtual void triangulate (const SurfaceMeshBase< DIMENSION > &surface_in)=0
 
- Public Member Functions inherited from RINGMesh::MeshBaseBuilder< DIMENSION >
virtual ~MeshBaseBuilder ()=default
 
template<>
std::unique_ptr< MeshBaseBuilder< 2 > > RINGMESH_API create_builder (MeshBase< 2 > &mesh)
 
template<>
std::unique_ptr< MeshBaseBuilder< 3 > > RINGMESH_API create_builder (MeshBase< 3 > &mesh)
 
void copy (const MeshBase< DIMENSION > &rhs, bool copy_attributes)
 Copy a mesh into this one. More...
 
virtual void load_mesh (const std::string &filename)=0
 
void clear (bool keep_attributes, bool keep_memory)
 Removes all the entities and attributes of this mesh. More...
 
void repair (GEO::MeshRepairMode mode, double colocate_epsilon)
 Fixes some defaults in a mesh. More...
 
void set_vertex (index_t v_id, const vecn< DIMENSION > &vertex)
 Sets a point. More...
 
index_t create_vertex ()
 Creates a new vertex. More...
 
index_t create_vertex (const vecn< DIMENSION > &vertex)
 Creates a new vertex. More...
 
index_t create_vertices (index_t nb)
 Creates a contiguous chunk of vertices. More...
 
void assign_vertices (const std::vector< double > &point_coordinates)
 set vertex coordinates from a std::vector of coordinates More...
 
void delete_vertices (const std::vector< bool > &to_delete)
 Deletes a set of vertices. More...
 
void clear_vertices (bool keep_attributes, bool keep_memory)
 Removes all the vertices and attributes. More...
 
void permute_vertices (const std::vector< index_t > &permutation)
 

Static Public Member Functions

static std::unique_ptr< SurfaceMeshBuilder< DIMENSION > > create_builder (SurfaceMesh< DIMENSION > &mesh)
 
- Static Public Member Functions inherited from RINGMesh::MeshBaseBuilder< DIMENSION >
static std::unique_ptr< MeshBaseBuilder< DIMENSION > > create_builder (MeshBase< DIMENSION > &mesh)
 

Protected Member Functions

 SurfaceMeshBuilder (SurfaceMeshBase< DIMENSION > &mesh)
 
- Protected Member Functions inherited from RINGMesh::MeshBaseBuilder< DIMENSION >
 MeshBaseBuilder (MeshBase< DIMENSION > &mesh)
 
void delete_vertex_nn_search ()
 

Protected Attributes

SurfaceMeshBase< DIMENSION > & surface_mesh_
 
- Protected Attributes inherited from RINGMesh::MeshBaseBuilder< DIMENSION >
MeshBase< DIMENSION > & mesh_base_
 

Private Member Functions

void delete_polygon_nn_search ()
 Deletes the NNSearch on polygons. More...
 
void delete_polygon_aabb ()
 Deletes the AABB on polygons. More...
 
void clear_vertex_linked_objects () override
 Deletes the NNSearch on vertices. More...
 
void clear_polygon_linked_objects ()
 
virtual void do_create_polygons (const std::vector< index_t > &polygons, const std::vector< index_t > &polygon_ptr)=0
 
virtual index_t do_create_polygon (const std::vector< index_t > &vertices)=0
 Creates a polygon. More...
 
virtual index_t do_create_triangles (index_t nb_triangles)=0
 Creates a contiguous chunk of triangles. More...
 
virtual index_t do_create_quads (index_t nb_quads)=0
 Creates a contiguous chunk of quads. More...
 
virtual void do_set_polygon_vertex (const PolygonLocalEdge &polygon_local_edge, index_t vertex_id)=0
 Sets a vertex of a polygon by local vertex index. More...
 
virtual void do_set_polygon_adjacent (const PolygonLocalEdge &polygon_local_edge, index_t specifies)=0
 Sets an adjacent polygon by both its polygon. More...
 
virtual void do_clear_polygons (bool keep_attributes, bool keep_memory)=0
 Removes all the polygons and attributes. More...
 
virtual void do_permute_polygons (const std::vector< index_t > &permutation)=0
 
virtual void do_delete_polygons (const std::vector< bool > &to_delete)=0
 Deletes a set of polygons. More...
 

Detailed Description

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

Definition at line 515 of file mesh_builder.h.

Constructor & Destructor Documentation

◆ SurfaceMeshBuilder()

template<index_t DIMENSION>
RINGMesh::SurfaceMeshBuilder< DIMENSION >::SurfaceMeshBuilder ( SurfaceMeshBase< DIMENSION > &  mesh)
inlineexplicitprotected

Definition at line 777 of file mesh_builder.h.

Member Function Documentation

◆ clear_polygon_linked_objects()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::clear_polygon_linked_objects ( )
inlineprivate

Definition at line 805 of file mesh_builder.h.

◆ clear_polygons()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::clear_polygons ( bool  keep_attributes,
bool  keep_memory 
)
inline

Removes all the polygons and attributes.

Parameters
[in]keep_attributesif true, then all the existing attribute names / bindings are kept (but they are cleared). If false, they are destroyed.
[in]keep_memoryif true, then memory is kept and can be reused by subsequent mesh entity creations.

Definition at line 609 of file mesh_builder.h.

◆ clear_vertex_linked_objects()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::clear_vertex_linked_objects ( )
inlineoverrideprivatevirtual

Deletes the NNSearch on vertices.

Implements RINGMesh::MeshBaseBuilder< DIMENSION >.

Definition at line 799 of file mesh_builder.h.

◆ connect_polygons() [1/2]

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::connect_polygons ( )
inline

Retrieve the adjacencies of polygons.

Definition at line 617 of file mesh_builder.h.

◆ connect_polygons() [2/2]

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::connect_polygons ( const std::vector< index_t > &  polygons_to_connect)
inline

Definition at line 625 of file mesh_builder.h.

◆ create_builder()

template<index_t DIMENSION>
template std::unique_ptr< SurfaceMeshBuilder< 3 > > RINGMESH_API RINGMesh::SurfaceMeshBuilder< DIMENSION >::create_builder ( SurfaceMesh< DIMENSION > &  mesh)
static

Definition at line 178 of file mesh_builder.cpp.

◆ create_polygon()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::create_polygon ( const std::vector< index_t > &  vertices)
inline

Creates a polygon.

Parameters
[in]verticesa const reference to a vector that contains the vertices
Returns
the index of the created polygon

Definition at line 543 of file mesh_builder.h.

◆ create_polygons()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::create_polygons ( const std::vector< index_t > &  polygons,
const std::vector< index_t > &  polygon_ptr 
)
inline

brief create polygons

Parameters
[in]polygonsis the vector of vertex index for each polygon
[in]polygon_ptris the vector addressing the first polygon vertex for each polygon.

Definition at line 531 of file mesh_builder.h.

◆ create_quads()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::create_quads ( index_t  nb_quads)
inline

Creates a contiguous chunk of quads.

Parameters
[in]nb_quadsnumber of quads to create
Returns
the index of the first quad

Definition at line 565 of file mesh_builder.h.

◆ create_triangles()

template<index_t DIMENSION>
index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::create_triangles ( index_t  nb_triangles)
inline

Creates a contiguous chunk of triangles.

Parameters
[in]nb_trianglesnumber of triangles to create
Returns
the index of the first triangle

Definition at line 554 of file mesh_builder.h.

◆ delete_polygon_aabb()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::delete_polygon_aabb ( )
inlineprivate

Deletes the AABB on polygons.

Definition at line 794 of file mesh_builder.h.

◆ delete_polygon_nn_search()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::delete_polygon_nn_search ( )
inlineprivate

Deletes the NNSearch on polygons.

Definition at line 786 of file mesh_builder.h.

◆ delete_polygons()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::delete_polygons ( const std::vector< bool > &  to_delete,
bool  remove_isolated_vertices 
)
inline

Deletes a set of polygons.

Parameters
[in]to_deletea vector of size nb(). If to_delete[e] is true, then entity e will be destroyed, else it will be kept.
[in]remove_isolated_verticesif true, then the vertices that are no longer incident to any entity are deleted.

Definition at line 730 of file mesh_builder.h.

◆ do_clear_polygons()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_clear_polygons ( bool  keep_attributes,
bool  keep_memory 
)
privatepure virtual

Removes all the polygons and attributes.

Parameters
[in]keep_attributesif true, then all the existing attribute names / bindings are kept (but they are cleared). If false, they are destroyed.
[in]keep_memoryif true, then memory is kept and can be reused by subsequent mesh entity creations.

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_create_polygon()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_create_polygon ( const std::vector< index_t > &  vertices)
privatepure virtual

Creates a polygon.

Parameters
[in]verticesa const reference to a vector that contains the vertices
Returns
the index of the created polygon

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_create_polygons()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_create_polygons ( const std::vector< index_t > &  polygons,
const std::vector< index_t > &  polygon_ptr 
)
privatepure virtual

brief create polygons

Parameters
[in]polygonsis the vector of vertex index for each polygon
[in]polygon_ptris the vector addressing the first polygon vertex for each polygon.

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_create_quads()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_create_quads ( index_t  nb_quads)
privatepure virtual

Creates a contiguous chunk of quads.

Parameters
[in]nb_quadsnumber of quads to create
Returns
the index of the first quad

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_create_triangles()

template<index_t DIMENSION>
virtual index_t RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_create_triangles ( index_t  nb_triangles)
privatepure virtual

Creates a contiguous chunk of triangles.

Parameters
[in]nb_trianglesnumber of triangles to create
Returns
the index of the first triangle

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_delete_polygons()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_delete_polygons ( const std::vector< bool > &  to_delete)
privatepure virtual

Deletes a set of polygons.

Parameters
[in]to_deletea vector of size nb(). If to_delete[e] is true, then entity e will be destroyed, else it will be kept.

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_permute_polygons()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_permute_polygons ( const std::vector< index_t > &  permutation)
privatepure virtual

◆ do_set_polygon_adjacent()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_set_polygon_adjacent ( const PolygonLocalEdge polygon_local_edge,
index_t  specifies 
)
privatepure virtual

Sets an adjacent polygon by both its polygon.

Parameters
polygon_idand its local edge index
edge_id.
[in]polygon_local_edgethe polygon index and the local index of an edge.
[in]specifiesthe polygon adjacent to
polygon_idalong edge
edge_idor GEO::NO_FACET if the parameter
edge_idis on the border.

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ do_set_polygon_vertex()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::do_set_polygon_vertex ( const PolygonLocalEdge polygon_local_edge,
index_t  vertex_id 
)
privatepure virtual

Sets a vertex of a polygon by local vertex index.

Parameters
[in]polygon_local_edgethe polygon index and the local index of an edge. Local index between 0 and nb_vertices(cell_id) - 1.
[in]vertex_idspecifies the vertex
local_vertex_idof the polygon
polygon_id.Index between 0 and nb() - 1.

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ permute_polygons()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::permute_polygons ( const std::vector< index_t > &  permutation)
inline

Definition at line 716 of file mesh_builder.h.

◆ remove_isolated_vertices()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::remove_isolated_vertices ( )
inline

Remove vertices not connected to any mesh element.

Definition at line 761 of file mesh_builder.h.

◆ remove_small_connected_components()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::remove_small_connected_components ( double  min_area,
index_t  min_polygons 
)
pure virtual

Removes the connected components that have an area smaller than a given threshold.

Parameters
[in]min_areathe connected components with an area smaller than this threshold are removed
[in]min_polygonsthe connected components with less than
min_polygonspolygons are removed

Implemented in RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION >.

◆ set_polygon_adjacent()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::set_polygon_adjacent ( const PolygonLocalEdge polygon_local_edge,
index_t  specifies 
)
inline

Sets an adjacent polygon by both its polygon.

Parameters
polygon_idand its local edge index
edge_id.
[in]polygon_local_edgethe polygon index and local index of an edge.
[in]specifiesthe polygon adjacent to
polygon_idalong edge
edge_idor GEO::NO_FACET if the parameter
edge_idis on the border.

Definition at line 596 of file mesh_builder.h.

◆ set_polygon_vertex()

template<index_t DIMENSION>
void RINGMesh::SurfaceMeshBuilder< DIMENSION >::set_polygon_vertex ( const PolygonLocalEdge polygon_local_edge,
index_t  vertex_id 
)
inline

Sets a vertex of a polygon by local vertex index.

Parameters
[in]polygon_local_edgethe polygon index and local index of an edge. Local index between 0 and nb_vertices(cell_id) - 1.
[in]vertex_idspecifies the vertex
local_vertex_idof the polygon
polygon_id.Index between 0 and nb() - 1.

Definition at line 580 of file mesh_builder.h.

◆ triangulate()

template<index_t DIMENSION>
virtual void RINGMesh::SurfaceMeshBuilder< DIMENSION >::triangulate ( const SurfaceMeshBase< DIMENSION > &  surface_in)
pure virtual

Member Data Documentation

◆ surface_mesh_

template<index_t DIMENSION>
SurfaceMeshBase< DIMENSION >& RINGMesh::SurfaceMeshBuilder< DIMENSION >::surface_mesh_
protected

Definition at line 884 of file mesh_builder.h.


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