36 #include <ringmesh/ringmesh_tests_config.h> 49 void error( index_t vertex_id_in_mesh_entity,
50 index_t vertex_id_in_geomodel_mesh,
51 const gmme_id& mesh_entity_gmme_id )
54 " in entity ", mesh_entity_gmme_id.
type().
string(),
55 mesh_entity_gmme_id.
index(),
56 " has not the same coordinates than its equivalent vertex ",
57 vertex_id_in_geomodel_mesh,
" in the GeoModelMesh" );
61 const GeoModelMeshVertices3D& geomodel_mesh_vertices =
62 geomodel.mesh.vertices;
64 geomodel.entity_type_manager().mesh_entity_manager.mesh_entity_types() )
66 for( index_t mesh_entity_id :
67 range( geomodel.nb_mesh_entities( mesh_entity_type ) ) )
69 const GeoModelMeshEntity3D& cur_geomodel_mesh_entity =
71 gmme_id( mesh_entity_type, mesh_entity_id ) );
72 for( index_t vertex_id_in_mesh_entity :
73 range( cur_geomodel_mesh_entity.nb_vertices() ) )
75 index_t vertex_id_in_geomodel_mesh =
76 geomodel_mesh_vertices.geomodel_vertex_id(
77 cur_geomodel_mesh_entity.gmme(),
78 vertex_id_in_mesh_entity );
79 if( geomodel_mesh_vertices.vertex( vertex_id_in_geomodel_mesh )
80 != cur_geomodel_mesh_entity.vertex(
81 vertex_id_in_mesh_entity ) )
83 error( vertex_id_in_mesh_entity, vertex_id_in_geomodel_mesh,
84 cur_geomodel_mesh_entity.gmme() );
93 const GeoModelMeshVertices3D& geomodel_mesh_vertices =
94 geomodel.mesh.vertices;
96 for( index_t vertex_id_in_geomodel_mesh :
97 range( geomodel_mesh_vertices.nb() ) )
99 std::vector< GMEVertex > vertices_on_geomodel_mesh_entity =
100 geomodel_mesh_vertices.gme_vertices( vertex_id_in_geomodel_mesh );
101 for(
const GMEVertex& cur_vertex_on_geomodel :
102 vertices_on_geomodel_mesh_entity )
104 const GeoModelMeshEntity3D& cur_geomodel_mesh_entity =
105 geomodel.mesh_entity( cur_vertex_on_geomodel.gmme );
106 index_t vertex_id_in_mesh_entity = cur_vertex_on_geomodel.v_index;
107 if( geomodel_mesh_vertices.vertex( vertex_id_in_geomodel_mesh )
108 != cur_geomodel_mesh_entity.vertex( vertex_id_in_mesh_entity ) )
110 error( vertex_id_in_mesh_entity, vertex_id_in_geomodel_mesh,
111 cur_geomodel_mesh_entity.gmme() );
124 Logger::out(
"TEST",
"Test GeoModelMeshVertices" );
126 std::string input_model_file_name =
127 ringmesh_test_data_path +
"unit_cube_volume_meshed.gm";
130 bool loaded_model_is_valid =
geomodel_load( in, input_model_file_name );
132 if( !loaded_model_is_valid )
135 "RINGMesh Test",
"Failed when loading model ", in.name() );
145 catch(
const std::exception& e )
Entity_type_template type() const
bool geomodel_load(GeoModel< DIMENSION > &geomodel, const std::string &filename)
static void err(const std::string &feature, const Args &... args)
static void out(const std::string &feature, const Args &... args)
void test_GMEVertex(const GeoModel3D &geomodel)
Vertex in a GeoModelEntity.
const std::string & category() const
The MeshEntityType described the type of the meshed entities There are 4 MeshEntityTypes correspondin...
void test_geomodel_vertices(const GeoModel3D &geomodel)
Classes to build GeoModel from various inputs.
void error(index_t vertex_id_in_mesh_entity, index_t vertex_id_in_geomodel_mesh, const gmme_id &mesh_entity_gmme_id)
This template is a specialization of a gme_id to the GeoModelMeshEntity.
void RINGMESH_API default_configure()
const std::string & string() const