Skip to content

Commit 93ecb48

Browse files
feat(ModelInspector): Added the inspection of the component meshes of models (BRep and Section)
1 parent 7e8fcf8 commit 93ecb48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3010
-90
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"${workspaceFolder}/include",
55
"${workspaceFolder}/build",
66
"${workspaceFolder:OpenGeode}/build/opengeode/install/include",
7-
"${workspaceFolder:OpenGeode-IO}/build/opengeode-io/install/include"
7+
"${workspaceFolder:OpenGeode-IO}/build/opengeode-io/install/include",
8+
"${workspaceFolder:OpenGeode-Geosciences}/include"
89
],
910
"files.watcherExclude": {
1011
"${workspaceFolder}/build/**": true

bindings/python/src/inspector/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,26 @@ add_geode_python_binding(
2222
NAME "py_inspector"
2323
SOURCES
2424
"adjacency/surface_adjacency.h"
25-
"adjacency/solid_adjacency"
25+
"adjacency/solid_adjacency.h"
26+
"adjacency/brep_meshes_adjacency.h"
27+
"adjacency/section_meshes_adjacency.h"
2628
"colocation/edgedcurve_colocation.h"
2729
"colocation/pointset_colocation.h"
2830
"colocation/surface_colocation.h"
2931
"colocation/solid_colocation.h"
3032
"colocation/unique_vertices_colocation.h"
33+
"colocation/component_meshes_colocation.h"
3134
"degeneration/edgedcurve_degeneration.h"
3235
"degeneration/solid_degeneration.h"
3336
"degeneration/surface_degeneration.h"
37+
"degeneration/component_meshes_degeneration.h"
3438
"manifold/surface_edge_manifold.h"
3539
"manifold/surface_vertex_manifold.h"
3640
"manifold/solid_vertex_manifold.h"
3741
"manifold/solid_edge_manifold.h"
3842
"manifold/solid_facet_manifold.h"
43+
"manifold/brep_meshes_manifold.h"
44+
"manifold/section_meshes_manifold.h"
3945
"topology/brep_topology.h"
4046
"topology/section_topology.h"
4147
"inspector.cpp"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include <geode/model/representation/core/brep.h>
25+
26+
#include <geode/inspector/criterion/adjacency/brep_meshes_adjacency.h>
27+
28+
#define PYTHON_BREP_COMPONENTS_ADJACENCY() \
29+
pybind11::class_< BRepComponentMeshesAdjacency >( \
30+
module, "BRepComponentMeshesAdjacency" ) \
31+
.def( pybind11::init< const BRep& >() ) \
32+
.def( pybind11::init< const BRep&, bool >() ) \
33+
.def( "components_with_wrong_adjacencies", \
34+
&BRepComponentMeshesAdjacency::components_with_wrong_adjacencies ) \
35+
.def( "surfaces_nb_edges_with_wrong_adjacencies", \
36+
&BRepComponentMeshesAdjacency:: \
37+
surfaces_nb_edges_with_wrong_adjacencies ) \
38+
.def( "surfaces_edges_with_wrong_adjacencies", \
39+
&BRepComponentMeshesAdjacency:: \
40+
surfaces_edges_with_wrong_adjacencies ) \
41+
.def( "blocks_nb_facets_with_wrong_adjacencies", \
42+
&BRepComponentMeshesAdjacency:: \
43+
blocks_nb_facets_with_wrong_adjacencies ) \
44+
.def( "blocks_facets_with_wrong_adjacencies", \
45+
&BRepComponentMeshesAdjacency:: \
46+
blocks_facets_with_wrong_adjacencies )
47+
48+
namespace geode
49+
{
50+
void define_brep_meshes_adjacency( pybind11::module& module )
51+
{
52+
PYTHON_BREP_COMPONENTS_ADJACENCY();
53+
}
54+
} // namespace geode
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include <geode/model/representation/core/section.h>
25+
26+
#include <geode/inspector/criterion/adjacency/section_meshes_adjacency.h>
27+
28+
#define PYTHON_SECTION_COMPONENTS_ADJACENCY() \
29+
pybind11::class_< SectionComponentMeshesAdjacency >( \
30+
module, "SectionComponentMeshesAdjacency" ) \
31+
.def( pybind11::init< const Section& >() ) \
32+
.def( pybind11::init< const Section&, bool >() ) \
33+
.def( "components_with_wrong_adjacencies", \
34+
&SectionComponentMeshesAdjacency:: \
35+
components_with_wrong_adjacencies ) \
36+
.def( "surfaces_nb_edges_with_wrong_adjacencies", \
37+
&SectionComponentMeshesAdjacency:: \
38+
surfaces_nb_edges_with_wrong_adjacencies ) \
39+
.def( "surfaces_edges_with_wrong_adjacencies", \
40+
&SectionComponentMeshesAdjacency:: \
41+
surfaces_edges_with_wrong_adjacencies )
42+
43+
namespace geode
44+
{
45+
void define_section_meshes_adjacency( pybind11::module& module )
46+
{
47+
PYTHON_SECTION_COMPONENTS_ADJACENCY();
48+
}
49+
} // namespace geode

bindings/python/src/inspector/brep_inspector.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
#define PYTHON_BREP_INSPECTOR() \
2929
pybind11::class_< BRepInspector, BRepTopologyInspector, \
30-
BRepUniqueVerticesColocation >( module, "BRepInspector" ) \
30+
BRepUniqueVerticesColocation, BRepComponentMeshesAdjacency, \
31+
BRepComponentMeshesColocation, BRepComponentMeshesDegeneration, \
32+
BRepComponentMeshesManifold >( module, "BRepInspector" ) \
3133
.def( pybind11::init< const BRep& >() ) \
3234
.def( pybind11::init< const BRep&, bool >() )
3335

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include <geode/model/representation/core/brep.h>
25+
#include <geode/model/representation/core/section.h>
26+
27+
#include <geode/inspector/criterion/colocation/component_meshes_colocation.h>
28+
29+
#define PYTHON_COMPONENTS_COLOCATION( type, suffix ) \
30+
const auto name##type = \
31+
absl::StrCat( #type, "ComponentMeshesColocation" ); \
32+
pybind11::class_< suffix##ComponentMeshesColocation >( \
33+
module, name##type.c_str() ) \
34+
.def( pybind11::init< const type& >() ) \
35+
.def( pybind11::init< const type&, bool >() ) \
36+
.def( "components_with_colocated_points", \
37+
&suffix##ComponentMeshesColocation:: \
38+
components_with_colocated_points ) \
39+
.def( "components_nb_colocated_points", \
40+
&suffix##ComponentMeshesColocation:: \
41+
components_nb_colocated_points ) \
42+
.def( "components_colocated_points_groups", \
43+
&suffix##ComponentMeshesColocation:: \
44+
components_colocated_points_groups )
45+
46+
namespace geode
47+
{
48+
void define_models_meshes_colocation( pybind11::module& module )
49+
{
50+
PYTHON_COMPONENTS_COLOCATION( Section, Section );
51+
PYTHON_COMPONENTS_COLOCATION( BRep, BRep );
52+
}
53+
} // namespace geode

bindings/python/src/inspector/colocation/unique_vertices_colocation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
namespace geode
7575
{
76-
void define_models_colocation( pybind11::module& module )
76+
void define_models_uv_colocation( pybind11::module& module )
7777
{
7878
PYTHON_SECTION_UV_COLOCATION();
7979
PYTHON_BREP_UV_COLOCATION();
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include <geode/model/representation/core/brep.h>
25+
#include <geode/model/representation/core/section.h>
26+
27+
#include <geode/inspector/criterion/degeneration/component_meshes_degeneration.h>
28+
29+
#define PYTHON_COMPONENTS_DEGENERATION( type, suffix ) \
30+
const auto name##type = \
31+
absl::StrCat( #type, "ComponentMeshesDegeneration" ); \
32+
pybind11::class_< suffix##ComponentMeshesDegeneration >( \
33+
module, name##type.c_str() ) \
34+
.def( pybind11::init< const type& >() ) \
35+
.def( pybind11::init< const type&, bool >() ) \
36+
.def( "components_with_degenerated_edges", \
37+
&suffix##ComponentMeshesDegeneration:: \
38+
components_with_degenerated_edges ) \
39+
.def( "components_nb_degenerated_edges", \
40+
&suffix##ComponentMeshesDegeneration:: \
41+
components_nb_degenerated_edges ) \
42+
.def( "components_degenerated_edges", \
43+
&suffix##ComponentMeshesDegeneration:: \
44+
components_degenerated_edges )
45+
46+
namespace geode
47+
{
48+
void define_models_meshes_degeneration( pybind11::module& module )
49+
{
50+
PYTHON_COMPONENTS_DEGENERATION( Section, Section );
51+
PYTHON_COMPONENTS_DEGENERATION( BRep, BRep );
52+
}
53+
} // namespace geode

bindings/python/src/inspector/inspector.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,25 @@
2525
#include "pybind11/pybind11.h"
2626
#include "pybind11/stl.h"
2727

28+
#include "adjacency/brep_meshes_adjacency.h"
29+
#include "adjacency/section_meshes_adjacency.h"
2830
#include "adjacency/solid_adjacency.h"
2931
#include "adjacency/surface_adjacency.h"
3032

33+
#include "colocation/component_meshes_colocation.h"
3134
#include "colocation/edgedcurve_colocation.h"
3235
#include "colocation/pointset_colocation.h"
3336
#include "colocation/solid_colocation.h"
3437
#include "colocation/surface_colocation.h"
3538
#include "colocation/unique_vertices_colocation.h"
3639

40+
#include "degeneration/component_meshes_degeneration.h"
3741
#include "degeneration/edgedcurve_degeneration.h"
3842
#include "degeneration/solid_degeneration.h"
3943
#include "degeneration/surface_degeneration.h"
4044

45+
#include "manifold/brep_meshes_manifold.h"
46+
#include "manifold/section_meshes_manifold.h"
4147
#include "manifold/solid_edge_manifold.h"
4248
#include "manifold/solid_facet_manifold.h"
4349
#include "manifold/solid_vertex_manifold.h"
@@ -54,26 +60,44 @@
5460
#include "solid_inspector.h"
5561
#include "surface_inspector.h"
5662

63+
namespace pybind11
64+
{
65+
namespace detail
66+
{
67+
template < typename Key, typename Value >
68+
struct type_caster< absl::flat_hash_map< Key, Value > >
69+
: map_caster< absl::flat_hash_map< Key, Value >, Key, Value >
70+
{
71+
};
72+
} // namespace detail
73+
} // namespace pybind11
74+
5775
PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
5876
{
5977
module.doc() = "OpenGeode-Inspector Python binding";
6078
geode::define_surface_adjacency( module );
6179
geode::define_solid_adjacency( module );
80+
geode::define_section_meshes_adjacency( module );
81+
geode::define_brep_meshes_adjacency( module );
6282
geode::define_edgedcurve_colocation( module );
6383
geode::define_pointset_colocation( module );
64-
geode::define_solid_colocation( module );
6584
geode::define_surface_colocation( module );
85+
geode::define_solid_colocation( module );
86+
geode::define_models_meshes_colocation( module );
87+
geode::define_models_uv_colocation( module );
6688
geode::define_edgedcurve_degeneration( module );
6789
geode::define_solid_degeneration( module );
6890
geode::define_surface_degeneration( module );
91+
geode::define_models_meshes_degeneration( module );
6992
geode::define_surface_edge_manifold( module );
7093
geode::define_surface_vertex_manifold( module );
7194
geode::define_solid_edge_manifold( module );
7295
geode::define_solid_vertex_manifold( module );
7396
geode::define_solid_facet_manifold( module );
97+
geode::define_brep_meshes_manifold( module );
98+
geode::define_section_meshes_manifold( module );
7499
geode::define_brep_topology_inspector( module );
75100
geode::define_section_topology_inspector( module );
76-
geode::define_models_colocation( module );
77101
geode::define_brep_inspector( module );
78102
geode::define_section_inspector( module );
79103
geode::define_pointset_inspector( module );

0 commit comments

Comments
 (0)