Skip to content

Commit 2653db2

Browse files
committed
feat(OpenGeode): update to new v12
1 parent e04b8e9 commit 2653db2

Some content is hidden

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

48 files changed

+1484
-1059
lines changed

bindings/python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
from .inspector import *
21+
from .inspector import *

bindings/python/inspector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
import opengeode_geosciencesio
99

1010
from .opengeode_inspector_py_inspector import *
11-
11+
OpenGeodeInspectorInspector.initialize()

bindings/python/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
OpenGeode-core >= 11.0.1, == 11.*
1+
OpenGeode-core >= 12.0.0, == 12.*
22
OpenGeode-IO >= 5.19.0, == 5.*
3-
OpenGeode-Geosciences >= 5.5.0, == 5.*
3+
OpenGeode-Geosciences >= 5.6.0, == 5.*
44
OpenGeode-GeosciencesIO >= 3.9.0, == 3.*

bindings/python/src/inspector/inspector.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ namespace pybind11
7575
PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
7676
{
7777
module.doc() = "OpenGeode-Inspector Python binding";
78+
pybind11::class_< geode::OpenGeodeInspectorInspector >(
79+
module, "OpenGeodeInspectorInspector" )
80+
.def( "initialize", &geode::OpenGeodeInspectorInspector::initialize );
7881
geode::define_surface_adjacency( module );
7982
geode::define_solid_adjacency( module );
8083
geode::define_section_meshes_adjacency( module );

bindings/python/tests/test-py-brep.py

Lines changed: 237 additions & 141 deletions
Large diffs are not rendered by default.

bindings/python/tests/test-py-edgedcurve-colocation.py

Lines changed: 80 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,99 +19,121 @@
1919
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
# SOFTWARE.
2121

22-
import os, sys, platform
23-
if sys.version_info >= (3,8,0) and platform.system() == "Windows":
22+
import os
23+
import sys
24+
import platform
25+
if sys.version_info >= (3, 8, 0) and platform.system() == "Windows":
2426
for path in [x.strip() for x in os.environ['PATH'].split(';') if x]:
2527
os.add_dll_directory(path)
2628

2729
import opengeode as geode
2830
import opengeode_inspector_py_inspector as inspector
2931

32+
3033
def check_non_colocation2D():
3134
curve = geode.EdgedCurve2D.create()
32-
builder = geode.EdgedCurveBuilder2D.create( curve )
33-
builder.create_vertices( 4 )
34-
builder.set_point( 0, geode.Point2D( [ 0., 2. ] ) )
35-
builder.set_point( 1, geode.Point2D( [ 2., 0. ] ) )
36-
builder.set_point( 2, geode.Point2D( [ 1., 4. ] ) )
37-
builder.set_point( 3, geode.Point2D( [ 3., 3. ] ) )
38-
39-
colocation_inspector = inspector.EdgedCurveColocation2D ( curve )
35+
builder = geode.EdgedCurveBuilder2D.create(curve)
36+
builder.create_vertices(4)
37+
builder.set_point(0, geode.Point2D([0., 2.]))
38+
builder.set_point(1, geode.Point2D([2., 0.]))
39+
builder.set_point(2, geode.Point2D([1., 4.]))
40+
builder.set_point(3, geode.Point2D([3., 3.]))
41+
42+
colocation_inspector = inspector.EdgedCurveColocation2D(curve)
4043
if colocation_inspector.mesh_has_colocated_points():
41-
raise ValueError( "[Test] EdgedCurve has colocated points when it should have none." )
44+
raise ValueError(
45+
"[Test] EdgedCurve has colocated points when it should have none.")
4246
if not colocation_inspector.nb_colocated_points() == 0:
43-
raise ValueError( "[Test] EdgedCurve has more colocated points than it should." )
47+
raise ValueError(
48+
"[Test] EdgedCurve has more colocated points than it should.")
4449
if colocation_inspector.colocated_points_groups():
45-
raise ValueError( "[Test] EdgedCurve points are shown colocated whereas they are not." )
50+
raise ValueError(
51+
"[Test] EdgedCurve points are shown colocated whereas they are not.")
52+
4653

4754
def check_colocation2D():
4855
curve = geode.EdgedCurve2D.create()
49-
builder = geode.EdgedCurveBuilder2D.create( curve )
50-
builder.create_vertices( 7 )
51-
builder.set_point( 0, geode.Point2D( [ 0., 2. ] ) )
52-
builder.set_point( 1, geode.Point2D( [ 0., 2. ] ) )
53-
builder.set_point( 2, geode.Point2D( [ 0., 0. ] ) )
54-
builder.set_point( 3, geode.Point2D( [ 2., 0. ] ) )
55-
builder.set_point( 4, geode.Point2D( [ 1., 4. ] ) )
56-
builder.set_point( 5, geode.Point2D( [ 2., geode.global_epsilon / 2 ] ) )
57-
builder.set_point( 6, geode.Point2D( [ geode.global_epsilon / 1.1, 2. ] ) )
58-
59-
colocation_inspector = inspector.EdgedCurveColocation2D ( curve )
56+
builder = geode.EdgedCurveBuilder2D.create(curve)
57+
builder.create_vertices(7)
58+
builder.set_point(0, geode.Point2D([0., 2.]))
59+
builder.set_point(1, geode.Point2D([0., 2.]))
60+
builder.set_point(2, geode.Point2D([0., 0.]))
61+
builder.set_point(3, geode.Point2D([2., 0.]))
62+
builder.set_point(4, geode.Point2D([1., 4.]))
63+
builder.set_point(5, geode.Point2D([2., geode.global_epsilon / 2]))
64+
builder.set_point(6, geode.Point2D([geode.global_epsilon / 1.1, 2.]))
65+
66+
colocation_inspector = inspector.EdgedCurveColocation2D(curve)
6067
if not colocation_inspector.mesh_has_colocated_points():
61-
raise ValueError( "[Test] EdgedCurve doesn't have colocated points whereas it should have several." )
68+
raise ValueError(
69+
"[Test] EdgedCurve doesn't have colocated points whereas it should have several.")
6270
if not colocation_inspector.nb_colocated_points() == 5:
63-
raise ValueError( "[Test] EdgedCurve has wrong number of colocated points." )
64-
first_colocated_points_group = [ 0, 1, 6 ]
71+
raise ValueError(
72+
"[Test] EdgedCurve has wrong number of colocated points.")
73+
first_colocated_points_group = [0, 1, 6]
6574
if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group:
66-
raise ValueError( "[Test] EdgedCurve has wrong first colocated points group." )
67-
second_colocated_points_group = [ 3, 5 ]
75+
raise ValueError(
76+
"[Test] EdgedCurve has wrong first colocated points group.")
77+
second_colocated_points_group = [3, 5]
6878
if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group:
69-
raise ValueError( "[Test] EdgedCurve has wrong second colocated points group." )
79+
raise ValueError(
80+
"[Test] EdgedCurve has wrong second colocated points group.")
81+
7082

7183
def check_non_colocation3D():
7284
curve = geode.EdgedCurve3D.create()
73-
builder = geode.EdgedCurveBuilder3D.create( curve )
74-
builder.create_vertices( 4 )
75-
builder.set_point( 0, geode.Point3D( [ 0., 2., 0. ] ) )
76-
builder.set_point( 1, geode.Point3D( [ 2., 0., 0.5 ] ) )
77-
builder.set_point( 2, geode.Point3D( [ 1., 4., 1. ] ) )
78-
builder.set_point( 3, geode.Point3D( [ 3., 3., 2. ] ) )
79-
80-
colocation_inspector = inspector.EdgedCurveColocation3D ( curve )
85+
builder = geode.EdgedCurveBuilder3D.create(curve)
86+
builder.create_vertices(4)
87+
builder.set_point(0, geode.Point3D([0., 2., 0.]))
88+
builder.set_point(1, geode.Point3D([2., 0., 0.5]))
89+
builder.set_point(2, geode.Point3D([1., 4., 1.]))
90+
builder.set_point(3, geode.Point3D([3., 3., 2.]))
91+
92+
colocation_inspector = inspector.EdgedCurveColocation3D(curve)
8193
if colocation_inspector.mesh_has_colocated_points():
82-
raise ValueError( "[Test] (3D) EdgedCurve has colocated points when it should have none." )
94+
raise ValueError(
95+
"[Test] (3D) EdgedCurve has colocated points when it should have none.")
8396
if not colocation_inspector.nb_colocated_points() == 0:
84-
raise ValueError( "[Test] (3D) EdgedCurve has more colocated points than it should." )
97+
raise ValueError(
98+
"[Test] (3D) EdgedCurve has more colocated points than it should.")
8599
if colocation_inspector.colocated_points_groups():
86-
raise ValueError( "[Test] (3D) EdgedCurve points are shown colocated whereas they are not." )
100+
raise ValueError(
101+
"[Test] (3D) EdgedCurve points are shown colocated whereas they are not.")
102+
87103

88104
def check_colocation3D():
89105
curve = geode.EdgedCurve3D.create()
90-
builder = geode.EdgedCurveBuilder3D.create( curve )
91-
builder.create_vertices( 7 )
92-
builder.set_point( 0, geode.Point3D( [ 0., 2., 1. ] ) )
93-
builder.set_point( 1, geode.Point3D( [ 0., 2., 1. ] ) )
94-
builder.set_point( 2, geode.Point3D( [ 0., 0., 0. ] ) )
95-
builder.set_point( 3, geode.Point3D( [ 2., 0., 0. ] ) )
96-
builder.set_point( 4, geode.Point3D( [ 1., 4., 3. ] ) )
106+
builder = geode.EdgedCurveBuilder3D.create(curve)
107+
builder.create_vertices(7)
108+
builder.set_point(0, geode.Point3D([0., 2., 1.]))
109+
builder.set_point(1, geode.Point3D([0., 2., 1.]))
110+
builder.set_point(2, geode.Point3D([0., 0., 0.]))
111+
builder.set_point(3, geode.Point3D([2., 0., 0.]))
112+
builder.set_point(4, geode.Point3D([1., 4., 3.]))
97113
builder.set_point(
98-
5, geode.Point3D( [ 2., geode.global_epsilon / 2, geode.global_epsilon / 2 ] ) )
99-
builder.set_point( 6, geode.Point3D( [ geode.global_epsilon / 1.1, 2., 1. ] ) )
114+
5, geode.Point3D([2., geode.global_epsilon / 2, geode.global_epsilon / 2]))
115+
builder.set_point(6, geode.Point3D([geode.global_epsilon / 1.1, 2., 1.]))
100116

101-
colocation_inspector = inspector.EdgedCurveColocation3D ( curve )
117+
colocation_inspector = inspector.EdgedCurveColocation3D(curve)
102118
if not colocation_inspector.mesh_has_colocated_points():
103-
raise ValueError( "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several." )
119+
raise ValueError(
120+
"[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several.")
104121
if not colocation_inspector.nb_colocated_points() == 5:
105-
raise ValueError( "[Test] (3D) EdgedCurve has wrong number of colocated points." )
106-
first_colocated_points_group = [ 0, 1, 6 ]
122+
raise ValueError(
123+
"[Test] (3D) EdgedCurve has wrong number of colocated points.")
124+
first_colocated_points_group = [0, 1, 6]
107125
if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group:
108-
raise ValueError( "[Test] (3D) EdgedCurve has wrong first colocated points group." )
109-
second_colocated_points_group = [ 3, 5 ]
126+
raise ValueError(
127+
"[Test] (3D) EdgedCurve has wrong first colocated points group.")
128+
second_colocated_points_group = [3, 5]
110129
if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group:
111-
raise ValueError( "[Test] (3D) EdgedCurve has wrong second colocated points group." )
130+
raise ValueError(
131+
"[Test] (3D) EdgedCurve has wrong second colocated points group.")
132+
112133

113134
if __name__ == '__main__':
135+
inspector.OpenGeodeInspectorInspector.initialize()
114136
check_non_colocation2D()
115137
check_colocation2D()
116138
check_non_colocation3D()
117-
check_colocation3D()
139+
check_colocation3D()

bindings/python/tests/test-py-edgedcurve-degeneration.py

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,97 +19,115 @@
1919
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
# SOFTWARE.
2121

22-
import os, sys, platform
23-
if sys.version_info >= (3,8,0) and platform.system() == "Windows":
22+
import os
23+
import sys
24+
import platform
25+
if sys.version_info >= (3, 8, 0) and platform.system() == "Windows":
2426
for path in [x.strip() for x in os.environ['PATH'].split(';') if x]:
2527
os.add_dll_directory(path)
2628

2729
import opengeode as geode
2830
import opengeode_inspector_py_inspector as inspector
2931

32+
3033
def check_non_degeneration2D():
3134
curve = geode.EdgedCurve2D.create()
32-
builder = geode.EdgedCurveBuilder2D.create( curve )
33-
builder.create_vertices( 3 )
34-
builder.set_point( 0, geode.Point2D( [ 0., 2. ] ) )
35-
builder.set_point( 1, geode.Point2D( [ 2., 0. ] ) )
36-
builder.set_point( 2, geode.Point2D( [ 1., 4. ] ) )
35+
builder = geode.EdgedCurveBuilder2D.create(curve)
36+
builder.create_vertices(3)
37+
builder.set_point(0, geode.Point2D([0., 2.]))
38+
builder.set_point(1, geode.Point2D([2., 0.]))
39+
builder.set_point(2, geode.Point2D([1., 4.]))
3740

38-
builder.create_edge_with_vertices( 0, 1 )
39-
builder.create_edge_with_vertices( 1, 2 )
40-
builder.create_edge_with_vertices( 2, 0 )
41+
builder.create_edge_with_vertices(0, 1)
42+
builder.create_edge_with_vertices(1, 2)
43+
builder.create_edge_with_vertices(2, 0)
4144

42-
degeneration_inspector = inspector.EdgedCurveDegeneration2D( curve )
45+
degeneration_inspector = inspector.EdgedCurveDegeneration2D(curve)
4346
if degeneration_inspector.is_mesh_degenerated():
44-
raise ValueError( "[Test] EdgedCurve is shown degenerated whereas it is not." )
47+
raise ValueError(
48+
"[Test] EdgedCurve is shown degenerated whereas it is not.")
4549
if not degeneration_inspector.nb_degenerated_edges() == 0:
46-
raise ValueError( "[Test] EdgedCurve has more degenerated edges than it should." )
50+
raise ValueError(
51+
"[Test] EdgedCurve has more degenerated edges than it should.")
4752
if degeneration_inspector.degenerated_edges():
48-
raise ValueError( "[Test] EdgedCurve has degenerated edges when it should have none." )
53+
raise ValueError(
54+
"[Test] EdgedCurve has degenerated edges when it should have none.")
55+
4956

5057
def check_degeneration_by_colocalisation2D():
5158
curve = geode.EdgedCurve2D.create()
52-
builder = geode.EdgedCurveBuilder2D.create( curve )
53-
builder.create_vertices( 3 )
54-
builder.set_point( 0, geode.Point2D( [ 0., 2. ] ) )
55-
builder.set_point( 1, geode.Point2D( [ 2., 0. ] ) )
56-
builder.set_point( 2, geode.Point2D( [ 2., geode.global_epsilon / 2 ] ) )
59+
builder = geode.EdgedCurveBuilder2D.create(curve)
60+
builder.create_vertices(3)
61+
builder.set_point(0, geode.Point2D([0., 2.]))
62+
builder.set_point(1, geode.Point2D([2., 0.]))
63+
builder.set_point(2, geode.Point2D([2., geode.global_epsilon / 2]))
5764

58-
builder.create_edge_with_vertices( 0, 1 )
59-
builder.create_edge_with_vertices( 0, 2 )
60-
builder.create_edge_with_vertices( 1, 2 )
65+
builder.create_edge_with_vertices(0, 1)
66+
builder.create_edge_with_vertices(0, 2)
67+
builder.create_edge_with_vertices(1, 2)
6168

62-
degeneration_inspector = inspector.EdgedCurveDegeneration2D( curve )
69+
degeneration_inspector = inspector.EdgedCurveDegeneration2D(curve)
6370
if not degeneration_inspector.is_mesh_degenerated():
64-
raise ValueError( "[Test] EdgedCurve is shown not degenerated whereas it is." )
71+
raise ValueError(
72+
"[Test] EdgedCurve is shown not degenerated whereas it is.")
6573
if not degeneration_inspector.nb_degenerated_edges() == 1:
66-
raise ValueError( "[Test] EdgedCurve has wrong number of degenerated edges." )
74+
raise ValueError(
75+
"[Test] EdgedCurve has wrong number of degenerated edges.")
6776
if not degeneration_inspector.degenerated_edges()[0] == 2:
68-
raise ValueError( "[Test] EdgedCurve has wrong degenerated edges." )
77+
raise ValueError("[Test] EdgedCurve has wrong degenerated edges.")
78+
6979

7080
def check_non_degeneration3D():
7181
curve = geode.EdgedCurve3D.create()
72-
builder = geode.EdgedCurveBuilder3D.create( curve )
73-
builder.create_vertices( 3 )
74-
builder.set_point( 0, geode.Point3D( [ 0., 2., 0. ] ) )
75-
builder.set_point( 1, geode.Point3D( [ 2., 0., 0.5 ] ) )
76-
builder.set_point( 2, geode.Point3D( [ 1., 4., 1. ] ) )
82+
builder = geode.EdgedCurveBuilder3D.create(curve)
83+
builder.create_vertices(3)
84+
builder.set_point(0, geode.Point3D([0., 2., 0.]))
85+
builder.set_point(1, geode.Point3D([2., 0., 0.5]))
86+
builder.set_point(2, geode.Point3D([1., 4., 1.]))
7787

78-
builder.create_edge_with_vertices( 0, 1 )
79-
builder.create_edge_with_vertices( 1, 2 )
80-
builder.create_edge_with_vertices( 2, 0 )
88+
builder.create_edge_with_vertices(0, 1)
89+
builder.create_edge_with_vertices(1, 2)
90+
builder.create_edge_with_vertices(2, 0)
8191

82-
degeneration_inspector = inspector.EdgedCurveDegeneration3D( curve )
92+
degeneration_inspector = inspector.EdgedCurveDegeneration3D(curve)
8393
if degeneration_inspector.is_mesh_degenerated():
84-
raise ValueError( "[Test] (3D) EdgedCurve is shown degenerated whereas it is not." )
94+
raise ValueError(
95+
"[Test] (3D) EdgedCurve is shown degenerated whereas it is not.")
8596
if not degeneration_inspector.nb_degenerated_edges() == 0:
86-
raise ValueError( "[Test] (3D) EdgedCurve has more degenerated edges than it should." )
97+
raise ValueError(
98+
"[Test] (3D) EdgedCurve has more degenerated edges than it should.")
8799
if degeneration_inspector.degenerated_edges():
88-
raise ValueError( "[Test] (3D) EdgedCurve has degenerated edges when it should have none." )
100+
raise ValueError(
101+
"[Test] (3D) EdgedCurve has degenerated edges when it should have none.")
102+
89103

90104
def check_degeneration_by_colocalisation3D():
91105
curve = geode.EdgedCurve3D.create()
92-
builder = geode.EdgedCurveBuilder3D.create( curve )
93-
builder.create_vertices( 3 )
94-
builder.set_point( 0, geode.Point3D( [ 0., 2., 0. ] ) )
95-
builder.set_point( 1, geode.Point3D( [ 2., 0., 0.5 ] ) )
96-
builder.set_point( 2, geode.Point3D( [ 2., geode.global_epsilon / 2,
97-
0.5 + geode.global_epsilon / 2 ] ) )
98-
99-
builder.create_edge_with_vertices( 0, 1 )
100-
builder.create_edge_with_vertices( 0, 2 )
101-
builder.create_edge_with_vertices( 1, 2 )
102-
103-
degeneration_inspector = inspector.EdgedCurveDegeneration3D( curve )
106+
builder = geode.EdgedCurveBuilder3D.create(curve)
107+
builder.create_vertices(3)
108+
builder.set_point(0, geode.Point3D([0., 2., 0.]))
109+
builder.set_point(1, geode.Point3D([2., 0., 0.5]))
110+
builder.set_point(2, geode.Point3D([2., geode.global_epsilon / 2,
111+
0.5 + geode.global_epsilon / 2]))
112+
113+
builder.create_edge_with_vertices(0, 1)
114+
builder.create_edge_with_vertices(0, 2)
115+
builder.create_edge_with_vertices(1, 2)
116+
117+
degeneration_inspector = inspector.EdgedCurveDegeneration3D(curve)
104118
if not degeneration_inspector.is_mesh_degenerated():
105-
raise ValueError( "[Test] (3D) EdgedCurve is shown not degenerated whereas it is." )
119+
raise ValueError(
120+
"[Test] (3D) EdgedCurve is shown not degenerated whereas it is.")
106121
if not degeneration_inspector.nb_degenerated_edges() == 1:
107-
raise ValueError( "[Test] (3D) EdgedCurve has wrong number of degenerated edges." )
122+
raise ValueError(
123+
"[Test] (3D) EdgedCurve has wrong number of degenerated edges.")
108124
if not degeneration_inspector.degenerated_edges()[0] == 2:
109-
raise ValueError( "[Test] (3D) EdgedCurve has wrong degenerated edges." )
125+
raise ValueError("[Test] (3D) EdgedCurve has wrong degenerated edges.")
126+
110127

111128
if __name__ == '__main__':
129+
inspector.OpenGeodeInspectorInspector.initialize()
112130
check_non_degeneration2D()
113131
check_degeneration_by_colocalisation2D()
114132
check_non_degeneration3D()
115-
check_degeneration_by_colocalisation3D()
133+
check_degeneration_by_colocalisation3D()

0 commit comments

Comments
 (0)