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

Try repairing a supposedly invalid GeoModel. More...

#include <geomodel_builder_repair.h>

Public Types

enum  RepairMode {
  ALL, BASIC, COLOCATED_VERTICES, DEGENERATE_FACETS_EDGES,
  LINE_BOUNDARY_ORDER, CONTACTS, ISOLATED_VERTICES
}
 

Public Member Functions

void repair (RepairMode repair_mode)
 Repair a GeoModel according a repair mode. More...
 

Private Member Functions

 ringmesh_disable_copy_and_move (GeoModelBuilderRepair)
 
 ringmesh_template_assert_2d_or_3d (DIMENSION)
 
 GeoModelBuilderRepair (GeoModelBuilder< DIMENSION > &builder, GeoModel< DIMENSION > &geomodel)
 
 ~GeoModelBuilderRepair ()=default
 
void geomodel_mesh_repair ()
 
void remove_colocated_entity_vertices_and_update_gm ()
 
void remove_degenerate_polygons_and_edges_and_update_gm ()
 
void repair_line_boundary_vertex_order ()
 For all the lines in the geomodel, switch line boundaries if the way of their indices does not follow the way of the vertex indices. More...
 
void remove_isolated_vertices ()
 remove isolated vertices on GeoModelMeshEntities More...
 
void remove_isolated_vertices_base ()
 
void remove_isolated_vertices_on_mesh_entity (const GeoModelMeshEntity< DIMENSION > &geomodel_mesh_entity)
 remove isolated vertices on a GeoModelMeshEntity More...
 
index_t repair_line_mesh (const Line< DIMENSION > &line)
 Detect and remove degenerate edges in a. More...
 
std::vector< boolline_detect_degenerate_edges (const Line< DIMENSION > &line, std::vector< index_t > &colocated_vertices)
 
std::vector< index_t > surface_detect_degenerate_polygons (const Surface< DIMENSION > &surface, std::vector< index_t > &colocated_vertices)
 
bool polygon_is_degenerate (const Surface< DIMENSION > &surface, index_t polygon_id, std::vector< index_t > &colocated_vertices)
 Tests whether a polygon is degenerate. More...
 
index_t detect_degenerate_polygons (const Surface< DIMENSION > &surface)
 Detect and remove degenerated polygons in a Surface. More...
 
void remove_degenerate_polygons_and_edges (std::set< gmme_id > &to_remove)
 Remove degenerate polygons and edges from the Surface and Line of the geomodel. More...
 
void remove_colocated_entity_vertices (std::set< gmme_id > &to_remove)
 Remove colocated vertices of the geomodel. More...
 
std::set< index_t > vertices_on_inside_boundary (const gmme_id &E_id)
 
bool edge_is_degenerate (const Line< DIMENSION > &line, index_t edge, const std::vector< index_t > &colocated_vertices)
 Checks if an edge is degenerate. More...
 
void build_contacts ()
 
template<>
void remove_isolated_vertices ()
 
template<>
void remove_isolated_vertices ()
 

Private Attributes

GeoModelBuilder< DIMENSION > & builder_
 
GeoModel< DIMENSION > & geomodel_
 
GeoModelAccess< DIMENSION > geomodel_access_
 

Friends

class GeoModelBuilderBase< DIMENSION >
 
class GeoModelBuilder< DIMENSION >
 

Detailed Description

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

Try repairing a supposedly invalid GeoModel.

Remove colocated vertices in all GeoModelMeshEntity. Remove degenerated edges and polygons in Surfaces and Lines.

Warning
This function will by no mean fix all errors in a GeoModel It has been tested on a very small number of geomodels.

Definition at line 64 of file geomodel_builder_repair.h.

Member Enumeration Documentation

◆ RepairMode

template<index_t DIMENSION>
enum RINGMesh::GeoModelBuilderRepair::RepairMode

Enumeration of the different repair modes.

Enumerator
ALL 
BASIC 
COLOCATED_VERTICES 
DEGENERATE_FACETS_EDGES 
LINE_BOUNDARY_ORDER 
CONTACTS 
ISOLATED_VERTICES 

Definition at line 75 of file geomodel_builder_repair.h.

Constructor & Destructor Documentation

◆ GeoModelBuilderRepair()

template<index_t DIMENSION>
RINGMesh::GeoModelBuilderRepair< DIMENSION >::GeoModelBuilderRepair ( GeoModelBuilder< DIMENSION > &  builder,
GeoModel< DIMENSION > &  geomodel 
)
private

Definition at line 52 of file geomodel_builder_repair.cpp.

◆ ~GeoModelBuilderRepair()

template<index_t DIMENSION>
RINGMesh::GeoModelBuilderRepair< DIMENSION >::~GeoModelBuilderRepair ( )
privatedefault

Member Function Documentation

◆ build_contacts()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::build_contacts ( )
private

Definition at line 547 of file geomodel_builder_repair.cpp.

◆ detect_degenerate_polygons()

template<index_t DIMENSION>
index_t RINGMesh::GeoModelBuilderRepair< DIMENSION >::detect_degenerate_polygons ( const Surface< DIMENSION > &  surface)
private

Detect and remove degenerated polygons in a Surface.

Parameters
[in,out]surfaceSurface to check for potential degenerate polygons.
Returns
the number of degenerate polygons in surface.

Definition at line 275 of file geomodel_builder_repair.cpp.

◆ edge_is_degenerate()

template<index_t DIMENSION>
bool RINGMesh::GeoModelBuilderRepair< DIMENSION >::edge_is_degenerate ( const Line< DIMENSION > &  line,
index_t  edge,
const std::vector< index_t > &  colocated_vertices 
)
private

Checks if an edge is degenerate.

An edge is degenerate if both vertices are colocated.

Parameters
[in]lineLine to check the edge edge.
[in]edgeedge index in Line line.
[in]colocated_verticescontains the colocated mapping of the Line.
Returns
true if the edge is degenerate. Else false.

Definition at line 534 of file geomodel_builder_repair.cpp.

◆ geomodel_mesh_repair()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::geomodel_mesh_repair ( )
private

All implemented repair for a GeoModel.

Definition at line 92 of file geomodel_builder_repair.cpp.

◆ line_detect_degenerate_edges()

template<index_t DIMENSION>
std::vector< bool > RINGMesh::GeoModelBuilderRepair< DIMENSION >::line_detect_degenerate_edges ( const Line< DIMENSION > &  line,
std::vector< index_t > &  colocated_vertices 
)
private
Returns
a vector of boolean. Element i of this vector corresponds to the edge i of the line. If the element is true, the edge is degenerated.

Definition at line 291 of file geomodel_builder_repair.cpp.

◆ polygon_is_degenerate()

template<index_t DIMENSION>
bool RINGMesh::GeoModelBuilderRepair< DIMENSION >::polygon_is_degenerate ( const Surface< DIMENSION > &  surface,
index_t  polygon_id,
std::vector< index_t > &  colocated_vertices 
)
private

Tests whether a polygon is degenerate.

Note
Copied and modified from geogram\mesh\mesh_repair.cpp
Parameters
[in]surfacethe Surface that the polygon belongs to
[in]polygon_idthe index of the polygon in S
[out]colocated_verticescontains the found colocated vertices in f if any.
Returns
true if polygon f has duplicated vertices, false otherwise

Definition at line 232 of file geomodel_builder_repair.cpp.

◆ remove_colocated_entity_vertices()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_colocated_entity_vertices ( std::set< gmme_id > &  to_remove)
private

Remove colocated vertices of the geomodel.

Parameters
[out]to_removegmme_t of the entities of the geomodel that are empty once degenerate entities are removed

Definition at line 438 of file geomodel_builder_repair.cpp.

◆ remove_colocated_entity_vertices_and_update_gm()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_colocated_entity_vertices_and_update_gm ( )
private

Remove the colocated vertices in all the GeoModelMeshEntities within the GeoModel. GeoModelMeshEntities without any vertex anymore (after the removal of the vertices) are removed off the GeoModel.

Definition at line 118 of file geomodel_builder_repair.cpp.

◆ remove_degenerate_polygons_and_edges()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_degenerate_polygons_and_edges ( std::set< gmme_id > &  to_remove)
private

Remove degenerate polygons and edges from the Surface and Line of the geomodel.

Parameters
[out]to_removegmme_t of the entities (Surface and Line) of the geomodel that are empty once degenerate entities are removed
Precondition
Colocated vertices have already been removed

Definition at line 324 of file geomodel_builder_repair.cpp.

◆ remove_degenerate_polygons_and_edges_and_update_gm()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_degenerate_polygons_and_edges_and_update_gm ( )
private

Remove the degenerated polygons in all the Surfaces and all the degenerate edges in all the Lines within the GeoModel. Degeneration is due to colocated vertices. Surfaces and Lines without any vertex anymore (after the removal of the vertices) are removed off the GeoModel.

TODO when it will works, use GeoModelBuilderRemoval::remove_entities_and_dependencies

Definition at line 134 of file geomodel_builder_repair.cpp.

◆ remove_isolated_vertices() [1/3]

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_isolated_vertices ( )
private

remove isolated vertices on GeoModelMeshEntities

◆ remove_isolated_vertices() [2/3]

template<>
void RINGMesh::GeoModelBuilderRepair< 3 >::remove_isolated_vertices ( )
private

Definition at line 169 of file geomodel_builder_repair.cpp.

◆ remove_isolated_vertices() [3/3]

template<>
void RINGMesh::GeoModelBuilderRepair< 2 >::remove_isolated_vertices ( )
private

Definition at line 186 of file geomodel_builder_repair.cpp.

◆ remove_isolated_vertices_base()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_isolated_vertices_base ( )
private

Definition at line 199 of file geomodel_builder_repair.cpp.

◆ remove_isolated_vertices_on_mesh_entity()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::remove_isolated_vertices_on_mesh_entity ( const GeoModelMeshEntity< DIMENSION > &  geomodel_mesh_entity)
private

remove isolated vertices on a GeoModelMeshEntity

Parameters
[in]geomodel_mesh_entityThe GeoModelMeshEntity to repair

Definition at line 209 of file geomodel_builder_repair.cpp.

◆ repair()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::repair ( RepairMode  repair_mode)

Repair a GeoModel according a repair mode.

Parameters
[in]repair_moderepair mode to apply.

Definition at line 61 of file geomodel_builder_repair.cpp.

◆ repair_line_boundary_vertex_order()

template<index_t DIMENSION>
void RINGMesh::GeoModelBuilderRepair< DIMENSION >::repair_line_boundary_vertex_order ( )
private

For all the lines in the geomodel, switch line boundaries if the way of their indices does not follow the way of the vertex indices.

Definition at line 153 of file geomodel_builder_repair.cpp.

◆ repair_line_mesh()

template<index_t DIMENSION>
index_t RINGMesh::GeoModelBuilderRepair< DIMENSION >::repair_line_mesh ( const Line< DIMENSION > &  line)
private

Detect and remove degenerate edges in a.

Parameters
line.
Returns
the number of degenerate edges that have been removed from the line.

We have a problem if some vertices are left isolated If we remove them here we can kill all indices correspondances

Definition at line 305 of file geomodel_builder_repair.cpp.

◆ ringmesh_disable_copy_and_move()

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

◆ ringmesh_template_assert_2d_or_3d()

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

◆ surface_detect_degenerate_polygons()

template<index_t DIMENSION>
std::vector< index_t > RINGMesh::GeoModelBuilderRepair< DIMENSION >::surface_detect_degenerate_polygons ( const Surface< DIMENSION > &  surface,
std::vector< index_t > &  colocated_vertices 
)
private
Note
Copied and modified from geogram\mesh\mesh_repair.cpp.
Returns
a vector of boolean. Element i of this vector corresponds to the facet i of the surface. If the element is true, the facet is degenerated.

Definition at line 261 of file geomodel_builder_repair.cpp.

◆ vertices_on_inside_boundary()

template<index_t DIMENSION>
std::set< index_t > RINGMesh::GeoModelBuilderRepair< DIMENSION >::vertices_on_inside_boundary ( const gmme_id E_id)
private

Get the indices of the duplicated vertices that are on an inside border. Only the vertex with the biggest index are added.

Parameters
[in]E_idGeoModelMeshEntity to check.
Returns
vector of the vertex indexes on an inside boundary.

Definition at line 382 of file geomodel_builder_repair.cpp.

Friends And Related Function Documentation

◆ GeoModelBuilder< DIMENSION >

template<index_t DIMENSION>
friend class GeoModelBuilder< DIMENSION >
friend

Definition at line 69 of file geomodel_builder_repair.h.

◆ GeoModelBuilderBase< DIMENSION >

template<index_t DIMENSION>
friend class GeoModelBuilderBase< DIMENSION >
friend

Definition at line 68 of file geomodel_builder_repair.h.

Member Data Documentation

◆ builder_

template<index_t DIMENSION>
GeoModelBuilder< DIMENSION >& RINGMesh::GeoModelBuilderRepair< DIMENSION >::builder_
private

Definition at line 224 of file geomodel_builder_repair.h.

◆ geomodel_

template<index_t DIMENSION>
GeoModel< DIMENSION >& RINGMesh::GeoModelBuilderRepair< DIMENSION >::geomodel_
private

Definition at line 225 of file geomodel_builder_repair.h.

◆ geomodel_access_

template<index_t DIMENSION>
GeoModelAccess< DIMENSION > RINGMesh::GeoModelBuilderRepair< DIMENSION >::geomodel_access_
private

Definition at line 226 of file geomodel_builder_repair.h.


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