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

#include <mesh_builder.h>

Inheritance diagram for RINGMesh::MeshBaseBuilder< DIMENSION >:
RINGMesh::LineMeshBuilder< DIMENSION > RINGMesh::PointSetMeshBuilder< DIMENSION > RINGMesh::SurfaceMeshBuilder< DIMENSION > RINGMesh::VolumeMeshBuilder< DIMENSION > RINGMesh::GeogramLineMeshBuilder< DIMENSION > RINGMesh::GeogramPointSetMeshBuilder< DIMENSION > RINGMesh::GeogramSurfaceMeshBuilder< DIMENSION > RINGMesh::GeogramVolumeMeshBuilder< DIMENSION >

Public Member Functions

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)
 
general methods
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...
 
Vertex related methods
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< MeshBaseBuilder< DIMENSION > > create_builder (MeshBase< DIMENSION > &mesh)
 

Protected Member Functions

 MeshBaseBuilder (MeshBase< DIMENSION > &mesh)
 
void delete_vertex_nn_search ()
 
virtual void clear_vertex_linked_objects ()=0
 Deletes the NNSearch on vertices. More...
 

Protected Attributes

MeshBase< DIMENSION > & mesh_base_
 

Private Member Functions

 ringmesh_disable_copy_and_move (MeshBaseBuilder)
 
 ringmesh_template_assert_2d_or_3d (DIMENSION)
 
virtual void do_copy (const MeshBase< DIMENSION > &rhs, bool copy_attributes)=0
 Copy a mesh into this one. More...
 
virtual void do_clear (bool keep_attributes, bool keep_memory)=0
 Removes all the entities and attributes of this mesh. More...
 
virtual void do_repair (GEO::MeshRepairMode mode, double colocate_epsilon)=0
 Fixes some defaults in a mesh. More...
 
virtual void do_set_vertex (index_t v_id, const vecn< DIMENSION > &vertex)=0
 Sets a point. More...
 
virtual index_t do_create_vertex ()=0
 Creates a new vertex. More...
 
virtual index_t do_create_vertices (index_t nb)=0
 Creates a contiguous chunk of vertices. More...
 
virtual void do_assign_vertices (const std::vector< double > &point_coordinates)=0
 set vertex coordinates from a std::vector of coordinates More...
 
virtual void do_delete_vertices (const std::vector< bool > &to_delete)=0
 Deletes a set of vertices. More...
 
virtual void do_clear_vertices (bool keep_attributes, bool keep_memory)=0
 Removes all the vertices and attributes. More...
 
virtual void do_permute_vertices (const std::vector< index_t > &permutation)=0
 

Detailed Description

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

Definition at line 57 of file mesh_builder.h.

Constructor & Destructor Documentation

◆ ~MeshBaseBuilder()

template<index_t DIMENSION>
virtual RINGMesh::MeshBaseBuilder< DIMENSION >::~MeshBaseBuilder ( )
virtualdefault

◆ MeshBaseBuilder()

template<index_t DIMENSION>
RINGMesh::MeshBaseBuilder< DIMENSION >::MeshBaseBuilder ( MeshBase< DIMENSION > &  mesh)
inlineexplicitprotected

Definition at line 200 of file mesh_builder.h.

Member Function Documentation

◆ assign_vertices()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::assign_vertices ( const std::vector< double > &  point_coordinates)
inline

set vertex coordinates from a std::vector of coordinates

Parameters
[in]point_coordinatesa set of x, y (, z) coordinates

Definition at line 159 of file mesh_builder.h.

◆ clear()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::clear ( bool  keep_attributes,
bool  keep_memory 
)
inline

Removes all the entities and attributes of this mesh.

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 90 of file mesh_builder.h.

◆ clear_vertex_linked_objects()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::clear_vertex_linked_objects ( )
protectedpure virtual

◆ clear_vertices()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::clear_vertices ( bool  keep_attributes,
bool  keep_memory 
)
inline

Removes all the vertices 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 184 of file mesh_builder.h.

◆ copy()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::copy ( const MeshBase< DIMENSION > &  rhs,
bool  copy_attributes 
)
inline

Copy a mesh into this one.

Parameters
[in]rhsa const reference to the mesh to be copied.
[in]copy_attributesif true, all attributes are copied.
Returns
a modifiable reference to the point that corresponds to the vertex.

Definition at line 75 of file mesh_builder.h.

◆ create_builder() [1/3]

template<>
std::unique_ptr< MeshBaseBuilder< 2 > > RINGMESH_API RINGMesh::MeshBaseBuilder< 2 >::create_builder ( MeshBase< 2 > &  mesh)

Definition at line 112 of file mesh_builder.cpp.

◆ create_builder() [2/3]

template<>
std::unique_ptr< MeshBaseBuilder< 3 > > RINGMESH_API RINGMesh::MeshBaseBuilder< 3 >::create_builder ( MeshBase< 3 > &  mesh)

Definition at line 126 of file mesh_builder.cpp.

◆ create_builder() [3/3]

template<index_t DIMENSION>
static std::unique_ptr< MeshBaseBuilder< DIMENSION > > RINGMesh::MeshBaseBuilder< DIMENSION >::create_builder ( MeshBase< DIMENSION > &  mesh)
static

◆ create_vertex() [1/2]

template<index_t DIMENSION>
index_t RINGMesh::MeshBaseBuilder< DIMENSION >::create_vertex ( )
inline

Creates a new vertex.

Returns
the index of the created vertex

Definition at line 126 of file mesh_builder.h.

◆ create_vertex() [2/2]

template<index_t DIMENSION>
index_t RINGMesh::MeshBaseBuilder< DIMENSION >::create_vertex ( const vecn< DIMENSION > &  vertex)
inline

Creates a new vertex.

Parameters
[in]coordsa pointer to dimension() coordinate.
Returns
the index of the created vertex

Definition at line 137 of file mesh_builder.h.

◆ create_vertices()

template<index_t DIMENSION>
index_t RINGMesh::MeshBaseBuilder< DIMENSION >::create_vertices ( index_t  nb)
inline

Creates a contiguous chunk of vertices.

Parameters
[in]nbnumber of sub-entities to create.
Returns
the index of the first created vertex

Definition at line 148 of file mesh_builder.h.

◆ delete_vertex_nn_search()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::delete_vertex_nn_search ( )
inlineprotected

Definition at line 205 of file mesh_builder.h.

◆ delete_vertices()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::delete_vertices ( const std::vector< bool > &  to_delete)
inline

Deletes a set of vertices.

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.

Definition at line 171 of file mesh_builder.h.

◆ do_assign_vertices()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::do_assign_vertices ( const std::vector< double > &  point_coordinates)
privatepure virtual

set vertex coordinates from a std::vector of coordinates

Parameters
[in]point_coordinatesa set of x, y (, z) coordinates

◆ do_clear()

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

Removes all the entities and attributes of this mesh.

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.

◆ do_clear_vertices()

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

Removes all the vertices 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.

◆ do_copy()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::do_copy ( const MeshBase< DIMENSION > &  rhs,
bool  copy_attributes 
)
privatepure virtual

Copy a mesh into this one.

Parameters
[in]rhsa const reference to the mesh to be copied.
[in]copy_attributesif true, all attributes are copied.
Returns
a modifiable reference to the point that corresponds to the vertex.

◆ do_create_vertex()

template<index_t DIMENSION>
virtual index_t RINGMesh::MeshBaseBuilder< DIMENSION >::do_create_vertex ( )
privatepure virtual

Creates a new vertex.

Returns
the index of the created vertex

◆ do_create_vertices()

template<index_t DIMENSION>
virtual index_t RINGMesh::MeshBaseBuilder< DIMENSION >::do_create_vertices ( index_t  nb)
privatepure virtual

Creates a contiguous chunk of vertices.

Parameters
[in]nbnumber of sub-entities to create.
Returns
the index of the first created vertex

◆ do_delete_vertices()

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

Deletes a set of vertices.

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.

◆ do_permute_vertices()

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

◆ do_repair()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::do_repair ( GEO::MeshRepairMode  mode,
double  colocate_epsilon 
)
privatepure virtual

Fixes some defaults in a mesh.

Parameters
[in]modea combination of #MeshRepairMode flags. Combine them with the 'bitwise or' (|) operator.
[in]colocate_epsilontolerance used to colocate vertices (if #MESH_REPAIR_COLOCATE is set in mode).

◆ do_set_vertex()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::do_set_vertex ( index_t  v_id,
const vecn< DIMENSION > &  vertex 
)
privatepure virtual

Sets a point.

Parameters
[in]v_idthe vertex, in 0.. nb_vetices()-1.
[in]vertexthe vertex coordinates
Returns
reference to the point that corresponds to the vertex.

◆ load_mesh()

template<index_t DIMENSION>
virtual void RINGMesh::MeshBaseBuilder< DIMENSION >::load_mesh ( const std::string &  filename)
pure virtual

◆ permute_vertices()

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

Definition at line 189 of file mesh_builder.h.

◆ repair()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::repair ( GEO::MeshRepairMode  mode,
double  colocate_epsilon 
)
inline

Fixes some defaults in a mesh.

Parameters
[in]modea combination of #MeshRepairMode flags. Combine them with the 'bitwise or' (|) operator.
[in]colocate_epsilontolerance used to colocate vertices (if #MESH_REPAIR_COLOCATE is set in mode).

Definition at line 102 of file mesh_builder.h.

◆ ringmesh_disable_copy_and_move()

template<index_t DIMENSION>
RINGMesh::MeshBaseBuilder< DIMENSION >::ringmesh_disable_copy_and_move ( MeshBaseBuilder< DIMENSION >  )
private

◆ ringmesh_template_assert_2d_or_3d()

template<index_t DIMENSION>
RINGMesh::MeshBaseBuilder< DIMENSION >::ringmesh_template_assert_2d_or_3d ( DIMENSION  )
private

◆ set_vertex()

template<index_t DIMENSION>
void RINGMesh::MeshBaseBuilder< DIMENSION >::set_vertex ( index_t  v_id,
const vecn< DIMENSION > &  vertex 
)
inline

Sets a point.

Parameters
[in]v_idthe vertex, in 0.. nb_vetices()-1.
[in]vertexthe vertex coordinates
Returns
reference to the point that corresponds to the vertex.

Definition at line 117 of file mesh_builder.h.

Member Data Documentation

◆ mesh_base_

template<index_t DIMENSION>
MeshBase< DIMENSION >& RINGMesh::MeshBaseBuilder< DIMENSION >::mesh_base_
protected

Definition at line 290 of file mesh_builder.h.


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