Skip to content

Commit 4551cb6

Browse files
committed
feat(Models): Added the inspection of the colocation of a model (BRep/Section) unique vertices.
1 parent 22906c5 commit 4551cb6

36 files changed

+1127
-159
lines changed

bindings/python/inspector.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#
44

55
import opengeode
6+
import opengeode_io
7+
import opengeode_geosciences
8+
import opengeode_geosciencesio
69

710
from .opengeode_inspector_py_inspector import *
811

bindings/python/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
OpenGeode-core >= 10.0.16, == 10.*
1+
OpenGeode-core >= 10.7.2, == 10.*
2+
OpenGeode-IO >= 5.18.7, == 5.*
3+
OpenGeode-Geosciences >= 5.4.6, == 5.*
4+
OpenGeode-GeosciencesIO >= 3.8.3, == 3.*

bindings/python/src/inspector/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ add_geode_python_binding(
2727
"colocation/pointset_colocation.h"
2828
"colocation/surface_colocation.h"
2929
"colocation/solid_colocation.h"
30+
"colocation/unique_vertices_colocation.h"
3031
"degeneration/edgedcurve_degeneration.h"
3132
"degeneration/solid_degeneration.h"
3233
"degeneration/surface_degeneration.h"

bindings/python/src/inspector/brep_inspector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <geode/inspector/brep_inspector.h>
2727

2828
#define PYTHON_BREP_INSPECTOR() \
29-
pybind11::class_< BRepInspector, BRepTopologyInspector >( \
30-
module, "BRepInspector" ) \
29+
pybind11::class_< BRepInspector, BRepTopologyInspector, \
30+
BRepUniqueVerticesColocation >( module, "BRepInspector" ) \
3131
.def( pybind11::init< const BRep& >() ) \
3232
.def( pybind11::init< const BRep&, bool >() )
3333

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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/unique_vertices_colocation.h>
28+
29+
#define PYTHON_SECTION_UV_COLOCATION() \
30+
pybind11::class_< SectionUniqueVerticesColocation >( \
31+
module, "SectionUniqueVerticesColocation" ) \
32+
.def( pybind11::init< const Section& >() ) \
33+
.def( pybind11::init< const Section&, bool >() ) \
34+
.def( "model_has_unique_vertices_linked_to_different_points", \
35+
&SectionUniqueVerticesColocation:: \
36+
model_has_unique_vertices_linked_to_different_points ) \
37+
.def( "model_has_colocated_unique_vertices", \
38+
&SectionUniqueVerticesColocation:: \
39+
model_has_colocated_unique_vertices ) \
40+
.def( "nb_colocated_unique_vertices", \
41+
&SectionUniqueVerticesColocation::nb_colocated_unique_vertices ) \
42+
.def( "nb_unique_vertices_linked_to_different_points", \
43+
&SectionUniqueVerticesColocation:: \
44+
nb_unique_vertices_linked_to_different_points ) \
45+
.def( "colocated_unique_vertices_groups", \
46+
&SectionUniqueVerticesColocation:: \
47+
colocated_unique_vertices_groups ) \
48+
.def( "unique_vertices_linked_to_different_points", \
49+
&SectionUniqueVerticesColocation:: \
50+
unique_vertices_linked_to_different_points )
51+
52+
#define PYTHON_BREP_UV_COLOCATION() \
53+
pybind11::class_< BRepUniqueVerticesColocation >( \
54+
module, "BRepUniqueVerticesColocation" ) \
55+
.def( pybind11::init< const BRep& >() ) \
56+
.def( pybind11::init< const BRep&, bool >() ) \
57+
.def( "model_has_unique_vertices_linked_to_different_points", \
58+
&BRepUniqueVerticesColocation:: \
59+
model_has_unique_vertices_linked_to_different_points ) \
60+
.def( "model_has_colocated_unique_vertices", \
61+
&BRepUniqueVerticesColocation:: \
62+
model_has_colocated_unique_vertices ) \
63+
.def( "nb_colocated_unique_vertices", \
64+
&BRepUniqueVerticesColocation::nb_colocated_unique_vertices ) \
65+
.def( "nb_unique_vertices_linked_to_different_points", \
66+
&BRepUniqueVerticesColocation:: \
67+
nb_unique_vertices_linked_to_different_points ) \
68+
.def( "colocated_unique_vertices_groups", \
69+
&BRepUniqueVerticesColocation::colocated_unique_vertices_groups ) \
70+
.def( "unique_vertices_linked_to_different_points", \
71+
&BRepUniqueVerticesColocation:: \
72+
unique_vertices_linked_to_different_points )
73+
74+
namespace geode
75+
{
76+
void define_models_colocation( pybind11::module& module )
77+
{
78+
PYTHON_SECTION_UV_COLOCATION();
79+
PYTHON_BREP_UV_COLOCATION();
80+
}
81+
} // namespace geode

bindings/python/src/inspector/inspector.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "colocation/pointset_colocation.h"
3333
#include "colocation/solid_colocation.h"
3434
#include "colocation/surface_colocation.h"
35+
#include "colocation/unique_vertices_colocation.h"
3536

3637
#include "degeneration/edgedcurve_degeneration.h"
3738
#include "degeneration/solid_degeneration.h"
@@ -72,6 +73,7 @@ PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
7273
geode::define_solid_facet_manifold( module );
7374
geode::define_brep_topology_inspector( module );
7475
geode::define_section_topology_inspector( module );
76+
geode::define_models_colocation( module );
7577
geode::define_brep_inspector( module );
7678
geode::define_section_inspector( module );
7779
geode::define_pointset_inspector( module );

bindings/python/src/inspector/section_inspector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <geode/inspector/section_inspector.h>
2727

2828
#define PYTHON_SECTION_INSPECTOR() \
29-
pybind11::class_< SectionInspector, SectionTopologyInspector >( \
30-
module, "SectionInspector" ) \
29+
pybind11::class_< SectionInspector, SectionTopologyInspector, \
30+
SectionUniqueVerticesColocation >( module, "SectionInspector" ) \
3131
.def( pybind11::init< const Section& >() ) \
3232
.def( pybind11::init< const Section&, bool >() )
3333

bindings/python/src/inspector/topology/brep_topology.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
.def( "part_of_invalid_multiple_surfaces_unique_vertices", \
8484
&BRepTopologyInspector:: \
8585
part_of_invalid_multiple_surfaces_unique_vertices ) \
86+
.def( "part_of_line_and_not_on_surface_border_unique_vertices", \
87+
&BRepTopologyInspector:: \
88+
part_of_line_and_not_on_surface_border_unique_vertices ) \
8689
.def( "part_of_invalid_blocks_unique_vertices", \
8790
&BRepTopologyInspector::part_of_invalid_blocks_unique_vertices )
8891

bindings/python/src/inspector/topology/section_topology.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@
7070
part_of_lines_but_not_corner_unique_vertices ) \
7171
.def( "part_of_invalid_surfaces_unique_vertices", \
7272
&SectionTopologyInspector:: \
73-
part_of_invalid_surfaces_unique_vertices )
73+
part_of_invalid_surfaces_unique_vertices ) \
74+
.def( "part_of_line_and_not_on_surface_border_unique_vertices", \
75+
&SectionTopologyInspector:: \
76+
part_of_line_and_not_on_surface_border_unique_vertices )
7477

7578
namespace geode
7679
{

bindings/python/tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ add_geode_python_test(
2424
${PROJECT_NAME}::py_inspector
2525
)
2626

27+
add_geode_python_test(
28+
SOURCE "test-py-section-topology.py"
29+
DEPENDENCIES
30+
${PROJECT_NAME}::py_inspector
31+
)
32+
2733
add_geode_python_test(
2834
SOURCE "test-py-edgedcurve-colocation.py"
2935
DEPENDENCIES

0 commit comments

Comments
 (0)