diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f3f678f..fec130f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,12 @@ option(OPENGEODE_INSPECTOR_WITH_EXECUTABLES "Compile executable projects" ON) find_package(OpenGeode REQUIRED) find_package(Async++ REQUIRED) +install( + FILES include/geode/inspector/project.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/geode/inspector + COMPONENT public +) + #------------------------------------------------------------------------------------------------ # Configure the OpenGeode-inspector libraries add_subdirectory(src/geode) diff --git a/bindings/python/inspector.py b/bindings/python/inspector.py index 3786c961..7b16be61 100644 --- a/bindings/python/inspector.py +++ b/bindings/python/inspector.py @@ -24,4 +24,4 @@ from opengeode_inspector_py_inspector import * -InspectorInspectorLibrary.initialize() +OpenGeodeInspectorInspectorLibrary.initialize() diff --git a/bindings/python/src/inspector/inspector.cpp b/bindings/python/src/inspector/inspector.cpp index bfafac50..de5c8356 100644 --- a/bindings/python/src/inspector/inspector.cpp +++ b/bindings/python/src/inspector/inspector.cpp @@ -90,9 +90,10 @@ namespace pybind11 PYBIND11_MODULE( opengeode_inspector_py_inspector, module ) { module.doc() = "OpenGeode-Inspector Python binding"; - pybind11::class_< geode::InspectorInspectorLibrary >( - module, "InspectorInspectorLibrary" ) - .def( "initialize", &geode::InspectorInspectorLibrary::initialize ); + pybind11::class_< geode::OpenGeodeInspectorInspectorLibrary >( + module, "OpenGeodeInspectorInspectorLibrary" ) + .def( "initialize", + &geode::OpenGeodeInspectorInspectorLibrary::initialize ); geode::define_information( module ); geode::define_surface_adjacency( module ); geode::define_solid_adjacency( module ); diff --git a/bindings/python/tests/test-py-brep.py b/bindings/python/tests/test-py-brep.py index de31db9d..ad618080 100644 --- a/bindings/python/tests/test-py-brep.py +++ b/bindings/python/tests/test-py-brep.py @@ -62,7 +62,7 @@ def lines_topological_validity(result, verbose): nb_issues += ( result.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner.nb_issues() ) - nb_issues+=result.line_edges_with_wrong_component_edges_around.nb_issues() + nb_issues += result.line_edges_with_wrong_component_edges_around.nb_issues() print("BRep Lines Topology check: ", nb_issues, " issues.") if verbose: print(result.string(), "\n") @@ -80,8 +80,10 @@ def surfaces_topological_validity(result, verbose): nb_issues += ( result.unique_vertices_linked_to_several_and_invalid_surfaces.nb_issues() ) - nb_issues+=result.unique_vertices_linked_to_a_surface_with_invalid_embbedings.nb_issues() - nb_issues +=result.surface_polygons_with_wrong_component_facets_around.nb_issues() + nb_issues += ( + result.unique_vertices_linked_to_a_surface_with_invalid_embbedings.nb_issues() + ) + nb_issues += result.surface_polygons_with_wrong_component_facets_around.nb_issues() print("BRep Surfaces Topology check: ", nb_issues, " issues.") if verbose: print(result.string(), "\n") @@ -228,7 +230,8 @@ def check_a1(verbose): "[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)." ) -def inspect_model_A1(model_brep,verbose): + +def inspect_model_A1(model_brep, verbose): brep_inspector = inspector.BRepInspector(model_brep) result = brep_inspector.inspect_brep() if brep_inspector.brep_topology_is_valid(): @@ -248,13 +251,15 @@ def inspect_model_A1(model_brep,verbose): "[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)." ) + def check_a1_valid(verbose): test_dir = os.path.dirname(__file__) data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data")) model_brep = opengeode.load_brep(data_dir + "/model_A1_valid.og_brep") - inspect_model_A1(model_brep,verbose) + inspect_model_A1(model_brep, verbose) + -def inspect_model_mss(model_brep,verbose): +def inspect_model_mss(model_brep, verbose): brep_inspector = inspector.BRepInspector(model_brep) result = brep_inspector.inspect_brep() if brep_inspector.brep_topology_is_valid(): @@ -264,7 +269,8 @@ def inspect_model_mss(model_brep,verbose): nb_model_issues = launch_topological_validity_checks(result.topology, verbose) if nb_model_issues != 52: raise ValueError( - "[Test] model mss.og_strm should have 37 topological problems, not " + str(nb_model_issues) + "[Test] model mss.og_strm should have 37 topological problems, not " + + str(nb_model_issues) ) nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, verbose @@ -272,13 +278,15 @@ def inspect_model_mss(model_brep,verbose): if nb_component_meshes_issues != 0: raise ValueError("[Test] model mss should have no component meshes issues.") + def check_model_mss(verbose): test_dir = os.path.dirname(__file__) data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data")) model_brep = opengeode.load_brep(data_dir + "/mss.og_brep") - inspect_model_mss(model_brep,verbose) + inspect_model_mss(model_brep, verbose) + -def inspect_model_D(model_brep,verbose): +def inspect_model_D(model_brep, verbose): brep_inspector = inspector.BRepInspector(model_brep) result = brep_inspector.inspect_brep() @@ -296,16 +304,17 @@ def inspect_model_D(model_brep,verbose): ) if nb_component_meshes_issues != 0: raise ValueError("[Test] model_D should have no component meshes issues.") - + def check_model_D(verbose): test_dir = os.path.dirname(__file__) data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data")) model_brep = opengeode.load_brep(data_dir + "/model_D.og_brep") - inspect_model_D(model_brep,verbose) + inspect_model_D(model_brep, verbose) + if __name__ == "__main__": - inspector.InspectorInspectorLibrary.initialize() + inspector.OpenGeodeInspectorInspectorLibrary.initialize() verbose = False check_a1(verbose) check_a1_valid(verbose) diff --git a/bindings/python/tests/test-py-edgedcurve-colocation.py b/bindings/python/tests/test-py-edgedcurve-colocation.py index 38c60a1f..86a2b40a 100644 --- a/bindings/python/tests/test-py-edgedcurve-colocation.py +++ b/bindings/python/tests/test-py-edgedcurve-colocation.py @@ -22,110 +22,133 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode import opengeode_inspector_py_inspector as inspector + def check_non_colocation2D(): curve = geode.EdgedCurve2D.create() builder = geode.EdgedCurveBuilder2D.create(curve) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) - builder.set_point(3, geode.Point2D([3., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) + builder.set_point(3, geode.Point2D([3.0, 3.0])) colocation_inspector = inspector.EdgedCurveColocation2D(curve) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] EdgedCurve has colocated points when it should have none.") + "[Test] EdgedCurve has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: - raise ValueError( - "[Test] EdgedCurve has more colocated points than it should.") + raise ValueError("[Test] EdgedCurve has more colocated points than it should.") + def check_colocation2D(): curve = geode.EdgedCurve2D.create() builder = geode.EdgedCurveBuilder2D.create(curve) builder.create_vertices(7) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([0., 2.])) - builder.set_point(2, geode.Point2D([0., 0.])) - builder.set_point(3, geode.Point2D([2., 0.])) - builder.set_point(4, geode.Point2D([1., 4.])) - builder.set_point(5, geode.Point2D([2., geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([0.0, 2.0])) + builder.set_point(2, geode.Point2D([0.0, 0.0])) + builder.set_point(3, geode.Point2D([2.0, 0.0])) + builder.set_point(4, geode.Point2D([1.0, 4.0])) + builder.set_point(5, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2])) + builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.0])) colocation_inspector = inspector.EdgedCurveColocation2D(curve) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] EdgedCurve doesn't have colocated points whereas it should have several.") + "[Test] EdgedCurve doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: raise ValueError( - "[Test] EdgedCurve has wrong number of colocated points groups.") + "[Test] EdgedCurve has wrong number of colocated points groups." + ) first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] EdgedCurve has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: - raise ValueError( - "[Test] EdgedCurve has wrong second colocated points group.") + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] EdgedCurve has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): + raise ValueError("[Test] EdgedCurve has wrong second colocated points group.") def check_non_colocation3D(): curve = geode.EdgedCurve3D.create() builder = geode.EdgedCurveBuilder3D.create(curve) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) - builder.set_point(3, geode.Point3D([3., 3., 2.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) + builder.set_point(3, geode.Point3D([3.0, 3.0, 2.0])) colocation_inspector = inspector.EdgedCurveColocation3D(curve) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) EdgedCurve has colocated points when it should have none.") + "[Test] (3D) EdgedCurve has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: raise ValueError( - "[Test] (3D) EdgedCurve has more colocated points than it should.") + "[Test] (3D) EdgedCurve has more colocated points than it should." + ) + def check_colocation3D(): curve = geode.EdgedCurve3D.create() builder = geode.EdgedCurveBuilder3D.create(curve) builder.create_vertices(7) - builder.set_point(0, geode.Point3D([0., 2., 1.])) - builder.set_point(1, geode.Point3D([0., 2., 1.])) - builder.set_point(2, geode.Point3D([0., 0., 0.])) - builder.set_point(3, geode.Point3D([2., 0., 0.])) - builder.set_point(4, geode.Point3D([1., 4., 3.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(1, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(2, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(3, geode.Point3D([2.0, 0.0, 0.0])) + builder.set_point(4, geode.Point3D([1.0, 4.0, 3.0])) builder.set_point( - 5, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2., 1.])) + 5, geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2]) + ) + builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2.0, 1.0])) colocation_inspector = inspector.EdgedCurveColocation3D(curve) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several.") + "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: raise ValueError( - "[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points.") + "[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points." + ) first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): raise ValueError( - "[Test] (3D) EdgedCurve has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: + "[Test] (3D) EdgedCurve has wrong first colocated points group." + ) + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): raise ValueError( - "[Test] (3D) EdgedCurve has wrong second colocated points group.") + "[Test] (3D) EdgedCurve has wrong second colocated points group." + ) -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_colocation2D() check_colocation2D() check_non_colocation3D() diff --git a/bindings/python/tests/test-py-edgedcurve-degeneration.py b/bindings/python/tests/test-py-edgedcurve-degeneration.py index 9f5449bd..a97fe1f7 100644 --- a/bindings/python/tests/test-py-edgedcurve-degeneration.py +++ b/bindings/python/tests/test-py-edgedcurve-degeneration.py @@ -22,8 +22,9 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode @@ -34,9 +35,9 @@ def check_non_degeneration2D(): curve = geode.EdgedCurve2D.create() builder = geode.EdgedCurveBuilder2D.create(curve) builder.create_vertices(3) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) builder.create_edge_with_vertices(0, 1) builder.create_edge_with_vertices(1, 2) @@ -44,19 +45,18 @@ def check_non_degeneration2D(): degeneration_inspector = inspector.EdgedCurveDegeneration2D(curve) if degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] EdgedCurve is shown degenerated whereas it is not.") + raise ValueError("[Test] EdgedCurve is shown degenerated whereas it is not.") if not degeneration_inspector.degenerated_edges().nb_issues() == 0: - raise ValueError( - "[Test] EdgedCurve has more degenerated edges than it should.") + raise ValueError("[Test] EdgedCurve has more degenerated edges than it should.") + def check_degeneration_by_colocalisation2D(): curve = geode.EdgedCurve2D.create() builder = geode.EdgedCurveBuilder2D.create(curve) builder.create_vertices(3) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([2., geode.GLOBAL_EPSILON / 2])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2])) builder.create_edge_with_vertices(0, 1) builder.create_edge_with_vertices(0, 2) @@ -64,11 +64,9 @@ def check_degeneration_by_colocalisation2D(): degeneration_inspector = inspector.EdgedCurveDegeneration2D(curve) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] EdgedCurve is shown not degenerated whereas it is.") + raise ValueError("[Test] EdgedCurve is shown not degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: - raise ValueError( - "[Test] EdgedCurve has wrong number of degenerated edges.") + raise ValueError("[Test] EdgedCurve has wrong number of degenerated edges.") if not degeneration_inspector.degenerated_edges().issues()[0] == 2: raise ValueError("[Test] EdgedCurve has wrong degenerated edges.") @@ -77,9 +75,9 @@ def check_non_degeneration3D(): curve = geode.EdgedCurve3D.create() builder = geode.EdgedCurveBuilder3D.create(curve) builder.create_vertices(3) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) builder.create_edge_with_vertices(0, 1) builder.create_edge_with_vertices(1, 2) @@ -88,19 +86,24 @@ def check_non_degeneration3D(): degeneration_inspector = inspector.EdgedCurveDegeneration3D(curve) if degeneration_inspector.is_mesh_degenerated(): raise ValueError( - "[Test] (3D) EdgedCurve is shown degenerated whereas it is not.") + "[Test] (3D) EdgedCurve is shown degenerated whereas it is not." + ) if not degeneration_inspector.degenerated_edges().nb_issues() == 0: raise ValueError( - "[Test] (3D) EdgedCurve has more degenerated edges than it should.") + "[Test] (3D) EdgedCurve has more degenerated edges than it should." + ) + def check_degeneration_by_colocalisation3D(): curve = geode.EdgedCurve3D.create() builder = geode.EdgedCurveBuilder3D.create(curve) builder.create_vertices(3) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, - 0.5 + geode.GLOBAL_EPSILON / 2])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point( + 2, + geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, 0.5 + geode.GLOBAL_EPSILON / 2]), + ) builder.create_edge_with_vertices(0, 1) builder.create_edge_with_vertices(0, 2) @@ -109,16 +112,18 @@ def check_degeneration_by_colocalisation3D(): degeneration_inspector = inspector.EdgedCurveDegeneration3D(curve) if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( - "[Test] (3D) EdgedCurve is shown not degenerated whereas it is.") + "[Test] (3D) EdgedCurve is shown not degenerated whereas it is." + ) if not degeneration_inspector.degenerated_edges().nb_issues() == 1: raise ValueError( - "[Test] (3D) EdgedCurve has wrong number of degenerated edges.") + "[Test] (3D) EdgedCurve has wrong number of degenerated edges." + ) if not degeneration_inspector.degenerated_edges().issues()[0] == 2: raise ValueError("[Test] (3D) EdgedCurve has wrong degenerated edges.") -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_degeneration2D() check_degeneration_by_colocalisation2D() check_non_degeneration3D() diff --git a/bindings/python/tests/test-py-pointset-colocation.py b/bindings/python/tests/test-py-pointset-colocation.py index d40966a7..bed0a6da 100644 --- a/bindings/python/tests/test-py-pointset-colocation.py +++ b/bindings/python/tests/test-py-pointset-colocation.py @@ -23,110 +23,130 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode_inspector_py_inspector as inspector + print(dir(inspector)) + def check_non_colocation2D(): pointset = geode.PointSet2D.create() builder = geode.PointSetBuilder2D.create(pointset) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) - builder.set_point(3, geode.Point2D([3., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) + builder.set_point(3, geode.Point2D([3.0, 3.0])) colocation_inspector = inspector.PointSetColocation2D(pointset) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] PointSet has colocated points when it should have none.") + "[Test] PointSet has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: - raise ValueError( - "[Test] PointSet has more colocated points than it should.") + raise ValueError("[Test] PointSet has more colocated points than it should.") + def check_colocation2D(): pointset = geode.PointSet2D.create() builder = geode.PointSetBuilder2D.create(pointset) builder.create_vertices(7) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([0., 2.])) - builder.set_point(2, geode.Point2D([0., 0.])) - builder.set_point(3, geode.Point2D([2., 0.])) - builder.set_point(4, geode.Point2D([1., 4.])) - builder.set_point(5, geode.Point2D([2., geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([0.0, 2.0])) + builder.set_point(2, geode.Point2D([0.0, 0.0])) + builder.set_point(3, geode.Point2D([2.0, 0.0])) + builder.set_point(4, geode.Point2D([1.0, 4.0])) + builder.set_point(5, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2])) + builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.0])) colocation_inspector = inspector.PointSetColocation2D(pointset) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] PointSet doesn't have colocated points whereas it should have several.") + "[Test] PointSet doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: raise ValueError( - "[Test] PointSet has wrong number of group of colocated points.") + "[Test] PointSet has wrong number of group of colocated points." + ) first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] PointSet has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: - raise ValueError( - "[Test] PointSet has wrong second colocated points group.") + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] PointSet has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): + raise ValueError("[Test] PointSet has wrong second colocated points group.") def check_non_colocation3D(): pointset = geode.PointSet3D.create() builder = geode.PointSetBuilder3D.create(pointset) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) - builder.set_point(3, geode.Point3D([3., 3., 2.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) + builder.set_point(3, geode.Point3D([3.0, 3.0, 2.0])) colocation_inspector = inspector.PointSetColocation3D(pointset) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) PointSet has colocated points when it should have none.") + "[Test] (3D) PointSet has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: raise ValueError( - "[Test] (3D) PointSet has more colocated points than it should.") + "[Test] (3D) PointSet has more colocated points than it should." + ) + def check_colocation3D(): pointset = geode.PointSet3D.create() builder = geode.PointSetBuilder3D.create(pointset) builder.create_vertices(7) - builder.set_point(0, geode.Point3D([0., 2., 1.])) - builder.set_point(1, geode.Point3D([0., 2., 1.])) - builder.set_point(2, geode.Point3D([0., 0., 0.])) - builder.set_point(3, geode.Point3D([2., 0., 0.])) - builder.set_point(4, geode.Point3D([1., 4., 3.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(1, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(2, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(3, geode.Point3D([2.0, 0.0, 0.0])) + builder.set_point(4, geode.Point3D([1.0, 4.0, 3.0])) builder.set_point( - 5, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2., 1.])) + 5, geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2]) + ) + builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2.0, 1.0])) colocation_inspector = inspector.PointSetColocation3D(pointset) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) PointSet doesn't have colocated points whereas it should have several.") + "[Test] (3D) PointSet doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: - raise ValueError( - "[Test] (3D) PointSet has wrong number of colocated points.") + raise ValueError("[Test] (3D) PointSet has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] (3D) PointSet has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] (3D) PointSet has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): raise ValueError( - "[Test] (3D) PointSet has wrong second colocated points group.") + "[Test] (3D) PointSet has wrong second colocated points group." + ) -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_colocation2D() check_colocation2D() check_non_colocation3D() diff --git a/bindings/python/tests/test-py-section.py b/bindings/python/tests/test-py-section.py index 6ab4e1e2..6902a8b0 100644 --- a/bindings/python/tests/test-py-section.py +++ b/bindings/python/tests/test-py-section.py @@ -193,6 +193,6 @@ def check_section(verbose): if __name__ == "__main__": - inspector.InspectorInspectorLibrary.initialize() + inspector.OpenGeodeInspectorInspectorLibrary.initialize() verbose = False check_section(verbose) diff --git a/bindings/python/tests/test-py-solid-adjacency.py b/bindings/python/tests/test-py-solid-adjacency.py index eec18067..3a015ed2 100644 --- a/bindings/python/tests/test-py-solid-adjacency.py +++ b/bindings/python/tests/test-py-solid-adjacency.py @@ -22,8 +22,9 @@ import os import sys import platform + if not sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if not x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if not x]: os.add_dll_directory(path) import opengeode as geode @@ -34,11 +35,11 @@ def check_adjacency(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.set_polyhedron_adjacent(geode.PolyhedronFacet(0, 0), 1) @@ -46,22 +47,21 @@ def check_adjacency(): adjacency_inspector = inspector.SolidMeshInspector3D(solid) if adjacency_inspector.mesh_has_wrong_adjacencies(): - raise ValueError( - "[Test] Solid shows wrong adjacencies where there are none.") + raise ValueError("[Test] Solid shows wrong adjacencies where there are none.") if not adjacency_inspector.non_manifold_facets().nb_issues() == 0: - raise ValueError( - "[Test] Solid has more wrong adjacencies than it should.") + raise ValueError("[Test] Solid has more wrong adjacencies than it should.") + def check_non_adjacency_no_bijection(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(6) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) - builder.set_point(5, geode.Point3D([4., 3., -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) + builder.set_point(5, geode.Point3D([4.0, 3.0, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.create_tetrahedron([1, 5, 2, 3]) @@ -72,12 +72,17 @@ def check_non_adjacency_no_bijection(): adjacency_inspector = geode.SolidMeshInspector3D(solid) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Solid should have a wrong adjacency due to non-bijection.") + "[Test] Solid should have a wrong adjacency due to non-bijection." + ) if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().nb_issues() != 1: raise ValueError( - "[Test] Solid should have one wrong adjacency due to non-bijection.") + "[Test] Solid should have one wrong adjacency due to non-bijection." + ) polyhedron_facet = geode.PolyhedronFacet(2, 1) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] != polyhedron_facet: + if ( + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] + != polyhedron_facet + ): raise ValueError("[Test] Solid facets show wrong adjacency problems.") @@ -85,11 +90,11 @@ def check_non_adjacency_wrong_facet(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.set_polyhedron_adjacent(geode.PolyhedronFacet(0, 0), 1) @@ -97,30 +102,41 @@ def check_non_adjacency_wrong_facet(): adjacency_inspector = geode.SolidMeshInspector3D(*solid) if not adjacency_inspector.mesh_has_wrong_adjacencies(): - raise ValueError("[Test] Solid should have wrong adjacencies due to wrong facet for " - "adjacency.") + raise ValueError( + "[Test] Solid should have wrong adjacencies due to wrong facet for " + "adjacency." + ) if adjacency_inspector.nb_facets_with_wrong_adjacency().nb_issues() != 2: raise ValueError( - "[Test] Solid should have two wrong adjacencies due to wrong facet for adjacency.") + "[Test] Solid should have two wrong adjacencies due to wrong facet for adjacency." + ) polyhedron_facet1 = geode.PolyhedronFacet(0, 0) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] != polyhedron_facet1: + if ( + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] + != polyhedron_facet1 + ): raise ValueError( - "[Test] Solid shows wrong first facet with adjacency problems.") + "[Test] Solid shows wrong first facet with adjacency problems." + ) polyhedron_facet2 = geode.PolyhedronFacet(1, 0) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] != polyhedron_facet2: + if ( + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] + != polyhedron_facet2 + ): raise ValueError( - "[Test] Solid shows wrong second facet with adjacency problems.") + "[Test] Solid shows wrong second facet with adjacency problems." + ) def check_non_adjacency_inversed_tetrahedron(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 3, 2]) builder.set_polyhedron_adjacent(geode.PolyhedronFacet(0, 0), 1) @@ -129,22 +145,32 @@ def check_non_adjacency_inversed_tetrahedron(): adjacency_inspector = geode.SolidMeshInspector3D(*solid) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Solid should have wrong adjacencies due to an inversed triangle.") + "[Test] Solid should have wrong adjacencies due to an inversed triangle." + ) if adjacency_inspector.nb_facets_with_wrong_adjacency().nb_issues() != 2: raise ValueError( - "[Test] Solid should have two wrong adjacencies due to an inversed triangle.") + "[Test] Solid should have two wrong adjacencies due to an inversed triangle." + ) polyhedron_facet1 = geode.PolyhedronFacet(0, 0) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] != polyhedron_facet1: + if ( + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] + != polyhedron_facet1 + ): raise ValueError( - "[Test] Solid shows wrong first facet with adjacency problems due to an inversed triangle..") + "[Test] Solid shows wrong first facet with adjacency problems due to an inversed triangle.." + ) polyhedron_facet2 = geode.PolyhedronFacet(1, 1) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] != polyhedron_facet2: + if ( + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] + != polyhedron_facet2 + ): raise ValueError( - "[Test] Solid shows wrong second facet with adjacency problems due to an inversed triangle..") + "[Test] Solid shows wrong second facet with adjacency problems due to an inversed triangle.." + ) -if not __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if not __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_adjacency() check_non_adjacency_no_bijection() check_non_adjacency_wrong_facet() diff --git a/bindings/python/tests/test-py-solid-colocation.py b/bindings/python/tests/test-py-solid-colocation.py index 60e003ec..3469194c 100644 --- a/bindings/python/tests/test-py-solid-colocation.py +++ b/bindings/python/tests/test-py-solid-colocation.py @@ -22,63 +22,70 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode import opengeode_inspector_py_inspector as inspector + def check_non_colocation(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 0.])) - builder.set_point(1, geode.Point3D([3., 3., -0.5])) - builder.set_point(2, geode.Point3D([-0.5, 4., -1.])) - builder.set_point(3, geode.Point3D([1., 3., 3.])) - builder.set_point(4, geode.Point3D([1., 2., -3.])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 3.0, -0.5])) + builder.set_point(2, geode.Point3D([-0.5, 4.0, -1.0])) + builder.set_point(3, geode.Point3D([1.0, 3.0, 3.0])) + builder.set_point(4, geode.Point3D([1.0, 2.0, -3.0])) colocation_inspector = inspector.SolidMeshColocation3D(solid) if colocation_inspector.mesh_has_colocated_points(): - raise ValueError( - "[Test] Solid has colocated points when it should have none.") + raise ValueError("[Test] Solid has colocated points when it should have none.") if not colocation_inspector.colocated_points_groups().nb_issues() == 0: - raise ValueError( - "[Test] Solid has more colocated points than it should.") + raise ValueError("[Test] Solid has more colocated points than it should.") + def check_colocation(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(7) - builder.set_point(0, geode.Point3D([5., 2., 1.])) - builder.set_point(1, geode.Point3D([5., 2., 1.])) - builder.set_point(2, geode.Point3D([0.5, 0., 0.5])) - builder.set_point(3, geode.Point3D([5., 2., 0.])) - builder.set_point(4, geode.Point3D([1., 4., 3.])) - builder.set_point(5, - geode.Point3D([5., 2. + geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point3D( - [5. + geode.GLOBAL_EPSILON / 1.1, 2., 1.])) + builder.set_point(0, geode.Point3D([5.0, 2.0, 1.0])) + builder.set_point(1, geode.Point3D([5.0, 2.0, 1.0])) + builder.set_point(2, geode.Point3D([0.5, 0.0, 0.5])) + builder.set_point(3, geode.Point3D([5.0, 2.0, 0.0])) + builder.set_point(4, geode.Point3D([1.0, 4.0, 3.0])) + builder.set_point( + 5, + geode.Point3D([5.0, 2.0 + geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2]), + ) + builder.set_point(6, geode.Point3D([5.0 + geode.GLOBAL_EPSILON / 1.1, 2.0, 1.0])) colocation_inspector = inspector.SolidMeshColocation3D(solid) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] Solid doesn't have colocated points whereas it should have several.") + "[Test] Solid doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: raise ValueError("[Test] Solid has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] Solid has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: - raise ValueError( - "[Test] Solid has wrong second colocated points group.") + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] Solid has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): + raise ValueError("[Test] Solid has wrong second colocated points group.") -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_colocation() check_colocation() diff --git a/bindings/python/tests/test-py-solid-degeneration.py b/bindings/python/tests/test-py-solid-degeneration.py index b6d13f58..be9ded00 100644 --- a/bindings/python/tests/test-py-solid-degeneration.py +++ b/bindings/python/tests/test-py-solid-degeneration.py @@ -22,8 +22,9 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode @@ -34,33 +35,32 @@ def check_non_degeneration(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 0.])) - builder.set_point(1, geode.Point3D([3., 3., -0.5])) - builder.set_point(2, geode.Point3D([-0.5, 4., -1.])) - builder.set_point(3, geode.Point3D([1., 3., 3.])) - builder.set_point(4, geode.Point3D([1., 2., -3.])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 3.0, -0.5])) + builder.set_point(2, geode.Point3D([-0.5, 4.0, -1.0])) + builder.set_point(3, geode.Point3D([1.0, 3.0, 3.0])) + builder.set_point(4, geode.Point3D([1.0, 2.0, -3.0])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([0, 1, 4, 2]) degeneration_inspector = inspector.SolidMeshDegeneration3D(solid) if degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Solid is shown degenerated whereas it is not.") + raise ValueError("[Test] Solid is shown degenerated whereas it is not.") if not degeneration_inspector.degenerated_edges().nb_issues() == 0: - raise ValueError( - "[Test] Solid has more degenerated edges than it should.") + raise ValueError("[Test] Solid has more degenerated edges than it should.") del degeneration_inspector + def check_degeneration_by_colocalisation(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 0.])) - builder.set_point(1, geode.Point3D([3., 3., 0.])) - builder.set_point(2, geode.Point3D([-0.5, 4., -1.])) - builder.set_point(3, geode.Point3D([1., 3., 3.])) - builder.set_point(4, geode.Point3D([3., 3., -geode.GLOBAL_EPSILON / 2])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 3.0, 0.0])) + builder.set_point(2, geode.Point3D([-0.5, 4.0, -1.0])) + builder.set_point(3, geode.Point3D([1.0, 3.0, 3.0])) + builder.set_point(4, geode.Point3D([3.0, 3.0, -geode.GLOBAL_EPSILON / 2])) builder.create_tetrahedron([0, 1, 3, 2]) builder.create_tetrahedron([0, 1, 4, 2]) @@ -68,11 +68,12 @@ def check_degeneration_by_colocalisation(): degeneration_inspector = inspector.SolidMeshDegeneration3D(solid) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Solid is shown not degenerated whereas it is.") + raise ValueError("[Test] Solid is shown not degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: raise ValueError("[Test] Solid has wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges().issues()[0] == solid.edges().edge_from_vertices([1, 4]): + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == solid.edges().edge_from_vertices([1, 4]): raise ValueError("[Test] Solid has wrong degenerated edges.") del degeneration_inspector @@ -81,10 +82,10 @@ def check_degeneration_by_point_multiple_presence(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 0.])) - builder.set_point(1, geode.Point3D([3., 3., -0.5])) - builder.set_point(2, geode.Point3D([-0.5, 4., -1.])) - builder.set_point(3, geode.Point3D([1., 3., 3.])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 3.0, -0.5])) + builder.set_point(2, geode.Point3D([-0.5, 4.0, -1.0])) + builder.set_point(3, geode.Point3D([1.0, 3.0, 3.0])) builder.create_tetrahedron([0, 1, 3, 2]) builder.create_tetrahedron([0, 1, 1, 2]) @@ -92,18 +93,18 @@ def check_degeneration_by_point_multiple_presence(): degeneration_inspector = inspector.SolidMeshDegeneration3D(solid) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Solid is not shown degenerated whereas it is.") + raise ValueError("[Test] Solid is not shown degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: - raise ValueError( - "[Test] Solid has the wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges().issues()[0] == solid.edges().edge_from_vertices([1, 1]): + raise ValueError("[Test] Solid has the wrong number of degenerated edges.") + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == solid.edges().edge_from_vertices([1, 1]): raise ValueError("[Test] Solid shows the wrong degenerated edges.") del degeneration_inspector -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_degeneration() check_degeneration_by_colocalisation() check_degeneration_by_point_multiple_presence() diff --git a/bindings/python/tests/test-py-solid-manifold.py b/bindings/python/tests/test-py-solid-manifold.py index fe1c35e4..d22d2401 100644 --- a/bindings/python/tests/test-py-solid-manifold.py +++ b/bindings/python/tests/test-py-solid-manifold.py @@ -22,8 +22,9 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split('') if x]: + for path in [x.strip() for x in os.environ["PATH"].split("") if x]: os.add_dll_directory(path) import opengeode as geode @@ -34,11 +35,11 @@ def check_vertex_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.set_polyhedron_adjacent(geode.PolyhedronFacet(0, 0), 1) @@ -48,20 +49,20 @@ def check_vertex_manifold(): if not manifold_inspector.mesh_vertices_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") if manifold_inspector.non_manifold_vertices().nb_issues() != 0: - raise ValueError( - "[Test] Solid has more non manifold vertices than it should.") + raise ValueError("[Test] Solid has more non manifold vertices than it should.") + def check_vertex_non_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(*solid) builder.create_vertices(7) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) - builder.set_point(5, geode.Point3D([3., .5, 0.])) - builder.set_point(6, geode.Point3D([.5, 3., .5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) + builder.set_point(5, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(6, geode.Point3D([0.5, 3.0, 0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([5, 4, 6, 3]) @@ -69,8 +70,7 @@ def check_vertex_non_manifold(): if manifold_inspector.mesh_vertices_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") if manifold_inspector.non_manifold_vertices().nb_issues() != 1: - raise ValueError( - "[Test] Solid has wrong number of non manifold vertices.") + raise ValueError("[Test] Solid has wrong number of non manifold vertices.") if manifold_inspector.non_manifold_vertices().issues()[0] != 3: raise ValueError("[Test] Solid shows wrong non manifold vertex id.") @@ -79,11 +79,11 @@ def check_edge_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(*solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.set_polyhedron_adjacent(geode.PolyhedronFacet(0, 0), 1) @@ -93,19 +93,19 @@ def check_edge_manifold(): if not manifold_inspector.mesh_edges_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") if manifold_inspector.non_manifold_edges().nb_issues() != 0: - raise ValueError( - "[Test] Solid has more non manifold edges than it should.") - + raise ValueError("[Test] Solid has more non manifold edges than it should.") + + def check_edge_non_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(solid) builder.create_vertices(6) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) - builder.set_point(5, geode.Point3D([3., .5, 0.])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) + builder.set_point(5, geode.Point3D([3.0, 0.5, 0.0])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([5, 4, 2, 3]) @@ -113,8 +113,7 @@ def check_edge_non_manifold(): if manifold_inspector.mesh_edges_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") if manifold_inspector.non_manifold_edges().nb_issues() != 1: - raise ValueError( - "[Test] Solid has wrong number of non manifold edges.") + raise ValueError("[Test] Solid has wrong number of non manifold edges.") non_manifold_e = manifold_inspector.non_manifold_edges().issues() if non_manifold_e[0][0] != 2 or non_manifold_e[0][1] != 3: raise ValueError("[Test] Solid shows wrong non manifold edge id.") @@ -124,11 +123,11 @@ def check_facet_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(*solid) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) @@ -136,19 +135,19 @@ def check_facet_manifold(): if manifold_inspector.mesh_facets_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") if manifold_inspector.non_manifold_facets().nb_issues() != 0: - raise ValueError( - "[Test] Solid has more non manifold facets than it should.") + raise ValueError("[Test] Solid has more non manifold facets than it should.") + def check_facet_non_manifold(): solid = geode.TetrahedralSolid3D.create() builder = geode.TetrahedralSolidBuilder3D.create(*solid) builder.create_vertices(6) - builder.set_point(0, geode.Point3D([0., 0., 2.])) - builder.set_point(1, geode.Point3D([3., .5, 0.])) - builder.set_point(2, geode.Point3D([.5, 3., .5])) - builder.set_point(3, geode.Point3D([2., 1.5, 3.])) - builder.set_point(4, geode.Point3D([3.5, 2.5, -.5])) - builder.set_point(5, geode.Point3D([4., 3., -.5])) + builder.set_point(0, geode.Point3D([0.0, 0.0, 2.0])) + builder.set_point(1, geode.Point3D([3.0, 0.5, 0.0])) + builder.set_point(2, geode.Point3D([0.5, 3.0, 0.5])) + builder.set_point(3, geode.Point3D([2.0, 1.5, 3.0])) + builder.set_point(4, geode.Point3D([3.5, 2.5, -0.5])) + builder.set_point(5, geode.Point3D([4.0, 3.0, -0.5])) builder.create_tetrahedron([0, 1, 2, 3]) builder.create_tetrahedron([1, 4, 2, 3]) builder.create_tetrahedron([1, 5, 2, 3]) @@ -157,15 +156,18 @@ def check_facet_non_manifold(): if manifold_inspector.mesh_facets_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") if manifold_inspector.non_manifold_facets().nb_issues() != 1: - raise ValueError( - "[Test] Solid has wrong number of non manifold facets.") + raise ValueError("[Test] Solid has wrong number of non manifold facets.") non_manifold_f = manifold_inspector.non_manifold_facets().issues() - if non_manifold_f[0][0] != 1 or non_manifold_f[0][1] != 2 or non_manifold_f[0][2] != 3: + if ( + non_manifold_f[0][0] != 1 + or non_manifold_f[0][1] != 2 + or non_manifold_f[0][2] != 3 + ): raise ValueError("[Test] Solid shows wrong non manifold facet id.") -if not __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if not __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_vertex_manifold() check_vertex_non_manifold() check_edge_manifold() diff --git a/bindings/python/tests/test-py-surface-adjacency.py b/bindings/python/tests/test-py-surface-adjacency.py index 323a4747..ae97edb6 100644 --- a/bindings/python/tests/test-py-surface-adjacency.py +++ b/bindings/python/tests/test-py-surface-adjacency.py @@ -22,21 +22,23 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode import opengeode_inspector_py_inspector as inspector + def check_adjacency2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 1.])) - builder.set_point(1, geode.Point2D([3., 0.])) - builder.set_point(2, geode.Point2D([2., 4.])) - builder.set_point(3, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 1.0])) + builder.set_point(1, geode.Point2D([3.0, 0.0])) + builder.set_point(2, geode.Point2D([2.0, 4.0])) + builder.set_point(3, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -45,20 +47,23 @@ def check_adjacency2D(): adjacency_inspector = inspector.SurfaceMeshAdjacency2D(surface) if adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Surface has wrong adjacencies when it should have none.") + "[Test] Surface has wrong adjacencies when it should have none." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 0: raise ValueError( - "[Test] Surface has more wrong adjacencies on edges than it should.") + "[Test] Surface has more wrong adjacencies on edges than it should." + ) + def check_non_adjacency_no_bijection2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(5) - builder.set_point(0, geode.Point2D([0., 1.])) - builder.set_point(1, geode.Point2D([3., 0.])) - builder.set_point(2, geode.Point2D([2., 4.])) - builder.set_point(3, geode.Point2D([5., 3.])) - builder.set_point(4, geode.Point2D([1., 4.])) + builder.set_point(0, geode.Point2D([0.0, 1.0])) + builder.set_point(1, geode.Point2D([3.0, 0.0])) + builder.set_point(2, geode.Point2D([2.0, 4.0])) + builder.set_point(3, geode.Point2D([5.0, 3.0])) + builder.set_point(4, geode.Point2D([1.0, 4.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.create_triangle([4, 1, 2]) @@ -69,22 +74,28 @@ def check_non_adjacency_no_bijection2D(): adjacency_inspector = inspector.SurfaceMeshAdjacency2D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Surface should have a wrong adjacency due to non-bijection.") + "[Test] Surface should have a wrong adjacency due to non-bijection." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 1: raise ValueError( - "[Test] Surface should have one wrong adjacency due to non-bijection.") + "[Test] Surface should have one wrong adjacency due to non-bijection." + ) polygon_edge = geode.PolygonEdge(2, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge + ): raise ValueError("[Test] Surface edges show wrong adjacency problems.") + def check_non_adjacency_wrong_edge2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 1.])) - builder.set_point(1, geode.Point2D([3., 0.])) - builder.set_point(2, geode.Point2D([2., 4.])) - builder.set_point(3, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 1.0])) + builder.set_point(1, geode.Point2D([3.0, 0.0])) + builder.set_point(2, geode.Point2D([2.0, 4.0])) + builder.set_point(3, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -93,27 +104,38 @@ def check_non_adjacency_wrong_edge2D(): adjacency_inspector = inspector.SurfaceMeshAdjacency2D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Surface should have wrong adjacencies due to wrong edge for adjacency.") + "[Test] Surface should have wrong adjacencies due to wrong edge for adjacency." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2: raise ValueError( - "[Test] Surface should have two wrong adjacencies due to wrong edge for adjacency.") + "[Test] Surface should have two wrong adjacencies due to wrong edge for adjacency." + ) polygon_edge1 = geode.PolygonEdge(0, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge1 + ): raise ValueError( - "[Test] Surface shows wrong first edge with adjacency problems.") + "[Test] Surface shows wrong first edge with adjacency problems." + ) polygon_edge2 = geode.PolygonEdge(1, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] + == polygon_edge2 + ): raise ValueError( - "[Test] Surface shows wrong second edge with adjacency problems.") + "[Test] Surface shows wrong second edge with adjacency problems." + ) + def check_non_adjacency_inversed_triangle2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 1.])) - builder.set_point(1, geode.Point2D([3., 0.])) - builder.set_point(2, geode.Point2D([2., 4.])) - builder.set_point(3, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 1.0])) + builder.set_point(1, geode.Point2D([3.0, 0.0])) + builder.set_point(2, geode.Point2D([2.0, 4.0])) + builder.set_point(3, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 2, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -122,27 +144,38 @@ def check_non_adjacency_inversed_triangle2D(): adjacency_inspector = inspector.SurfaceMeshAdjacency2D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] Surface should have wrong adjacencies due to an inversed triangle.") + "[Test] Surface should have wrong adjacencies due to an inversed triangle." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2: raise ValueError( - "[Test] Surface should have two wrong adjacencies due to an inversed triangle.") + "[Test] Surface should have two wrong adjacencies due to an inversed triangle." + ) polygon_edge1 = geode.PolygonEdge(0, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge1 + ): raise ValueError( - "[Test] Surface shows wrong first edge with adjacency problems due to an inversed triangle..") + "[Test] Surface shows wrong first edge with adjacency problems due to an inversed triangle.." + ) polygon_edge2 = geode.PolygonEdge(1, 0) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] + == polygon_edge2 + ): raise ValueError( - "[Test] Surface shows wrong second edge with adjacency problems due to an inversed triangle..") + "[Test] Surface shows wrong second edge with adjacency problems due to an inversed triangle.." + ) + def check_adjacency3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 1., 0.])) - builder.set_point(1, geode.Point3D([3., 0., 1.])) - builder.set_point(2, geode.Point3D([2., 4., 2.])) - builder.set_point(3, geode.Point3D([5., 3., 0.])) + builder.set_point(0, geode.Point3D([0.0, 1.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 0.0, 1.0])) + builder.set_point(2, geode.Point3D([2.0, 4.0, 2.0])) + builder.set_point(3, geode.Point3D([5.0, 3.0, 0.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -151,20 +184,23 @@ def check_adjacency3D(): adjacency_inspector = inspector.SurfaceMeshAdjacency3D(surface) if adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] 3D Surface has wrong adjacencies when it should have none.") + "[Test] 3D Surface has wrong adjacencies when it should have none." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 0: raise ValueError( - "[Test] 3D Surface has more wrong adjacencies on edges than it should.") + "[Test] 3D Surface has more wrong adjacencies on edges than it should." + ) + def check_non_adjacency_no_bijection3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(5) - builder.set_point(0, geode.Point3D([0., 1., 0.])) - builder.set_point(1, geode.Point3D([3., 0., 1.])) - builder.set_point(2, geode.Point3D([2., 4., 2.])) - builder.set_point(3, geode.Point3D([5., 3., 0.])) - builder.set_point(4, geode.Point3D([1., 4., 4.])) + builder.set_point(0, geode.Point3D([0.0, 1.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 0.0, 1.0])) + builder.set_point(2, geode.Point3D([2.0, 4.0, 2.0])) + builder.set_point(3, geode.Point3D([5.0, 3.0, 0.0])) + builder.set_point(4, geode.Point3D([1.0, 4.0, 4.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.create_triangle([4, 1, 2]) @@ -175,23 +211,28 @@ def check_non_adjacency_no_bijection3D(): adjacency_inspector = inspector.SurfaceMeshAdjacency3D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] 3D Surface should have a wrong adjacency due to non-bijection.") + "[Test] 3D Surface should have a wrong adjacency due to non-bijection." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 1: raise ValueError( - "[Test] 3D Surface should have one wrong adjacency due to non-bijection.") + "[Test] 3D Surface should have one wrong adjacency due to non-bijection." + ) polygon_edge = geode.PolygonEdge(2, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge: - raise ValueError( - "[Test] 3D Surface edges show wrong adjacency problems.") + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge + ): + raise ValueError("[Test] 3D Surface edges show wrong adjacency problems.") + def check_non_adjacency_wrong_edge3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 1., 0.])) - builder.set_point(1, geode.Point3D([3., 0., 1.])) - builder.set_point(2, geode.Point3D([2., 4., 2.])) - builder.set_point(3, geode.Point3D([5., 3., 0.])) + builder.set_point(0, geode.Point3D([0.0, 1.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 0.0, 1.0])) + builder.set_point(2, geode.Point3D([2.0, 4.0, 2.0])) + builder.set_point(3, geode.Point3D([5.0, 3.0, 0.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -200,27 +241,38 @@ def check_non_adjacency_wrong_edge3D(): adjacency_inspector = inspector.SurfaceMeshAdjacency3D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] 3D Surface should have wrong adjacencies due to wrong edge for adjacency.") + "[Test] 3D Surface should have wrong adjacencies due to wrong edge for adjacency." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2: raise ValueError( - "[Test] 3D Surface should have two wrong adjacencies due to wrong edge for adjacency.") + "[Test] 3D Surface should have two wrong adjacencies due to wrong edge for adjacency." + ) polygon_edge1 = geode.PolygonEdge(0, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge1 + ): raise ValueError( - "[Test] 3D Surface shows wrong first edge with adjacency problems.") + "[Test] 3D Surface shows wrong first edge with adjacency problems." + ) polygon_edge2 = geode.PolygonEdge(1, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] + == polygon_edge2 + ): raise ValueError( - "[Test] Surface shows wrong second edge with adjacency problems.") + "[Test] Surface shows wrong second edge with adjacency problems." + ) + def check_non_adjacency_inversed_triangle3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 1., 0.])) - builder.set_point(1, geode.Point3D([3., 0., 1.])) - builder.set_point(2, geode.Point3D([2., 4., 2.])) - builder.set_point(3, geode.Point3D([5., 3., 0.])) + builder.set_point(0, geode.Point3D([0.0, 1.0, 0.0])) + builder.set_point(1, geode.Point3D([3.0, 0.0, 1.0])) + builder.set_point(2, geode.Point3D([2.0, 4.0, 2.0])) + builder.set_point(3, geode.Point3D([5.0, 3.0, 0.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 2, 3]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -229,21 +281,32 @@ def check_non_adjacency_inversed_triangle3D(): adjacency_inspector = inspector.SurfaceMeshAdjacency3D(surface) if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( - "[Test] 3D Surface should have wrong adjacencies due to an inversed triangle.") + "[Test] 3D Surface should have wrong adjacencies due to an inversed triangle." + ) if not adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2: raise ValueError( - "[Test] 3D Surface should have two wrong adjacencies due to an inversed triangle.") + "[Test] 3D Surface should have two wrong adjacencies due to an inversed triangle." + ) polygon_edge1 = geode.PolygonEdge(0, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] + == polygon_edge1 + ): raise ValueError( - "[Test] 3D Surface shows wrong first edge with adjacency problems due to an inversed triangle..") + "[Test] 3D Surface shows wrong first edge with adjacency problems due to an inversed triangle.." + ) polygon_edge2 = geode.PolygonEdge(1, 0) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2: + if ( + not adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] + == polygon_edge2 + ): raise ValueError( - "[Test] 3D Surface shows wrong second edge with adjacency problems due to an inversed triangle..") + "[Test] 3D Surface shows wrong second edge with adjacency problems due to an inversed triangle.." + ) + -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_adjacency2D() check_non_adjacency_no_bijection2D() check_non_adjacency_wrong_edge2D() diff --git a/bindings/python/tests/test-py-surface-colocation.py b/bindings/python/tests/test-py-surface-colocation.py index 7cb7b889..bdb73549 100644 --- a/bindings/python/tests/test-py-surface-colocation.py +++ b/bindings/python/tests/test-py-surface-colocation.py @@ -22,110 +22,125 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode import opengeode_inspector_py_inspector as inspector + def check_non_colocation2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) - builder.set_point(3, geode.Point2D([3., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) + builder.set_point(3, geode.Point2D([3.0, 3.0])) colocation_inspector = inspector.SurfaceMeshColocation2D(surface) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] Surface has colocated points when it should have none.") + "[Test] Surface has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: - raise ValueError( - "[Test] Surface has more colocated points than it should.") + raise ValueError("[Test] Surface has more colocated points than it should.") + def check_colocation2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(7) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([0., 2.])) - builder.set_point(2, geode.Point2D([0., 0.])) - builder.set_point(3, geode.Point2D([2., 0.])) - builder.set_point(4, geode.Point2D([1., 4.])) - builder.set_point(5, geode.Point2D([2., geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([0.0, 2.0])) + builder.set_point(2, geode.Point2D([0.0, 0.0])) + builder.set_point(3, geode.Point2D([2.0, 0.0])) + builder.set_point(4, geode.Point2D([1.0, 4.0])) + builder.set_point(5, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2])) + builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.0])) colocation_inspector = inspector.SurfaceMeshColocation2D(surface) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] Surface doesn't have colocated points whereas it should have several.") + "[Test] Surface doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: - raise ValueError( - "[Test] Surface has wrong number of colocated points.") + raise ValueError("[Test] Surface has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] Surface has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: - raise ValueError( - "[Test] Surface has wrong second colocated points group.") + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] Surface has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): + raise ValueError("[Test] Surface has wrong second colocated points group.") def check_non_colocation3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) - builder.set_point(3, geode.Point3D([3., 3., 2.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) + builder.set_point(3, geode.Point3D([3.0, 3.0, 2.0])) colocation_inspector = inspector.SurfaceMeshColocation3D(surface) if colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) Surface has colocated points when it should have none.") + "[Test] (3D) Surface has colocated points when it should have none." + ) if not colocation_inspector.colocated_points_groups().nb_issues() == 0: raise ValueError( - "[Test] (3D) Surface has more colocated points than it should.") + "[Test] (3D) Surface has more colocated points than it should." + ) + def check_colocation3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(7) - builder.set_point(0, geode.Point3D([0., 2., 1.])) - builder.set_point(1, geode.Point3D([0., 2., 1.])) - builder.set_point(2, geode.Point3D([0., 0., 0.])) - builder.set_point(3, geode.Point3D([2., 0., 0.])) - builder.set_point(4, geode.Point3D([1., 4., 3.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(1, geode.Point3D([0.0, 2.0, 1.0])) + builder.set_point(2, geode.Point3D([0.0, 0.0, 0.0])) + builder.set_point(3, geode.Point3D([2.0, 0.0, 0.0])) + builder.set_point(4, geode.Point3D([1.0, 4.0, 3.0])) builder.set_point( - 5, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2])) - builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2., 1.])) + 5, geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2]) + ) + builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2.0, 1.0])) colocation_inspector = inspector.SurfaceMeshColocation3D(surface) if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( - "[Test] (3D) Surface doesn't have colocated points whereas it should have several.") + "[Test] (3D) Surface doesn't have colocated points whereas it should have several." + ) issues = colocation_inspector.colocated_points_groups() if not issues.nb_issues() == 2: - raise ValueError( - "[Test] (3D) Surface has wrong number of colocated points.") + raise ValueError("[Test] (3D) Surface has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] second_colocated_points_group = [3, 5] - if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group: - raise ValueError( - "[Test] (3D) Surface has wrong first colocated points group.") - if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group: - raise ValueError( - "[Test] (3D) Surface has wrong second colocated points group.") + if ( + not issues.issues()[0] == first_colocated_points_group + and not issues.issues()[0] == second_colocated_points_group + ): + raise ValueError("[Test] (3D) Surface has wrong first colocated points group.") + if ( + not issues.issues()[1] == first_colocated_points_group + and not issues.issues()[1] == second_colocated_points_group + ): + raise ValueError("[Test] (3D) Surface has wrong second colocated points group.") -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_colocation2D() check_colocation2D() check_non_colocation3D() diff --git a/bindings/python/tests/test-py-surface-curve-intersections.py b/bindings/python/tests/test-py-surface-curve-intersections.py index 0f3d90d0..0c4a9a6f 100644 --- a/bindings/python/tests/test-py-surface-curve-intersections.py +++ b/bindings/python/tests/test-py-surface-curve-intersections.py @@ -22,100 +22,108 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode import opengeode_inspector_py_inspector as inspector + def check_intersections2D(): surface = geode.TriangulatedSurface2D.create() - builder = geode.TriangulatedSurfaceBuilder2D.create( surface ) - builder.create_vertices( 5 ) - builder.set_point( 0, geode.Point2D( [ 0., 0. ] ) ) - builder.set_point( 1, geode.Point2D( [ 3., -1. ] ) ) - builder.set_point( 2, geode.Point2D( [ 3., 3. ] ) ) - builder.set_point( 3, geode.Point2D( [ 0., -3. ] ) ) - builder.set_point( 4, geode.Point2D( [ 3., -3. ] ) ) - builder.create_triangle( [ 0, 1, 2 ] ) - builder.create_triangle( [ 0, 1, 3 ] ) - builder.create_triangle( [ 1, 3, 4 ] ) - builder.set_polygon_adjacent( geode.PolygonEdge( 0, 0 ), 1 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 1, 0 ), 0 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 1, 1 ), 2 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 2, 0 ), 1 ) + builder = geode.TriangulatedSurfaceBuilder2D.create(surface) + builder.create_vertices(5) + builder.set_point(0, geode.Point2D([0.0, 0.0])) + builder.set_point(1, geode.Point2D([3.0, -1.0])) + builder.set_point(2, geode.Point2D([3.0, 3.0])) + builder.set_point(3, geode.Point2D([0.0, -3.0])) + builder.set_point(4, geode.Point2D([3.0, -3.0])) + builder.create_triangle([0, 1, 2]) + builder.create_triangle([0, 1, 3]) + builder.create_triangle([1, 3, 4]) + builder.set_polygon_adjacent(geode.PolygonEdge(0, 0), 1) + builder.set_polygon_adjacent(geode.PolygonEdge(1, 0), 0) + builder.set_polygon_adjacent(geode.PolygonEdge(1, 1), 2) + builder.set_polygon_adjacent(geode.PolygonEdge(2, 0), 1) curve = geode.EdgedCurve2D.create() - builder_curve = geode.EdgedCurveBuilder2D.create( curve ) - builder_curve.create_vertices( 8 ) - builder_curve.set_point( 0, geode.Point2D( [ 5., 0. ] ) ) - builder_curve.set_point( 1, geode.Point2D( [ 3., 0. ] ) ) - builder_curve.set_point( 2, geode.Point2D( [ 2., 0. ] ) ) - builder_curve.set_point( 3, geode.Point2D( [ 1., 0. ] ) ) - builder_curve.set_point( 4, geode.Point2D( [ -1., 0. ] ) ) - builder_curve.set_point( 5, geode.Point2D( [ 0., -3. ] ) ) - builder_curve.set_point( 6, geode.Point2D( [ 3., -3. ] ) ) - builder_curve.set_point( 7, geode.Point2D( [ 1.5, -2. ] ) ) - builder_curve.create_edge_with_vertices( 0, 1 ) - builder_curve.create_edge_with_vertices( 1, 2 ) - builder_curve.create_edge_with_vertices( 2, 3 ) - builder_curve.create_edge_with_vertices( 3, 4 ) - builder_curve.create_edge_with_vertices( 4, 5 ) - builder_curve.create_edge_with_vertices( 5, 6 ) - builder_curve.create_edge_with_vertices( 6, 7 ) + builder_curve = geode.EdgedCurveBuilder2D.create(curve) + builder_curve.create_vertices(8) + builder_curve.set_point(0, geode.Point2D([5.0, 0.0])) + builder_curve.set_point(1, geode.Point2D([3.0, 0.0])) + builder_curve.set_point(2, geode.Point2D([2.0, 0.0])) + builder_curve.set_point(3, geode.Point2D([1.0, 0.0])) + builder_curve.set_point(4, geode.Point2D([-1.0, 0.0])) + builder_curve.set_point(5, geode.Point2D([0.0, -3.0])) + builder_curve.set_point(6, geode.Point2D([3.0, -3.0])) + builder_curve.set_point(7, geode.Point2D([1.5, -2.0])) + builder_curve.create_edge_with_vertices(0, 1) + builder_curve.create_edge_with_vertices(1, 2) + builder_curve.create_edge_with_vertices(2, 3) + builder_curve.create_edge_with_vertices(3, 4) + builder_curve.create_edge_with_vertices(4, 5) + builder_curve.create_edge_with_vertices(5, 6) + builder_curve.create_edge_with_vertices(6, 7) - intersections_inspector = inspector.SurfaceCurveIntersections2D( surface, curve ) + intersections_inspector = inspector.SurfaceCurveIntersections2D(surface, curve) if not intersections_inspector.meshes_have_intersections(): - raise ValueError( "[Test] 2D Surface and Curve should have intersections." ) + raise ValueError("[Test] 2D Surface and Curve should have intersections.") if not intersections_inspector.intersecting_elements().nb_issues() == 7: - raise ValueError( "[Test] 2D Surface and Curve should have 7 intersecting elements pair." ) + raise ValueError( + "[Test] 2D Surface and Curve should have 7 intersecting elements pair." + ) + def check_intersections3D(): surface = geode.TriangulatedSurface3D.create() - builder = geode.TriangulatedSurfaceBuilder3D.create( surface ) - builder.create_vertices( 5 ) - builder.set_point( 0, geode.Point3D( [ 0., 0., 0 ] ) ) - builder.set_point( 1, geode.Point3D( [ 3., -1., 0 ] ) ) - builder.set_point( 2, geode.Point3D( [ 3., 3., 0 ] ) ) - builder.set_point( 3, geode.Point3D( [ 0., -3., 0 ] ) ) - builder.set_point( 4, geode.Point3D( [ 3., -3., 0 ] ) ) - builder.create_triangle( [ 0, 1, 2 ] ) - builder.create_triangle( [ 0, 1, 3 ] ) - builder.create_triangle( [ 1, 3, 4 ] ) - builder.set_polygon_adjacent( geode.PolygonEdge( 0, 0 ), 1 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 1, 0 ), 0 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 1, 1 ), 2 ) - builder.set_polygon_adjacent( geode.PolygonEdge( 2, 0 ), 1 ) + builder = geode.TriangulatedSurfaceBuilder3D.create(surface) + builder.create_vertices(5) + builder.set_point(0, geode.Point3D([0.0, 0.0, 0])) + builder.set_point(1, geode.Point3D([3.0, -1.0, 0])) + builder.set_point(2, geode.Point3D([3.0, 3.0, 0])) + builder.set_point(3, geode.Point3D([0.0, -3.0, 0])) + builder.set_point(4, geode.Point3D([3.0, -3.0, 0])) + builder.create_triangle([0, 1, 2]) + builder.create_triangle([0, 1, 3]) + builder.create_triangle([1, 3, 4]) + builder.set_polygon_adjacent(geode.PolygonEdge(0, 0), 1) + builder.set_polygon_adjacent(geode.PolygonEdge(1, 0), 0) + builder.set_polygon_adjacent(geode.PolygonEdge(1, 1), 2) + builder.set_polygon_adjacent(geode.PolygonEdge(2, 0), 1) curve = geode.EdgedCurve3D.create() - builder_curve = geode.EdgedCurveBuilder3D.create( curve ) - builder_curve.create_vertices( 9 ) - builder_curve.set_point( 0, geode.Point3D( [ 5., 0., 1 ] ) ) - builder_curve.set_point( 1, geode.Point3D( [ 3., 0., 0 ] ) ) - builder_curve.set_point( 2, geode.Point3D( [ 2., 0., 0 ] ) ) - builder_curve.set_point( 3, geode.Point3D( [ 1., 0., 0 ] ) ) - builder_curve.set_point( 4, geode.Point3D( [ -1., 0., 0 ] ) ) - builder_curve.set_point( 5, geode.Point3D( [ 0., -3., 0 ] ) ) - builder_curve.set_point( 6, geode.Point3D( [ 3., -3., 0 ] ) ) - builder_curve.set_point( 7, geode.Point3D( [ 1.5, -2., 2 ] ) ) - builder_curve.set_point( 8, geode.Point3D( [ 2, -2., -2 ] ) ) - builder_curve.create_edge_with_vertices( 0, 1 ) - builder_curve.create_edge_with_vertices( 1, 2 ) - builder_curve.create_edge_with_vertices( 2, 3 ) - builder_curve.create_edge_with_vertices( 3, 4 ) - builder_curve.create_edge_with_vertices( 4, 5 ) - builder_curve.create_edge_with_vertices( 5, 6 ) - builder_curve.create_edge_with_vertices( 6, 7 ) - builder_curve.create_edge_with_vertices( 7, 8 ) + builder_curve = geode.EdgedCurveBuilder3D.create(curve) + builder_curve.create_vertices(9) + builder_curve.set_point(0, geode.Point3D([5.0, 0.0, 1])) + builder_curve.set_point(1, geode.Point3D([3.0, 0.0, 0])) + builder_curve.set_point(2, geode.Point3D([2.0, 0.0, 0])) + builder_curve.set_point(3, geode.Point3D([1.0, 0.0, 0])) + builder_curve.set_point(4, geode.Point3D([-1.0, 0.0, 0])) + builder_curve.set_point(5, geode.Point3D([0.0, -3.0, 0])) + builder_curve.set_point(6, geode.Point3D([3.0, -3.0, 0])) + builder_curve.set_point(7, geode.Point3D([1.5, -2.0, 2])) + builder_curve.set_point(8, geode.Point3D([2, -2.0, -2])) + builder_curve.create_edge_with_vertices(0, 1) + builder_curve.create_edge_with_vertices(1, 2) + builder_curve.create_edge_with_vertices(2, 3) + builder_curve.create_edge_with_vertices(3, 4) + builder_curve.create_edge_with_vertices(4, 5) + builder_curve.create_edge_with_vertices(5, 6) + builder_curve.create_edge_with_vertices(6, 7) + builder_curve.create_edge_with_vertices(7, 8) - intersections_inspector = inspector.SurfaceCurveIntersections3D(surface, curve ) + intersections_inspector = inspector.SurfaceCurveIntersections3D(surface, curve) if not intersections_inspector.meshes_have_intersections(): - raise ValueError( "[Test] 3D Surface and Curve should have intersections." ) + raise ValueError("[Test] 3D Surface and Curve should have intersections.") if not intersections_inspector.intersecting_elements().nb_issues() == 6: - raise ValueError( "[Test] 3D Surface and Curve should have 6 intersecting elements pair." ) + raise ValueError( + "[Test] 3D Surface and Curve should have 6 intersecting elements pair." + ) + -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_intersections2D() check_intersections3D() diff --git a/bindings/python/tests/test-py-surface-degeneration.py b/bindings/python/tests/test-py-surface-degeneration.py index d30bc422..d959711c 100644 --- a/bindings/python/tests/test-py-surface-degeneration.py +++ b/bindings/python/tests/test-py-surface-degeneration.py @@ -22,8 +22,9 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode @@ -34,44 +35,43 @@ def check_non_degeneration2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) - builder.set_point(3, geode.Point2D([3., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) + builder.set_point(3, geode.Point2D([3.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) degeneration_inspector = inspector.SurfaceMeshDegeneration2D(surface) if degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Surface is shown degenerated whereas it is not.") + raise ValueError("[Test] Surface is shown degenerated whereas it is not.") if not degeneration_inspector.degenerated_edges().nb_issues() == 0: - raise ValueError( - "[Test] Surface has more degenerated edges than it should.") + raise ValueError("[Test] Surface has more degenerated edges than it should.") del degeneration_inspector + def check_degeneration_by_colocalisation2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) - builder.set_point(3, geode.Point2D([2., geode.GLOBAL_EPSILON / 2])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) + builder.set_point(3, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) degeneration_inspector = inspector.SurfaceMeshDegeneration2D(surface) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Surface is shown not degenerated whereas it is.") + raise ValueError("[Test] Surface is shown not degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: - raise ValueError( - "[Test] Surface has wrong number of degenerated edges.") + raise ValueError("[Test] Surface has wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges().issues()[0] == surface.edges().edge_from_vertices([1, 3]): + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == surface.edges().edge_from_vertices([1, 3]): raise ValueError("[Test] Surface has wrong degenerated edges.") del degeneration_inspector @@ -80,22 +80,22 @@ def check_degeneration_by_point_multiple_presence2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 0.])) - builder.set_point(2, geode.Point2D([1., 4.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 0.0])) + builder.set_point(2, geode.Point2D([1.0, 4.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 2, 1]) degeneration_inspector = inspector.SurfaceMeshDegeneration2D(surface) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] Surface is not shown degenerated whereas it is.") + raise ValueError("[Test] Surface is not shown degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: - raise ValueError( - "[Test] Surface has the wrong number of degenerated edges.") + raise ValueError("[Test] Surface has the wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges().issues()[0] == surface.edges().edge_from_vertices([1, 1]): + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == surface.edges().edge_from_vertices([1, 1]): raise ValueError("[Test] Surface shows the wrong degenerated edges.") del degeneration_inspector @@ -104,45 +104,48 @@ def check_non_degeneration3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) - builder.set_point(3, geode.Point3D([3., 3., 2.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) + builder.set_point(3, geode.Point3D([3.0, 3.0, 2.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) degeneration_inspector = inspector.SurfaceMeshDegeneration3D(surface) if degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] (3D) Surface is shown degenerated whereas it is not.") + raise ValueError("[Test] (3D) Surface is shown degenerated whereas it is not.") if not degeneration_inspector.degenerated_edges().nb_issues() == 0: raise ValueError( - "[Test] (3D) Surface has more degenerated edges than it should.") + "[Test] (3D) Surface has more degenerated edges than it should." + ) del degeneration_inspector + def check_degeneration_by_colocalisation3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) - builder.set_point(3, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, - 0.5 + geode.GLOBAL_EPSILON / 2])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) + builder.set_point( + 3, + geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, 0.5 + geode.GLOBAL_EPSILON / 2]), + ) builder.create_triangle([0, 1, 2]) builder.create_triangle([2, 1, 3]) degeneration_inspector = inspector.SurfaceMeshDegeneration3D(surface) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] (3D) Surface is shown not degenerated whereas it is.") + raise ValueError("[Test] (3D) Surface is shown not degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: - raise ValueError( - "[Test] (3D) Surface has wrong number of degenerated edges.") + raise ValueError("[Test] (3D) Surface has wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges().issues()[0] == surface.edges().edge_from_vertices([1, 3]): + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == surface.edges().edge_from_vertices([1, 3]): raise ValueError("[Test] (3D) Surface has wrong degenerated edges.") del degeneration_inspector @@ -151,29 +154,30 @@ def check_degeneration_by_point_multiple_presence3D(): surface = geode.TriangulatedSurface3D.create() builder = geode.TriangulatedSurfaceBuilder3D.create(surface) builder.create_vertices(3) - builder.set_point(0, geode.Point3D([0., 2., 0.])) - builder.set_point(1, geode.Point3D([2., 0., 0.5])) - builder.set_point(2, geode.Point3D([1., 4., 1.])) + builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0])) + builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5])) + builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 2, 1]) degeneration_inspector = inspector.SurfaceMeshDegeneration3D(surface) if not degeneration_inspector.is_mesh_degenerated(): - raise ValueError( - "[Test] (3D) Surface is not shown degenerated whereas it is.") + raise ValueError("[Test] (3D) Surface is not shown degenerated whereas it is.") if not degeneration_inspector.degenerated_edges().nb_issues() == 1: raise ValueError( - "[Test] (3D) Surface has the wrong number of degenerated edges.") + "[Test] (3D) Surface has the wrong number of degenerated edges." + ) surface.enable_edges() - if not degeneration_inspector.degenerated_edges().issues()[0] == surface.edges().edge_from_vertices([1, 1]): - raise ValueError( - "[Test] (3D) Surface shows the wrong degenerated edges.") + if not degeneration_inspector.degenerated_edges().issues()[ + 0 + ] == surface.edges().edge_from_vertices([1, 1]): + raise ValueError("[Test] (3D) Surface shows the wrong degenerated edges.") del degeneration_inspector -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_non_degeneration2D() check_degeneration_by_colocalisation2D() check_degeneration_by_point_multiple_presence2D() diff --git a/bindings/python/tests/test-py-surface-intersections.py b/bindings/python/tests/test-py-surface-intersections.py index 793619a2..3fecd939 100644 --- a/bindings/python/tests/test-py-surface-intersections.py +++ b/bindings/python/tests/test-py-surface-intersections.py @@ -87,6 +87,6 @@ def check_intersections3D(): if __name__ == "__main__": - inspector.InspectorInspectorLibrary.initialize() + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_intersections2D() check_intersections3D() diff --git a/bindings/python/tests/test-py-surface-manifold.py b/bindings/python/tests/test-py-surface-manifold.py index 0ed21fdc..983d6d22 100644 --- a/bindings/python/tests/test-py-surface-manifold.py +++ b/bindings/python/tests/test-py-surface-manifold.py @@ -22,8 +22,9 @@ import os import sys import platform + if sys.version_info >= (3, 8, 0) and platform.system() == "Windows": - for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + for path in [x.strip() for x in os.environ["PATH"].split(";") if x]: os.add_dll_directory(path) import opengeode as geode @@ -34,10 +35,10 @@ def check_vertex_manifold2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(4) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 2.])) - builder.set_point(2, geode.Point2D([2., 5.])) - builder.set_point(3, geode.Point2D([3., 0.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 2.0])) + builder.set_point(2, geode.Point2D([2.0, 5.0])) + builder.set_point(3, geode.Point2D([3.0, 0.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 3, 2]) builder.set_polygon_adjacent(geode.PolygonEdge(0, 1), 1) @@ -48,27 +49,29 @@ def check_vertex_manifold2D(): raise ValueError("[Test] Surface is shown non-manifold whereas it is.") if not manifold_inspector.non_manifold_vertices().nb_issues() == 0: raise ValueError( - "[Test] Surface has more non manifold vertices than it should.") + "[Test] Surface has more non manifold vertices than it should." + ) + def check_vertex_non_manifold2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(5) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 2.])) - builder.set_point(2, geode.Point2D([2., 5.])) - builder.set_point(3, geode.Point2D([3., 0.])) - builder.set_point(4, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 2.0])) + builder.set_point(2, geode.Point2D([2.0, 5.0])) + builder.set_point(3, geode.Point2D([3.0, 0.0])) + builder.set_point(4, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 3, 4]) manifold_inspector = inspector.SurfaceMeshVertexManifold2D(surface) if manifold_inspector.mesh_vertices_are_manifold(): raise ValueError( - "[Test] Surface vertices are shown manifold whereas one is not.") + "[Test] Surface vertices are shown manifold whereas one is not." + ) if not manifold_inspector.non_manifold_vertices().nb_issues() == 1: - raise ValueError( - "[Test] Surface has wrong number of non manifold vertices.") + raise ValueError("[Test] Surface has wrong number of non manifold vertices.") if not manifold_inspector.non_manifold_vertices().issues()[0] == 1: raise ValueError("[Test] Surface shows wrong non manifold vertex id.") @@ -77,11 +80,11 @@ def check_edge_manifold2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(5) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 2.])) - builder.set_point(2, geode.Point2D([2., 5.])) - builder.set_point(3, geode.Point2D([3., 0.])) - builder.set_point(4, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 2.0])) + builder.set_point(2, geode.Point2D([2.0, 5.0])) + builder.set_point(3, geode.Point2D([3.0, 0.0])) + builder.set_point(4, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 4, 2]) builder.create_triangle([1, 3, 4]) @@ -93,20 +96,21 @@ def check_edge_manifold2D(): manifold_inspector = inspector.SurfaceMeshEdgeManifold2D(surface) if not manifold_inspector.mesh_edges_are_manifold(): raise ValueError( - "[Test] Surface is shown non-manifold through edges whereas it is.") + "[Test] Surface is shown non-manifold through edges whereas it is." + ) if not manifold_inspector.non_manifold_edges().nb_issues() == 0: - raise ValueError( - "[Test] Surface has more non manifold edges than it should.") + raise ValueError("[Test] Surface has more non manifold edges than it should.") + def check_edge_non_manifold2D(): surface = geode.TriangulatedSurface2D.create() builder = geode.TriangulatedSurfaceBuilder2D.create(surface) builder.create_vertices(5) - builder.set_point(0, geode.Point2D([0., 2.])) - builder.set_point(1, geode.Point2D([2., 2.])) - builder.set_point(2, geode.Point2D([2., 5.])) - builder.set_point(3, geode.Point2D([3., 0.])) - builder.set_point(4, geode.Point2D([5., 3.])) + builder.set_point(0, geode.Point2D([0.0, 2.0])) + builder.set_point(1, geode.Point2D([2.0, 2.0])) + builder.set_point(2, geode.Point2D([2.0, 5.0])) + builder.set_point(3, geode.Point2D([3.0, 0.0])) + builder.set_point(4, geode.Point2D([5.0, 3.0])) builder.create_triangle([0, 1, 2]) builder.create_triangle([1, 4, 2]) builder.create_triangle([1, 3, 2]) @@ -117,14 +121,14 @@ def check_edge_non_manifold2D(): manifold_inspector = inspector.SurfaceMeshEdgeManifold2D(surface) if manifold_inspector.mesh_edges_are_manifold(): raise ValueError( - "[Test] Surface is shown manifold through edges whereas it is not.") + "[Test] Surface is shown manifold through edges whereas it is not." + ) if not manifold_inspector.non_manifold_edges().nb_issues() == 1: - raise ValueError( - "[Test] Surface has wrong number of non manifold edges.") + raise ValueError("[Test] Surface has wrong number of non manifold edges.") -if __name__ == '__main__': - inspector.InspectorInspectorLibrary.initialize() +if __name__ == "__main__": + inspector.OpenGeodeInspectorInspectorLibrary.initialize() check_vertex_manifold2D() check_vertex_non_manifold2D() check_edge_manifold2D() diff --git a/examples/model_inspection.py b/examples/model_inspection.py index ddc65b19..50d411ae 100644 --- a/examples/model_inspection.py +++ b/examples/model_inspection.py @@ -28,7 +28,7 @@ def check_invalid_components_topology_unique_vertices(brep_inspector): ) for vertex_index in invalid_components_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " has invalid components.", ) @@ -45,7 +45,7 @@ def check_unique_vertices_linked_to_multiple_corners(brep_inspector): ) for vertex_index in unique_vertices_linked_to_multiple_corners: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is associated to multiple corners.", ) @@ -62,7 +62,7 @@ def check_unique_vertices_linked_to_multiple_internals_corner(brep_inspector): ) for vertex_index in unique_vertices_linked_to_multiple_internals_corner: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is a corner associated with multiple embeddings.", ) @@ -79,7 +79,7 @@ def check_unique_vertices_linked_to_not_internal_nor_boundary_corner(brep_inspec ) for vertex_index in unique_vertices_linked_to_not_internal_nor_boundary_corner: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is neither internal nor a boundary.", ) @@ -96,7 +96,7 @@ def check_unique_vertices_liked_to_not_boundary_line_corner(brep_inspector): ) for vertex_index in unique_vertices_liked_to_not_boundary_line_corner: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is a corner but has a line for which it is not a boundary.", ) @@ -117,7 +117,7 @@ def check_unique_vertices_linked_to_line_with_wrong_relationship_to_surface( vertex_index ) in unique_vertices_linked_to_line_with_wrong_relationship_to_surface: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a line which is neither boundary nor internal.", ) @@ -134,7 +134,7 @@ def check_unique_vertices_linked_to_a_line_with_invalid_embeddings(brep_inspecto ) for vertex_index in unique_vertices_linked_to_a_line_with_invalid_embeddings: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a line with invalid internal properties.", ) @@ -151,7 +151,7 @@ def check_unique_vertices_linked_to_a_single_and_invalid_line(brep_inspector): ) for vertex_index in unique_vertices_linked_to_a_single_and_invalid_line: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a unique line with invalid topological properties.", ) @@ -172,7 +172,7 @@ def check_unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner( vertex_index ) in unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of multiple lines but is not a corner.", ) @@ -189,7 +189,7 @@ def check_part_of_not_boundary_nor_internal_surface_unique_vertices(brep_inspect ) for vertex_index in part_of_not_boundary_nor_internal_surface_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a surface which is neither internal nor boundary.", ) @@ -208,7 +208,7 @@ def check_part_of_surface_with_invalid_internal_topology_unique_vertices( ) for vertex_index in part_of_surface_with_invalid_internal_topology_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a surface with invalid internal topology.", ) @@ -225,7 +225,7 @@ def check_part_of_invalid_unique_surface_unique_vertices(brep_inspector): ) for vertex_index in part_of_invalid_unique_surface_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of a unique surface with invalid topology.", ) @@ -242,7 +242,7 @@ def check_part_of_invalid_multiple_surfaces_unique_vertices(brep_inspector): ) for vertex_index in part_of_invalid_multiple_surfaces_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " is part of invalid multiple surfaces.", ) @@ -259,7 +259,7 @@ def check_part_of_invalid_blocks_unique_vertices(brep_inspector): ) for vertex_index in part_of_invalid_blocks_unique_vertices: print( - "[Test] Model unique vertex with index ", + "Model unique vertex with index ", vertex_index, " has invalid blocks topology.", ) diff --git a/include/geode/inspector/common.hpp b/include/geode/inspector/common.hpp index a028e246..436920e6 100644 --- a/include/geode/inspector/common.hpp +++ b/include/geode/inspector/common.hpp @@ -27,8 +27,10 @@ #include #include +#include namespace geode { - OPENGEODE_LIBRARY( opengeode_inspector_inspector_api, InspectorInspector ); + OPENGEODE_LIBRARY( + opengeode_inspector_inspector_api, OpenGeodeInspector, Inspector ); } // namespace geode \ No newline at end of file diff --git a/include/geode/inspector/project.hpp b/include/geode/inspector/project.hpp new file mode 100644 index 00000000..df720a4e --- /dev/null +++ b/include/geode/inspector/project.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 - 2026 Geode-solutions + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#pragma once + +#include + +namespace geode +{ + class OpenGeodeInspectorException : public OpenGeodeException + { + protected: + using OpenGeodeException::OpenGeodeException; + }; +} // namespace geode diff --git a/src/bin/geode-inspector-brep.cpp b/src/bin/geode-inspector-brep.cpp index ea8b56c3..a5db5879 100644 --- a/src/bin/geode-inspector-brep.cpp +++ b/src/bin/geode-inspector-brep.cpp @@ -59,7 +59,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOModelLibrary::initialize(); + geode::OpenGeodeIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_brep( geode::load_brep( filename ) ); diff --git a/src/bin/geode-inspector-cross-section.cpp b/src/bin/geode-inspector-cross-section.cpp index ebf4d4c1..eb5f211d 100644 --- a/src/bin/geode-inspector-cross-section.cpp +++ b/src/bin/geode-inspector-cross-section.cpp @@ -59,7 +59,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::GeosciencesIOModelLibrary::initialize(); + geode::OpenGeodeGeosciencesIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_cross_section( geode::load_cross_section( filename ) ); diff --git a/src/bin/geode-inspector-edgedcurve.cpp b/src/bin/geode-inspector-edgedcurve.cpp index e11359b3..0b2c5168 100644 --- a/src/bin/geode-inspector-edgedcurve.cpp +++ b/src/bin/geode-inspector-edgedcurve.cpp @@ -63,8 +63,8 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocolocation" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOMeshLibrary::initialize(); - geode::GeosciencesIOMeshLibrary::initialize(); + geode::OpenGeodeIOMeshLibrary::initialize(); + geode::OpenGeodeGeosciencesIOMeshLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); const auto ext = geode::to_string( geode::extension_from_filename( filename ) ); @@ -79,7 +79,9 @@ int main( int argc, char* argv[] ) } else { - throw geode::OpenGeodeException( "Unable to load file ", filename ); + throw geode::OpenGeodeInspectorInspectorException{ nullptr, + geode::OpenGeodeException::TYPE::data, "Unable to load file ", + filename }; } return 0; diff --git a/src/bin/geode-inspector-implicit-cross-section.cpp b/src/bin/geode-inspector-implicit-cross-section.cpp index 5da76c09..70862cba 100644 --- a/src/bin/geode-inspector-implicit-cross-section.cpp +++ b/src/bin/geode-inspector-implicit-cross-section.cpp @@ -60,7 +60,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::GeosciencesIOModelLibrary::initialize(); + geode::OpenGeodeGeosciencesIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_implicit_cross_section( diff --git a/src/bin/geode-inspector-implicit-structural-model.cpp b/src/bin/geode-inspector-implicit-structural-model.cpp index 253d2885..62eb10a5 100644 --- a/src/bin/geode-inspector-implicit-structural-model.cpp +++ b/src/bin/geode-inspector-implicit-structural-model.cpp @@ -60,7 +60,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::GeosciencesIOModelLibrary::initialize(); + geode::OpenGeodeGeosciencesIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_implicit_structural_model( diff --git a/src/bin/geode-inspector-pointset.cpp b/src/bin/geode-inspector-pointset.cpp index c56bf992..2f758870 100644 --- a/src/bin/geode-inspector-pointset.cpp +++ b/src/bin/geode-inspector-pointset.cpp @@ -61,8 +61,8 @@ int main( int argc, char* argv[] ) argv[0], " --input my_pointset.og_pts3d\n" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOMeshLibrary::initialize(); - geode::GeosciencesIOMeshLibrary::initialize(); + geode::OpenGeodeIOMeshLibrary::initialize(); + geode::OpenGeodeGeosciencesIOMeshLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); const auto ext = geode::to_string( geode::extension_from_filename( filename ) ); @@ -77,7 +77,9 @@ int main( int argc, char* argv[] ) } else { - throw geode::OpenGeodeException( "Unable to load file ", filename ); + throw geode::OpenGeodeInspectorInspectorException{ nullptr, + geode::OpenGeodeException::TYPE::data, "Unable to load file ", + filename }; } return 0; diff --git a/src/bin/geode-inspector-section.cpp b/src/bin/geode-inspector-section.cpp index e62e9d20..0a3d859a 100644 --- a/src/bin/geode-inspector-section.cpp +++ b/src/bin/geode-inspector-section.cpp @@ -59,7 +59,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOModelLibrary::initialize(); + geode::OpenGeodeIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_section( geode::load_section( filename ) ); diff --git a/src/bin/geode-inspector-solid.cpp b/src/bin/geode-inspector-solid.cpp index 50e84bcb..7d2a7d82 100644 --- a/src/bin/geode-inspector-solid.cpp +++ b/src/bin/geode-inspector-solid.cpp @@ -68,8 +68,8 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --noadjacency" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOMeshLibrary::initialize(); - geode::GeosciencesIOMeshLibrary::initialize(); + geode::OpenGeodeIOMeshLibrary::initialize(); + geode::OpenGeodeGeosciencesIOMeshLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); const auto ext = geode::to_string( geode::extension_from_filename( filename ) ); @@ -92,7 +92,9 @@ int main( int argc, char* argv[] ) } else { - throw geode::OpenGeodeException( "Unable to load file ", filename ); + throw geode::OpenGeodeInspectorInspectorException{ nullptr, + geode::OpenGeodeException::TYPE::data, "Unable to load file ", + filename }; } return 0; diff --git a/src/bin/geode-inspector-structural-model.cpp b/src/bin/geode-inspector-structural-model.cpp index fc3d142e..ca34259b 100644 --- a/src/bin/geode-inspector-structural-model.cpp +++ b/src/bin/geode-inspector-structural-model.cpp @@ -59,7 +59,7 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --nocomponent_linking" ) ); absl::ParseCommandLine( argc, argv ); - geode::GeosciencesIOModelLibrary::initialize(); + geode::OpenGeodeGeosciencesIOModelLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); inspect_model( geode::load_structural_model( filename ) ); diff --git a/src/bin/geode-inspector-surface-curve-intersections.cpp b/src/bin/geode-inspector-surface-curve-intersections.cpp index 565c8845..54ff270b 100644 --- a/src/bin/geode-inspector-surface-curve-intersections.cpp +++ b/src/bin/geode-inspector-surface-curve-intersections.cpp @@ -74,8 +74,8 @@ int main( int argc, char* argv[] ) " --surface my_surface.og_tsf3d --curve my_curve.og_edc3d\n" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOMeshLibrary::initialize(); - geode::GeosciencesIOMeshLibrary::initialize(); + geode::OpenGeodeIOMeshLibrary::initialize(); + geode::OpenGeodeGeosciencesIOMeshLibrary::initialize(); const auto filename_surf = absl::GetFlag( FLAGS_surface ); const auto filename_curv = absl::GetFlag( FLAGS_curve ); const auto ext_surf = @@ -96,8 +96,9 @@ int main( int argc, char* argv[] ) } else { - throw geode::OpenGeodeException( - "Unable to load as TrigulatedSurface file ", filename_surf ); + throw geode::OpenGeodeInspectorInspectorException{ nullptr, + geode::OpenGeodeException::TYPE::data, "Unable to load file ", + filename_surf }; } return 0; diff --git a/src/bin/geode-inspector-surface.cpp b/src/bin/geode-inspector-surface.cpp index 5f219a1c..c1f9da3f 100644 --- a/src/bin/geode-inspector-surface.cpp +++ b/src/bin/geode-inspector-surface.cpp @@ -66,8 +66,8 @@ int main( int argc, char* argv[] ) "use --noXXX, e.g. --noadjacency" ) ); absl::ParseCommandLine( argc, argv ); - geode::IOMeshLibrary::initialize(); - geode::GeosciencesIOMeshLibrary::initialize(); + geode::OpenGeodeIOMeshLibrary::initialize(); + geode::OpenGeodeGeosciencesIOMeshLibrary::initialize(); const auto filename = absl::GetFlag( FLAGS_input ); const auto ext = geode::to_string( geode::extension_from_filename( filename ) ); @@ -96,7 +96,9 @@ int main( int argc, char* argv[] ) } else { - throw geode::OpenGeodeException( "Unable to load file ", filename ); + throw geode::OpenGeodeInspectorInspectorException{ nullptr, + geode::OpenGeodeException::TYPE::data, "Unable to load file ", + filename }; } return 0; diff --git a/src/geode/inspector/common.cpp b/src/geode/inspector/common.cpp index e94cc21e..68dda43b 100644 --- a/src/geode/inspector/common.cpp +++ b/src/geode/inspector/common.cpp @@ -27,7 +27,7 @@ namespace geode { - OPENGEODE_LIBRARY_IMPLEMENTATION( InspectorInspector ) + OPENGEODE_LIBRARY_IMPLEMENTATION( OpenGeodeInspector, Inspector ) { OpenGeodeModelLibrary::initialize(); } diff --git a/src/geode/inspector/criterion/internal/component_meshes_adjacency.cpp b/src/geode/inspector/criterion/internal/component_meshes_adjacency.cpp index 4c72c67b..c013c32c 100644 --- a/src/geode/inspector/criterion/internal/component_meshes_adjacency.cpp +++ b/src/geode/inspector/criterion/internal/component_meshes_adjacency.cpp @@ -25,6 +25,8 @@ #include +#include + #include #include @@ -43,12 +45,17 @@ namespace { const auto edge_unique_vertices = geode::edge_unique_vertices( model, surface, polygon_edge ); - OPENGEODE_EXCEPTION( edge_unique_vertices[0] != geode::NO_ID - && edge_unique_vertices[1] != geode::NO_ID, + geode::OpenGeodeInspectorInspectorException::check( + edge_unique_vertices[0] != geode::NO_ID + && edge_unique_vertices[1] != geode::NO_ID, + surface.mesh().edge_barycenter( polygon_edge ), + geode::OpenGeodeException::TYPE::data, "[ComponentMeshesAdjacency] Missing unique_vertices" ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::check( edge_unique_vertices[0] < model.nb_unique_vertices() && edge_unique_vertices[1] < model.nb_unique_vertices(), + surface.mesh().edge_barycenter( polygon_edge ), + geode::OpenGeodeException::TYPE::data, "[ComponentMeshesAdjacency] Wrong unique_vertices" ); return !geode::detail::line_component_mesh_edges( model, edge_unique_vertices ) diff --git a/src/geode/inspector/criterion/intersections/model_intersections.cpp b/src/geode/inspector/criterion/intersections/model_intersections.cpp index 8d3db0e4..585b52f4 100644 --- a/src/geode/inspector/criterion/intersections/model_intersections.cpp +++ b/src/geode/inspector/criterion/intersections/model_intersections.cpp @@ -196,7 +196,7 @@ namespace private: const Model& model_; - DEBUG_CONST bool same_surface_; + bool same_surface_; const geode::Surface< Model::dim >& surface1_; const geode::Surface< Model::dim >& surface2_; const geode::SurfaceMesh< Model::dim >& mesh1_; @@ -235,7 +235,7 @@ namespace } private: - DEBUG_CONST bool same_surface_; + bool same_surface_; }; template < typename Model > @@ -266,7 +266,7 @@ namespace } private: - DEBUG_CONST bool same_surface_; + bool same_surface_; }; template < typename Model > @@ -301,7 +301,7 @@ namespace } private: - DEBUG_CONST bool same_surface_; + bool same_surface_; }; geode::index_t third_point_index( const geode::PolygonVertices& vertices, @@ -317,9 +317,10 @@ namespace } return vertex_id; } - OPENGEODE_ASSERT_NOT_REACHED( "Should have found a third point index " - "in second PolygonVertices." ); - return geode::NO_ID; + throw geode::OpenGeodeInspectorInspectorException{ + nullptr, geode::OpenGeodeException::TYPE::internal, + "Should have found a third point index in second PolygonVertices." + }; } template <> diff --git a/src/geode/inspector/criterion/intersections/surface_intersections.cpp b/src/geode/inspector/criterion/intersections/surface_intersections.cpp index 25769823..e3c2d841 100644 --- a/src/geode/inspector/criterion/intersections/surface_intersections.cpp +++ b/src/geode/inspector/criterion/intersections/surface_intersections.cpp @@ -144,7 +144,7 @@ namespace geode private: const SurfaceMesh< dimension >& mesh_; - DEBUG_CONST bool verbose_; + bool verbose_; }; template < index_t dimension > diff --git a/src/geode/inspector/criterion/manifold/solid_edge_manifold.cpp b/src/geode/inspector/criterion/manifold/solid_edge_manifold.cpp index 6c5fe51a..25a8bddc 100644 --- a/src/geode/inspector/criterion/manifold/solid_edge_manifold.cpp +++ b/src/geode/inspector/criterion/manifold/solid_edge_manifold.cpp @@ -165,7 +165,6 @@ namespace geode private: const SolidMesh< dimension >& mesh_; - DEBUG_CONST absl::flat_hash_map< Edge, std::vector< geode::index_t > > polyhedra_around_edges_; }; diff --git a/tests/inspector/test-brep.cpp b/tests/inspector/test-brep.cpp index 53c64802..87e14054 100644 --- a/tests/inspector/test-brep.cpp +++ b/tests/inspector/test-brep.cpp @@ -324,14 +324,15 @@ void check_model_a1( bool string ) const auto nb_topological_issues = launch_topological_validity_checks( result.topology, string ); - OPENGEODE_EXCEPTION( nb_topological_issues == 5201, "[Test] model_A1 has ", - nb_topological_issues, " topological problems instead of 5201." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_topological_issues == 5201, "model_A1 has ", nb_topological_issues, + " topological problems instead of 5201." ); const auto nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, string ); - OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13494, - "[Test] model_A1 has ", nb_component_meshes_issues, - " meshes problems instead of 13494." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_component_meshes_issues == 13494, "model_A1 has ", + nb_component_meshes_issues, " meshes problems instead of 13494." ); } void check_model_a1_valid( bool string ) @@ -346,15 +347,15 @@ void check_model_a1_valid( bool string ) const auto nb_topological_issues = launch_topological_validity_checks( result.topology, string ); - OPENGEODE_EXCEPTION( nb_topological_issues == 5201, - "[Test] model_A1_valid has ", nb_topological_issues, - " topological problems instead of 5201." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_topological_issues == 5201, "model_A1_valid has ", + nb_topological_issues, " topological problems instead of 5201." ); const auto nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, string ); - OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13494, - "[Test] model_A1_valid has ", nb_component_meshes_issues, - " meshes problems instead of 13494." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_component_meshes_issues == 13494, "model_A1_valid has ", + nb_component_meshes_issues, " meshes problems instead of 13494." ); } void check_model_mss( bool string ) @@ -369,13 +370,15 @@ void check_model_mss( bool string ) const auto nb_topological_issues = launch_topological_validity_checks( result.topology, string ); - OPENGEODE_EXCEPTION( nb_topological_issues == 52, "[Test] mss has ", - nb_topological_issues, " topological problems instead of 37." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_topological_issues == 52, "mss has ", nb_topological_issues, + " topological problems instead of 37." ); const auto nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, string ); - OPENGEODE_EXCEPTION( nb_component_meshes_issues == 0, "[Test] mss has ", - nb_component_meshes_issues, " meshes problems instead of 0." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_component_meshes_issues == 0, "mss has ", nb_component_meshes_issues, + " meshes problems instead of 0." ); } void check_model_D( bool string ) @@ -389,11 +392,13 @@ void check_model_D( bool string ) brep_inspector.brep_topology_is_valid() ? "valid." : "invalid." ); const auto nb_topological_issues = launch_topological_validity_checks( result.topology, string ); - OPENGEODE_EXCEPTION( nb_topological_issues == 0, "[Test] model_D has ", - nb_topological_issues, " topological problems instead of 0." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_topological_issues == 0, "model_D has ", nb_topological_issues, + " topological problems instead of 0." ); const auto nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, string ); - OPENGEODE_EXCEPTION( nb_component_meshes_issues == 0, "[Test] model_D has ", + geode::OpenGeodeInspectorInspectorException::test( + nb_component_meshes_issues == 0, "model_D has ", nb_component_meshes_issues, " meshes problems instead of 0." ); } @@ -403,11 +408,10 @@ void check_wrong_bsurfaces_model() geode::DATA_PATH, "wrong_boundary_surface_model.og_brep" ) ); const geode::BRepInspector brep_inspector{ model_brep }; const auto result = brep_inspector.inspect_brep(); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( result.topology.blocks.wrong_block_boundary_surface.nb_issues() == 3, - absl::StrCat( - "[Test] Wrong number of wrong block boundary surfaces detected: " - "should be 3, and it is ", + absl::StrCat( "Wrong number of wrong block boundary surfaces detected: " + "should be 3, and it is ", result.topology.blocks.wrong_block_boundary_surface.nb_issues(), "." ) ); std::vector< geode::uuid > wrong_bsurf{ @@ -418,9 +422,9 @@ void check_wrong_bsurfaces_model() for( const auto& issue : result.topology.blocks.wrong_block_boundary_surface.issues() ) { - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( absl::c_find( wrong_bsurf, issue ) != wrong_bsurf.end(), - "[Test] Surface (", issue.string(), + "Surface (", issue.string(), ") is detected as a wrong boundary surface but is not one." ); } } @@ -443,7 +447,7 @@ int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); geode::Logger::set_level( geode::Logger::LEVEL::debug ); check_model_a1( false ); check_model_a1_valid( false ); diff --git a/tests/inspector/test-edgedcurve-colocation.cpp b/tests/inspector/test-edgedcurve-colocation.cpp index 10d1fd4f..368df3dd 100644 --- a/tests/inspector/test-edgedcurve-colocation.cpp +++ b/tests/inspector/test-edgedcurve-colocation.cpp @@ -41,11 +41,12 @@ void check_non_colocation2D() builder->set_point( 3, geode::Point2D{ { 3., 3. } } ); const geode::EdgedCurveColocation2D colocation_inspector{ *curve }; - OPENGEODE_EXCEPTION( !colocation_inspector.mesh_has_colocated_points(), - "[Test] EdgedCurve has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !colocation_inspector.mesh_has_colocated_points(), + "EdgedCurve has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( colocation_inspector.colocated_points_groups().nb_issues() == 0, - "[Test] EdgedCurve has more colocated points than it should." ); + "EdgedCurve has more colocated points than it should." ); } void check_colocation2D() @@ -64,32 +65,34 @@ void check_colocation2D() 6, geode::Point2D{ { geode::GLOBAL_EPSILON / 1.1, 2. } } ); const geode::EdgedCurveColocation2D colocation_inspector{ *curve }; - OPENGEODE_EXCEPTION( colocation_inspector.mesh_has_colocated_points(), - "[Test] EdgedCurve doesn't have colocated points whereas it should " + geode::OpenGeodeInspectorInspectorException::test( + colocation_inspector.mesh_has_colocated_points(), + "EdgedCurve doesn't have colocated points whereas it should " "have several." ); const auto colocated_points_groups = colocation_inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] EdgedCurve has wrong number of colocated groups of points." ); + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "EdgedCurve has wrong number of colocated groups of points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] EdgedCurve has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "EdgedCurve has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] EdgedCurve has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "EdgedCurve has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == second_colocated_points_group || colocated_points_groups.issues()[1] == first_colocated_points_group, - "[Test] EdgedCurve has wrong second colocated points group." ); + "EdgedCurve has wrong second colocated points group." ); } void check_non_colocation3D() @@ -103,12 +106,13 @@ void check_non_colocation3D() builder->set_point( 3, geode::Point3D{ { 3., 3., 2. } } ); const geode::EdgedCurveColocation3D colocation_inspector{ *curve }; - OPENGEODE_EXCEPTION( !colocation_inspector.mesh_has_colocated_points(), - "[Test] (3D) EdgedCurve has colocated points when it should have " + geode::OpenGeodeInspectorInspectorException::test( + !colocation_inspector.mesh_has_colocated_points(), + "(3D) EdgedCurve has colocated points when it should have " "none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocation_inspector.colocated_points_groups().nb_issues() == 0, - "[Test] (3D) EdgedCurve has more colocated points than it should." ); + "(3D) EdgedCurve has more colocated points than it should." ); } void check_colocation3D() @@ -127,40 +131,42 @@ void check_colocation3D() 6, geode::Point3D{ { geode::GLOBAL_EPSILON / 1.1, 2., 1. } } ); const geode::EdgedCurveColocation3D colocation_inspector{ *curve }; - OPENGEODE_EXCEPTION( colocation_inspector.mesh_has_colocated_points(), - "[Test] (3D) EdgedCurve doesn't have colocated points whereas it " + geode::OpenGeodeInspectorInspectorException::test( + colocation_inspector.mesh_has_colocated_points(), + "(3D) EdgedCurve doesn't have colocated points whereas it " "should have several." ); const auto colocated_points_groups = colocation_inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] (3D) EdgedCurve has wrong number of colocated groups of " + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "(3D) EdgedCurve has wrong number of colocated groups of " "points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] (3D) EdgedCurve has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "(3D) EdgedCurve has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] (3D) EdgedCurve has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "(3D) EdgedCurve has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == first_colocated_points_group || colocated_points_groups.issues()[1] == second_colocated_points_group, - "[Test] (3D) EdgedCurve has wrong second colocated points group." ); + "(3D) EdgedCurve has wrong second colocated points group." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_colocation2D(); check_colocation2D(); check_non_colocation3D(); diff --git a/tests/inspector/test-edgedcurve-degeneration.cpp b/tests/inspector/test-edgedcurve-degeneration.cpp index 174cbc0c..0b27a0df 100644 --- a/tests/inspector/test-edgedcurve-degeneration.cpp +++ b/tests/inspector/test-edgedcurve-degeneration.cpp @@ -44,11 +44,12 @@ void check_non_degeneration2D() builder->create_edge( 2, 0 ); const geode::EdgedCurveDegeneration2D degeneration_inspector{ *curve }; - OPENGEODE_EXCEPTION( !degeneration_inspector.is_mesh_degenerated(), - "[Test] EdgedCurve is shown degenerated whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !degeneration_inspector.is_mesh_degenerated(), + "EdgedCurve is shown degenerated whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 0, - "[Test] EdgedCurve has more degenerated edges than it should." ); + "EdgedCurve has more degenerated edges than it should." ); } void check_degeneration_by_colocalisation2D() @@ -66,14 +67,15 @@ void check_degeneration_by_colocalisation2D() builder->create_edge( 1, 2 ); const geode::EdgedCurveDegeneration2D degeneration_inspector{ *curve }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] EdgedCurve is shown not degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "EdgedCurve is shown not degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] EdgedCurve has wrong number of degenerated edges." ); - OPENGEODE_EXCEPTION( + "EdgedCurve has wrong number of degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().issues()[0] == 2, - "[Test] EdgedCurve has wrong degenerated edges." ); + "EdgedCurve has wrong degenerated edges." ); } void check_non_degeneration3D() @@ -90,11 +92,12 @@ void check_non_degeneration3D() builder->create_edge( 2, 0 ); const geode::EdgedCurveDegeneration3D degeneration_inspector{ *curve }; - OPENGEODE_EXCEPTION( !degeneration_inspector.is_mesh_degenerated(), - "[Test] (3D) EdgedCurve is shown degenerated whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !degeneration_inspector.is_mesh_degenerated(), + "(3D) EdgedCurve is shown degenerated whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 0, - "[Test] (3D) EdgedCurve has more degenerated edges than it should." ); + "(3D) EdgedCurve has more degenerated edges than it should." ); } void check_degeneration_by_colocalisation3D() @@ -112,21 +115,22 @@ void check_degeneration_by_colocalisation3D() builder->create_edge( 1, 2 ); const geode::EdgedCurveDegeneration3D degeneration_inspector{ *curve }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] (3D) EdgedCurve is shown not degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "(3D) EdgedCurve is shown not degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] (3D) EdgedCurve has wrong number of degenerated edges." ); - OPENGEODE_EXCEPTION( + "(3D) EdgedCurve has wrong number of degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().issues()[0] == 2, - "[Test] (3D) EdgedCurve has wrong degenerated edges." ); + "(3D) EdgedCurve has wrong degenerated edges." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_degeneration2D(); check_degeneration_by_colocalisation2D(); check_non_degeneration3D(); diff --git a/tests/inspector/test-pointset.cpp b/tests/inspector/test-pointset.cpp index 5ab6d0bd..46175e9f 100644 --- a/tests/inspector/test-pointset.cpp +++ b/tests/inspector/test-pointset.cpp @@ -41,10 +41,12 @@ void check_non_colocation2D() builder->set_point( 3, geode::Point2D{ { 3., 3. } } ); const geode::PointSetInspector2D inspector{ *pointset }; - OPENGEODE_EXCEPTION( !inspector.mesh_has_colocated_points(), - "[Test] PointSet has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( inspector.colocated_points_groups().nb_issues() == 0, - "[Test] PointSet has more colocated points than it should." ); + geode::OpenGeodeInspectorInspectorException::test( + !inspector.mesh_has_colocated_points(), + "PointSet has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( + inspector.colocated_points_groups().nb_issues() == 0, + "PointSet has more colocated points than it should." ); } void check_colocation2D() @@ -63,31 +65,33 @@ void check_colocation2D() 6, geode::Point2D{ { geode::GLOBAL_EPSILON / 1.1, 2. } } ); const geode::PointSetInspector2D inspector{ *pointset }; - OPENGEODE_EXCEPTION( inspector.mesh_has_colocated_points(), - "[Test] PointSet doesn't have colocated points whereas it should have " + geode::OpenGeodeInspectorInspectorException::test( + inspector.mesh_has_colocated_points(), + "PointSet doesn't have colocated points whereas it should have " "several." ); const auto colocated_points_groups = inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] PointSet has wrong number of colocated groups of points." ); + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "PointSet has wrong number of colocated groups of points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] PointSet has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "PointSet has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] PointSet has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "PointSet has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == first_colocated_points_group || colocated_points_groups.issues()[1] == second_colocated_points_group, - "[Test] PointSet has wrong second colocated points group." ); + "PointSet has wrong second colocated points group." ); } void check_non_colocation3D() @@ -101,10 +105,12 @@ void check_non_colocation3D() builder->set_point( 3, geode::Point3D{ { 3., 3., 2. } } ); const geode::PointSetInspector3D inspector{ *pointset }; - OPENGEODE_EXCEPTION( !inspector.mesh_has_colocated_points(), - "[Test] (3D) PointSet has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( inspector.colocated_points_groups().nb_issues() == 0, - "[Test] (3D) PointSet has more colocated points than it should." ); + geode::OpenGeodeInspectorInspectorException::test( + !inspector.mesh_has_colocated_points(), + "(3D) PointSet has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( + inspector.colocated_points_groups().nb_issues() == 0, + "(3D) PointSet has more colocated points than it should." ); } void check_colocation3D() @@ -123,40 +129,42 @@ void check_colocation3D() 6, geode::Point3D{ { geode::GLOBAL_EPSILON / 1.1, 2., 1. } } ); const geode::PointSetInspector3D inspector{ *pointset }; - OPENGEODE_EXCEPTION( inspector.mesh_has_colocated_points(), - "[Test] (3D) PointSet doesn't have colocated points whereas it should " + geode::OpenGeodeInspectorInspectorException::test( + inspector.mesh_has_colocated_points(), + "(3D) PointSet doesn't have colocated points whereas it should " "have " "several." ); const auto colocated_points_groups = inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] (3D) PointSet has wrong number of colocated groups of " + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "(3D) PointSet has wrong number of colocated groups of " "points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] (3D) PointSet has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "(3D) PointSet has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] (3D) PointSet has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "(3D) PointSet has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == first_colocated_points_group || colocated_points_groups.issues()[1] == second_colocated_points_group, - "[Test] (3D) PointSet has wrong second colocated points group." ); + "(3D) PointSet has wrong second colocated points group." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_colocation2D(); check_colocation2D(); check_non_colocation3D(); diff --git a/tests/inspector/test-section.cpp b/tests/inspector/test-section.cpp index 979a9195..8c1bbed4 100644 --- a/tests/inspector/test-section.cpp +++ b/tests/inspector/test-section.cpp @@ -270,12 +270,14 @@ void check_section( bool string ) const auto nb_topological_issues = launch_topological_validity_checks( result.topology, string ); - OPENGEODE_EXCEPTION( nb_topological_issues == 0, "[Test] model_D has ", - nb_topological_issues, " topological problems instead of 0." ); + geode::OpenGeodeInspectorInspectorException::test( + nb_topological_issues == 0, "model_D has ", nb_topological_issues, + " topological problems instead of 0." ); const auto nb_component_meshes_issues = launch_component_meshes_validity_checks( result.meshes, string ); - OPENGEODE_EXCEPTION( nb_component_meshes_issues == 0, "[Test] model_D has ", + geode::OpenGeodeInspectorInspectorException::test( + nb_component_meshes_issues == 0, "model_D has ", nb_component_meshes_issues, " meshes problems instead of 0." ); } @@ -294,8 +296,8 @@ int main() { try { - geode::InspectorInspectorLibrary::initialize(); - geode::GeosciencesIOModelLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); + geode::OpenGeodeGeosciencesIOModelLibrary::initialize(); geode::Logger::set_level( geode::Logger::LEVEL::trace ); check_section( false ); check_section_test(); diff --git a/tests/inspector/test-solid-adjacency.cpp b/tests/inspector/test-solid-adjacency.cpp index 866edde7..1f42ecc3 100644 --- a/tests/inspector/test-solid-adjacency.cpp +++ b/tests/inspector/test-solid-adjacency.cpp @@ -48,11 +48,12 @@ void check_adjacency() builder->set_polyhedron_adjacent( { 1, 1 }, 0 ); const geode::SolidMeshInspector3D adjacency_inspector{ *solid }; - OPENGEODE_EXCEPTION( !adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Solid shows wrong adjacencies where there are none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !adjacency_inspector.mesh_has_wrong_adjacencies(), + "Solid shows wrong adjacencies where there are none." ); + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.non_manifold_facets().nb_issues() == 0, - "[Test] Solid has more wrong adjacencies than it should." ); + "Solid has more wrong adjacencies than it should." ); } void check_non_adjacency_no_bijection() @@ -74,18 +75,19 @@ void check_non_adjacency_no_bijection() builder->set_polyhedron_adjacent( { 2, 1 }, 0 ); const geode::SolidMeshInspector3D adjacency_inspector{ *solid }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Solid should have a wrong adjacency due to non-bijection." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Solid should have a wrong adjacency due to non-bijection." ); + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().nb_issues() == 1, - "[Test] Solid should have one wrong adjacency due to " + "Solid should have one wrong adjacency due to " "non-bijection." ); const geode::PolyhedronFacet polyhedron_facet{ 2, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] == polyhedron_facet, - "[Test] Solid facets show wrong adjacency problems." ); + "Solid facets show wrong adjacency problems." ); } void check_non_adjacency_wrong_facet() @@ -104,24 +106,25 @@ void check_non_adjacency_wrong_facet() builder->set_polyhedron_adjacent( { 1, 0 }, 0 ); const geode::SolidMeshInspector3D adjacency_inspector{ *solid }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Solid should have wrong adjacencies due to wrong facet for " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Solid should have wrong adjacencies due to wrong facet for " "adjacency." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().nb_issues() == 2, - "[Test] Solid should have two wrong adjacencies due to wrong facet " + "Solid should have two wrong adjacencies due to wrong facet " "for adjacency." ); const geode::PolyhedronFacet polyhedron_facet1{ 0, 0 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] == polyhedron_facet1, - "[Test] Solid shows wrong first facet with adjacency problems." ); + "Solid shows wrong first facet with adjacency problems." ); const geode::PolyhedronFacet polyhedron_facet2{ 1, 0 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] == polyhedron_facet2, - "[Test] Solid shows wrong second facet with adjacency problems." ); + "Solid shows wrong second facet with adjacency problems." ); } void check_non_adjacency_inversed_tetrahedron() @@ -140,25 +143,26 @@ void check_non_adjacency_inversed_tetrahedron() builder->set_polyhedron_adjacent( { 1, 1 }, 0 ); const geode::SolidMeshInspector3D adjacency_inspector{ *solid }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Solid should have wrong adjacencies due to an inversed " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Solid should have wrong adjacencies due to an inversed " "tetrahedron." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().nb_issues() == 2, - "[Test] Solid should have two wrong adjacencies due to an inversed " + "Solid should have two wrong adjacencies due to an inversed " "tetrahedron." ); const geode::PolyhedronFacet polyhedron_facet1{ 0, 0 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[0] == polyhedron_facet1, - "[Test] Solid shows wrong first facet with adjacency problems due to " + "Solid shows wrong first facet with adjacency problems due to " "an inversed tetrahedron." ); const geode::PolyhedronFacet polyhedron_facet2{ 1, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polyhedron_facets_with_wrong_adjacency().issues()[1] == polyhedron_facet2, - "[Test] Solid shows wrong second facet with adjacency problems due to " + "Solid shows wrong second facet with adjacency problems due to " "an inversed tetrahedron." ); } @@ -166,7 +170,7 @@ int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); geode::Logger::set_level( geode::Logger::LEVEL::debug ); check_adjacency(); check_non_adjacency_no_bijection(); diff --git a/tests/inspector/test-solid-colocation.cpp b/tests/inspector/test-solid-colocation.cpp index 15793ab3..7b6745fe 100644 --- a/tests/inspector/test-solid-colocation.cpp +++ b/tests/inspector/test-solid-colocation.cpp @@ -42,11 +42,12 @@ void check_non_colocation() builder->set_point( 4, geode::Point3D{ { 1., 2., -3. } } ); const geode::SolidMeshColocation3D colocation_inspector{ *solid }; - OPENGEODE_EXCEPTION( !colocation_inspector.mesh_has_colocated_points(), - "[Test] Solid has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !colocation_inspector.mesh_has_colocated_points(), + "Solid has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( colocation_inspector.colocated_points_groups().nb_issues() == 0, - "[Test] Solid has more colocated points than it should." ); + "Solid has more colocated points than it should." ); } void check_colocation() @@ -65,39 +66,41 @@ void check_colocation() 6, geode::Point3D{ { 5. + geode::GLOBAL_EPSILON / 1.1, 2., 1. } } ); const geode::SolidMeshColocation3D colocation_inspector{ *solid }; - OPENGEODE_EXCEPTION( colocation_inspector.mesh_has_colocated_points(), - "[Test] Solid doesn't have colocated points whereas it should have " + geode::OpenGeodeInspectorInspectorException::test( + colocation_inspector.mesh_has_colocated_points(), + "Solid doesn't have colocated points whereas it should have " "several." ); const auto colocated_points_groups = colocation_inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] Solid has wrong number of colocated groups of points." ); + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "Solid has wrong number of colocated groups of points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] Solid has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "Solid has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] Solid has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "Solid has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == second_colocated_points_group || colocated_points_groups.issues()[1] == first_colocated_points_group, - "[Test] Solid has wrong second colocated points group." ); + "Solid has wrong second colocated points group." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_colocation(); check_colocation(); diff --git a/tests/inspector/test-solid-degeneration.cpp b/tests/inspector/test-solid-degeneration.cpp index 1cd4661f..ddba1193 100644 --- a/tests/inspector/test-solid-degeneration.cpp +++ b/tests/inspector/test-solid-degeneration.cpp @@ -46,11 +46,12 @@ void check_non_degeneration() builder->create_tetrahedron( { 0, 1, 4, 2 } ); const geode::SolidMeshDegeneration3D degeneration_inspector{ *solid }; - OPENGEODE_EXCEPTION( !degeneration_inspector.is_mesh_degenerated(), - "[Test] Solid is shown degenerated whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !degeneration_inspector.is_mesh_degenerated(), + "Solid is shown degenerated whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 0, - "[Test] Solid has more degenerated edges than it should." ); + "Solid has more degenerated edges than it should." ); } void check_degeneration_by_colocalisation() @@ -70,14 +71,16 @@ void check_degeneration_by_colocalisation() solid->enable_edges(); const geode::SolidMeshDegeneration3D degeneration_inspector{ *solid }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] Solid is shown not degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "Solid is shown not degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] Solid has wrong number of degenerated edges." ); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == solid->edges().edge_from_vertices( { 1, 4 } ), - "[Test] Solid has wrong degenerated edges." ); + "Solid has wrong number of degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == solid->edges().edge_from_vertices( { 1, 4 } ), + "Solid has wrong degenerated edges." ); } void check_degeneration_by_point_multiple_presence() @@ -95,21 +98,23 @@ void check_degeneration_by_point_multiple_presence() solid->enable_edges(); const geode::SolidMeshDegeneration3D degeneration_inspector{ *solid }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] Solid is not shown degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "Solid is not shown degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] Solid has the wrong number of degenerated edges." ); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == solid->edges().edge_from_vertices( { 1, 1 } ), - "[Test] Solid shows the wrong degenerated edges." ); + "Solid has the wrong number of degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == solid->edges().edge_from_vertices( { 1, 1 } ), + "Solid shows the wrong degenerated edges." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_degeneration(); check_degeneration_by_colocalisation(); check_degeneration_by_point_multiple_presence(); diff --git a/tests/inspector/test-solid-manifold.cpp b/tests/inspector/test-solid-manifold.cpp index 4d0ecece..64062fdb 100644 --- a/tests/inspector/test-solid-manifold.cpp +++ b/tests/inspector/test-solid-manifold.cpp @@ -48,11 +48,12 @@ void check_vertex_manifold() builder->set_polyhedron_adjacent( { 1, 1 }, 0 ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( manifold_inspector.mesh_vertices_are_manifold(), - "[Test] Solid is shown non-manifold whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + manifold_inspector.mesh_vertices_are_manifold(), + "Solid is shown non-manifold whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().nb_issues() == 0, - "[Test] Solid has more non manifold vertices than it should." ); + "Solid has more non manifold vertices than it should." ); } void check_vertex_non_manifold() @@ -71,14 +72,15 @@ void check_vertex_non_manifold() builder->create_tetrahedron( { 5, 4, 6, 3 } ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( !manifold_inspector.mesh_vertices_are_manifold(), - "[Test] Solid is shown manifold whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !manifold_inspector.mesh_vertices_are_manifold(), + "Solid is shown manifold whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().nb_issues() == 1, - "[Test] Solid has wrong number of non manifold vertices." ); - OPENGEODE_EXCEPTION( + "Solid has wrong number of non manifold vertices." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().issues()[0] == 3, - "[Test] Solid shows wrong non manifold vertex id." ); + "Solid shows wrong non manifold vertex id." ); } void check_edge_manifold() @@ -97,11 +99,12 @@ void check_edge_manifold() builder->set_polyhedron_adjacent( { 1, 1 }, 0 ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( manifold_inspector.mesh_edges_are_manifold(), - "[Test] Solid is shown non-manifold whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + manifold_inspector.mesh_edges_are_manifold(), + "Solid is shown non-manifold whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_edges().nb_issues() == 0, - "[Test] Solid has more non manifold edges than it should." ); + "Solid has more non manifold edges than it should." ); } void check_edge_non_manifold() @@ -119,15 +122,17 @@ void check_edge_non_manifold() builder->create_tetrahedron( { 5, 4, 2, 3 } ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( !manifold_inspector.mesh_edges_are_manifold(), - "[Test] Solid is shown manifold whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !manifold_inspector.mesh_edges_are_manifold(), + "Solid is shown manifold whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_edges().nb_issues() == 1, - "[Test] Solid has wrong number of non manifold edges." ); + "Solid has wrong number of non manifold edges." ); const auto non_manifold_e = manifold_inspector.non_manifold_edges(); - OPENGEODE_EXCEPTION( non_manifold_e.issues()[0][0] == 2 - && non_manifold_e.issues()[0][1] == 3, - "[Test] Solid shows wrong non manifold edge id." ); + geode::OpenGeodeInspectorInspectorException::test( + non_manifold_e.issues()[0][0] == 2 + && non_manifold_e.issues()[0][1] == 3, + "Solid shows wrong non manifold edge id." ); } void check_facet_manifold() @@ -144,11 +149,12 @@ void check_facet_manifold() builder->create_tetrahedron( { 1, 4, 2, 3 } ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( manifold_inspector.mesh_facets_are_manifold(), - "[Test] Solid is shown non-manifold whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + manifold_inspector.mesh_facets_are_manifold(), + "Solid is shown non-manifold whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_facets().nb_issues() == 0, - "[Test] Solid has more non manifold facets than it should." ); + "Solid has more non manifold facets than it should." ); } void check_facet_non_manifold() @@ -167,23 +173,24 @@ void check_facet_non_manifold() builder->create_tetrahedron( { 1, 5, 2, 3 } ); const geode::SolidMeshInspector3D manifold_inspector{ *solid }; - OPENGEODE_EXCEPTION( !manifold_inspector.mesh_facets_are_manifold(), - "[Test] Solid is shown manifold whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !manifold_inspector.mesh_facets_are_manifold(), + "Solid is shown manifold whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_facets().nb_issues() == 1, - "[Test] Solid has wrong number of non manifold facets." ); + "Solid has wrong number of non manifold facets." ); const auto non_manifold_f = manifold_inspector.non_manifold_facets(); - OPENGEODE_EXCEPTION( non_manifold_f.issues()[0][0] == 1 - && non_manifold_f.issues()[0][1] == 2 - && non_manifold_f.issues()[0][2] == 3, - "[Test] Solid shows wrong non manifold facet id." ); + geode::OpenGeodeInspectorInspectorException::test( + non_manifold_f.issues()[0][0] == 1 && non_manifold_f.issues()[0][1] == 2 + && non_manifold_f.issues()[0][2] == 3, + "Solid shows wrong non manifold facet id." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_vertex_manifold(); check_vertex_non_manifold(); check_edge_manifold(); diff --git a/tests/inspector/test-solid-negative-elements.cpp b/tests/inspector/test-solid-negative-elements.cpp index 4aa18b53..87b819af 100644 --- a/tests/inspector/test-solid-negative-elements.cpp +++ b/tests/inspector/test-solid-negative-elements.cpp @@ -45,20 +45,22 @@ void check_negative_elements() builder->create_tetrahedron( { 0, 1, 2, 4 } ); const geode::SolidMeshNegativeElements3D inspector{ *solid }; - OPENGEODE_EXCEPTION( inspector.mesh_has_negative_elements(), - "[Test] Solid should have negative elements." ); + geode::OpenGeodeInspectorInspectorException::test( + inspector.mesh_has_negative_elements(), + "Solid should have negative elements." ); const auto issues = inspector.negative_polyhedra(); - OPENGEODE_EXCEPTION( issues.nb_issues() == 1, - "[Test] Solid should have one negative polyhedron." ); - OPENGEODE_EXCEPTION( issues.issues().at( 0 ) == 1, - "[Test] Solid negative polyhedron should be 1." ); + geode::OpenGeodeInspectorInspectorException::test( + issues.nb_issues() == 1, "Solid should have one negative polyhedron." ); + geode::OpenGeodeInspectorInspectorException::test( + issues.issues().at( 0 ) == 1, + "Solid negative polyhedron should be 1." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_negative_elements(); geode::Logger::info( "TEST SUCCESS" ); diff --git a/tests/inspector/test-surface-adjacency.cpp b/tests/inspector/test-surface-adjacency.cpp index 3bd0aff7..e4f15bf6 100644 --- a/tests/inspector/test-surface-adjacency.cpp +++ b/tests/inspector/test-surface-adjacency.cpp @@ -45,12 +45,13 @@ void check_adjacency2D() builder->set_polygon_adjacent( { 1, 0 }, 0 ); const geode::SurfaceMeshAdjacency2D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( !adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Surface has wrong adjacencies when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !adjacency_inspector.mesh_has_wrong_adjacencies(), + "Surface has wrong adjacencies when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 0, - "[Test] Surface has more wrong adjacencies on edges than it should." ); + "Surface has more wrong adjacencies on edges than it should." ); } void check_non_adjacency_no_bijection2D() @@ -71,18 +72,19 @@ void check_non_adjacency_no_bijection2D() builder->set_polygon_adjacent( { 2, 1 }, 1 ); const geode::SurfaceMeshAdjacency2D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Surface should have a wrong adjacency due to non-bijection." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Surface should have a wrong adjacency due to non-bijection." ); + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 1, - "[Test] Surface should have one wrong adjacency due to " + "Surface should have one wrong adjacency due to " "non-bijection." ); const geode::PolygonEdge polygon_edge{ 2, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge, - "[Test] Surface edges show wrong adjacency problems." ); + "Surface edges show wrong adjacency problems." ); } void check_non_adjacency_wrong_edge2D() @@ -100,24 +102,25 @@ void check_non_adjacency_wrong_edge2D() builder->set_polygon_adjacent( { 1, 1 }, 0 ); const geode::SurfaceMeshAdjacency2D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Surface should have wrong adjacencies due to wrong edge for " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Surface should have wrong adjacencies due to wrong edge for " "adjacency." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2, - "[Test] Surface should have two wrong adjacencies due to wrong edge " + "Surface should have two wrong adjacencies due to wrong edge " "for adjacency." ); const geode::PolygonEdge polygon_edge1{ 0, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1, - "[Test] Surface shows wrong first edge with adjacency problems." ); + "Surface shows wrong first edge with adjacency problems." ); const geode::PolygonEdge polygon_edge2{ 1, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2, - "[Test] Surface shows wrong second edge with adjacency problems." ); + "Surface shows wrong second edge with adjacency problems." ); } void check_non_adjacency_inversed_triangle2D() @@ -135,25 +138,26 @@ void check_non_adjacency_inversed_triangle2D() builder->set_polygon_adjacent( { 1, 0 }, 0 ); const geode::SurfaceMeshAdjacency2D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] Surface should have wrong adjacencies due to an inversed " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "Surface should have wrong adjacencies due to an inversed " "triangle." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2, - "[Test] Surface should have two wrong adjacencies due to an inversed " + "Surface should have two wrong adjacencies due to an inversed " "triangle." ); const geode::PolygonEdge polygon_edge1{ 0, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1, - "[Test] Surface shows wrong first edge with adjacency problems due to " + "Surface shows wrong first edge with adjacency problems due to " "an inversed triangle.." ); const geode::PolygonEdge polygon_edge2{ 1, 0 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2, - "[Test] Surface shows wrong second edge with adjacency problems due to " + "Surface shows wrong second edge with adjacency problems due to " "an inversed triangle.." ); } @@ -172,12 +176,13 @@ void check_adjacency3D() builder->set_polygon_adjacent( { 1, 0 }, 0 ); const geode::SurfaceMeshAdjacency3D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( !adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] 3D Surface has wrong adjacencies when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !adjacency_inspector.mesh_has_wrong_adjacencies(), + "3D Surface has wrong adjacencies when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 0, - "[Test] 3D Surface has more wrong adjacencies on edges than it " + "3D Surface has more wrong adjacencies on edges than it " "should." ); } @@ -199,19 +204,20 @@ void check_non_adjacency_no_bijection3D() builder->set_polygon_adjacent( { 2, 1 }, 1 ); const geode::SurfaceMeshAdjacency3D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] 3D Surface should have a wrong adjacency due to " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "3D Surface should have a wrong adjacency due to " "non-bijection." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 1, - "[Test] 3D Surface should have one wrong adjacency due to " + "3D Surface should have one wrong adjacency due to " "non-bijection." ); const geode::PolygonEdge polygon_edge{ 2, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge, - "[Test] 3D Surface edges show wrong adjacency problems." ); + "3D Surface edges show wrong adjacency problems." ); } void check_non_adjacency_wrong_edge3D() @@ -229,24 +235,25 @@ void check_non_adjacency_wrong_edge3D() builder->set_polygon_adjacent( { 1, 1 }, 0 ); const geode::SurfaceMeshAdjacency3D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] 3D Surface should have wrong adjacencies due to wrong edge for " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "3D Surface should have wrong adjacencies due to wrong edge for " "adjacency." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2, - "[Test] 3D Surface should have two wrong adjacencies due to wrong edge " + "3D Surface should have two wrong adjacencies due to wrong edge " "for adjacency." ); const geode::PolygonEdge polygon_edge1{ 0, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1, - "[Test] 3D Surface shows wrong first edge with adjacency problems." ); + "3D Surface shows wrong first edge with adjacency problems." ); const geode::PolygonEdge polygon_edge2{ 1, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2, - "[Test] Surface shows wrong second edge with adjacency problems." ); + "Surface shows wrong second edge with adjacency problems." ); } void check_non_adjacency_inversed_triangle3D() @@ -264,25 +271,26 @@ void check_non_adjacency_inversed_triangle3D() builder->set_polygon_adjacent( { 1, 0 }, 0 ); const geode::SurfaceMeshAdjacency3D adjacency_inspector{ *surface }; - OPENGEODE_EXCEPTION( adjacency_inspector.mesh_has_wrong_adjacencies(), - "[Test] 3D Surface should have wrong adjacencies due to an inversed " + geode::OpenGeodeInspectorInspectorException::test( + adjacency_inspector.mesh_has_wrong_adjacencies(), + "3D Surface should have wrong adjacencies due to an inversed " "triangle." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().nb_issues() == 2, - "[Test] 3D Surface should have two wrong adjacencies due to an " + "3D Surface should have two wrong adjacencies due to an " "inversed triangle." ); const geode::PolygonEdge polygon_edge1{ 0, 1 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[0] == polygon_edge1, - "[Test] 3D Surface shows wrong first edge with adjacency problems due " + "3D Surface shows wrong first edge with adjacency problems due " "to an inversed triangle.." ); const geode::PolygonEdge polygon_edge2{ 1, 0 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( adjacency_inspector.polygon_edges_with_wrong_adjacency().issues()[1] == polygon_edge2, - "[Test] 3D Surface shows wrong second edge with adjacency problems due " + "3D Surface shows wrong second edge with adjacency problems due " "to an inversed triangle.." ); } @@ -290,7 +298,7 @@ int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_adjacency2D(); check_non_adjacency_no_bijection2D(); check_non_adjacency_wrong_edge2D(); diff --git a/tests/inspector/test-surface-colocation.cpp b/tests/inspector/test-surface-colocation.cpp index b86e9a7f..724c1614 100644 --- a/tests/inspector/test-surface-colocation.cpp +++ b/tests/inspector/test-surface-colocation.cpp @@ -41,11 +41,12 @@ void check_non_colocation2D() builder->set_point( 3, geode::Point2D{ { 3., 3. } } ); const geode::SurfaceMeshColocation2D colocation_inspector{ *surface }; - OPENGEODE_EXCEPTION( !colocation_inspector.mesh_has_colocated_points(), - "[Test] Surface has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !colocation_inspector.mesh_has_colocated_points(), + "Surface has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( colocation_inspector.colocated_points_groups().nb_issues() == 0, - "[Test] Surface has more colocated points than it should." ); + "Surface has more colocated points than it should." ); } void check_colocation2D() @@ -64,33 +65,35 @@ void check_colocation2D() 6, geode::Point2D{ { geode::GLOBAL_EPSILON / 1.1, 2. } } ); const geode::SurfaceMeshColocation2D colocation_inspector{ *surface }; - OPENGEODE_EXCEPTION( colocation_inspector.mesh_has_colocated_points(), - "[Test] Surface doesn't have colocated points whereas it should have " + geode::OpenGeodeInspectorInspectorException::test( + colocation_inspector.mesh_has_colocated_points(), + "Surface doesn't have colocated points whereas it should have " "several." ); const auto colocated_points_groups = colocation_inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] Surface has wrong number of colocated groups of " + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "Surface has wrong number of colocated groups of " "points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] Surface has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "Surface has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] Surface has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "Surface has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == first_colocated_points_group || colocated_points_groups.issues()[1] == second_colocated_points_group, - "[Test] Surface has wrong second colocated points group." ); + "Surface has wrong second colocated points group." ); } void check_non_colocation3D() @@ -104,11 +107,12 @@ void check_non_colocation3D() builder->set_point( 3, geode::Point3D{ { 3., 3., 2. } } ); const geode::SurfaceMeshColocation3D colocation_inspector{ *surface }; - OPENGEODE_EXCEPTION( !colocation_inspector.mesh_has_colocated_points(), - "[Test] (3D) Surface has colocated points when it should have none." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !colocation_inspector.mesh_has_colocated_points(), + "(3D) Surface has colocated points when it should have none." ); + geode::OpenGeodeInspectorInspectorException::test( colocation_inspector.colocated_points_groups().nb_issues() == 0, - "[Test] (3D) Surface has more colocated points than it should." ); + "(3D) Surface has more colocated points than it should." ); } void check_colocation3D() @@ -127,40 +131,42 @@ void check_colocation3D() 6, geode::Point3D{ { geode::GLOBAL_EPSILON / 1.1, 2., 1. } } ); const geode::SurfaceMeshColocation3D colocation_inspector{ *surface }; - OPENGEODE_EXCEPTION( colocation_inspector.mesh_has_colocated_points(), - "[Test] (3D) Surface doesn't have colocated points whereas it should " + geode::OpenGeodeInspectorInspectorException::test( + colocation_inspector.mesh_has_colocated_points(), + "(3D) Surface doesn't have colocated points whereas it should " "have several." ); const auto colocated_points_groups = colocation_inspector.colocated_points_groups(); - OPENGEODE_EXCEPTION( colocated_points_groups.nb_issues() == 2, - "[Test] (3D) Surface has wrong number of colocated groups of " + geode::OpenGeodeInspectorInspectorException::test( + colocated_points_groups.nb_issues() == 2, + "(3D) Surface has wrong number of colocated groups of " "points." ); auto nb_colocated_points{ 0 }; for( const auto &group : colocated_points_groups.issues() ) { nb_colocated_points += group.size(); } - OPENGEODE_EXCEPTION( nb_colocated_points == 5, - "[Test] (3D) Surface has wrong number of colocated points." ); + geode::OpenGeodeInspectorInspectorException::test( nb_colocated_points == 5, + "(3D) Surface has wrong number of colocated points." ); const std::vector< geode::index_t > first_colocated_points_group{ 0, 1, 6 }; const std::vector< geode::index_t > second_colocated_points_group{ 3, 5 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[0] == first_colocated_points_group || colocated_points_groups.issues()[0] == second_colocated_points_group, - "[Test] (3D) Surface has wrong first colocated points group." ); - OPENGEODE_EXCEPTION( + "(3D) Surface has wrong first colocated points group." ); + geode::OpenGeodeInspectorInspectorException::test( colocated_points_groups.issues()[1] == first_colocated_points_group || colocated_points_groups.issues()[1] == second_colocated_points_group, - "[Test] (3D) Surface has wrong second colocated points group." ); + "(3D) Surface has wrong second colocated points group." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_colocation2D(); check_colocation2D(); check_non_colocation3D(); diff --git a/tests/inspector/test-surface-curve-intersections.cpp b/tests/inspector/test-surface-curve-intersections.cpp index 1ff5d0e0..bc3cd9e0 100644 --- a/tests/inspector/test-surface-curve-intersections.cpp +++ b/tests/inspector/test-surface-curve-intersections.cpp @@ -73,12 +73,14 @@ void check_intersections2D() const geode::SurfaceCurveIntersections2D intersections_inspector{ *surface, *curve }; - OPENGEODE_EXCEPTION( intersections_inspector.meshes_have_intersections(), - "[Test] 2D Surface and Curve should have intersections." ); + geode::OpenGeodeInspectorInspectorException::test( + intersections_inspector.meshes_have_intersections(), + "2D Surface and Curve should have intersections." ); const auto intersection_result = intersections_inspector.intersecting_elements(); - OPENGEODE_EXCEPTION( intersection_result.nb_issues() == 7, - "[Test] 2D Surface and Curve should have 7 intersecting elements " + geode::OpenGeodeInspectorInspectorException::test( + intersection_result.nb_issues() == 7, + "2D Surface and Curve should have 7 intersecting elements " "pair, get ", intersection_result.nb_issues() ); absl::flat_hash_set< std::pair< geode::index_t, geode::index_t > > answer{ @@ -86,8 +88,9 @@ void check_intersections2D() }; for( const auto& inter : intersection_result.issues() ) { - OPENGEODE_EXCEPTION( answer.contains( inter ), - "[Test] 2D Surface and Curve has at least one wrong intersecting " + geode::OpenGeodeInspectorInspectorException::test( + answer.contains( inter ), + "2D Surface and Curve has at least one wrong intersecting " "elements pair: (triangle = ", inter.first, ", edge = ", inter.second, ")" ); } @@ -134,12 +137,14 @@ void check_intersections3D() const geode::SurfaceCurveIntersections3D intersections_inspector{ *surface, *curve }; - OPENGEODE_EXCEPTION( intersections_inspector.meshes_have_intersections(), - "[Test] 3D Surface and Curve should have intersections." ); + geode::OpenGeodeInspectorInspectorException::test( + intersections_inspector.meshes_have_intersections(), + "3D Surface and Curve should have intersections." ); const auto intersection_result = intersections_inspector.intersecting_elements(); - OPENGEODE_EXCEPTION( intersection_result.nb_issues() == 6, - "[Test] 3D Surface and Curve should have 6 intersecting elements " + geode::OpenGeodeInspectorInspectorException::test( + intersection_result.nb_issues() == 6, + "3D Surface and Curve should have 6 intersecting elements " "pair, get ", intersection_result.nb_issues() ); absl::flat_hash_set< std::pair< geode::index_t, geode::index_t > > answer{ @@ -147,8 +152,9 @@ void check_intersections3D() }; for( const auto& inter : intersection_result.issues() ) { - OPENGEODE_EXCEPTION( answer.contains( inter ), - "[Test] 3D Surface and Curve should have at least one wrong " + geode::OpenGeodeInspectorInspectorException::test( + answer.contains( inter ), + "3D Surface and Curve should have at least one wrong " "intersecting elements pair: (triangle = ", inter.first, ", edge = ", inter.second, ")" ); } @@ -158,7 +164,7 @@ int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_intersections2D(); check_intersections3D(); diff --git a/tests/inspector/test-surface-degeneration.cpp b/tests/inspector/test-surface-degeneration.cpp index f61469ba..2e477841 100644 --- a/tests/inspector/test-surface-degeneration.cpp +++ b/tests/inspector/test-surface-degeneration.cpp @@ -45,11 +45,12 @@ void check_non_degeneration2D() builder->create_triangle( { 2, 1, 3 } ); const geode::SurfaceMeshDegeneration2D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( !degeneration_inspector.is_mesh_degenerated(), - "[Test] Surface is shown degenerated whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !degeneration_inspector.is_mesh_degenerated(), + "Surface is shown degenerated whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 0, - "[Test] Surface has more degenerated edges than it should." ); + "Surface has more degenerated edges than it should." ); } void check_degeneration_by_colocalisation2D() @@ -67,15 +68,17 @@ void check_degeneration_by_colocalisation2D() builder->create_triangle( { 2, 1, 3 } ); const geode::SurfaceMeshDegeneration2D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] Surface is shown not degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "Surface is shown not degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] Surface has wrong number of degenerated edges." ); + "Surface has wrong number of degenerated edges." ); surface->enable_edges(); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == surface->edges().edge_from_vertices( { 1, 3 } ), - "[Test] Surface has wrong degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == surface->edges().edge_from_vertices( { 1, 3 } ), + "Surface has wrong degenerated edges." ); } void check_degeneration_by_point_multiple_presence2D() @@ -91,15 +94,17 @@ void check_degeneration_by_point_multiple_presence2D() builder->create_triangle( { 1, 2, 1 } ); const geode::SurfaceMeshDegeneration2D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] Surface is not shown degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "Surface is not shown degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] Surface has the wrong number of degenerated edges." ); + "Surface has the wrong number of degenerated edges." ); surface->enable_edges(); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == surface->edges().edge_from_vertices( { 1, 1 } ), - "[Test] Surface shows the wrong degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == surface->edges().edge_from_vertices( { 1, 1 } ), + "Surface shows the wrong degenerated edges." ); } void check_non_degeneration3D() @@ -116,11 +121,12 @@ void check_non_degeneration3D() builder->create_triangle( { 2, 1, 3 } ); const geode::SurfaceMeshDegeneration3D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( !degeneration_inspector.is_mesh_degenerated(), - "[Test] (3D) Surface is shown degenerated whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !degeneration_inspector.is_mesh_degenerated(), + "(3D) Surface is shown degenerated whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 0, - "[Test] (3D) Surface has more degenerated edges than it should." ); + "(3D) Surface has more degenerated edges than it should." ); } void check_degeneration_by_colocalisation3D() @@ -138,15 +144,17 @@ void check_degeneration_by_colocalisation3D() builder->create_triangle( { 2, 1, 3 } ); const geode::SurfaceMeshDegeneration3D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] (3D) Surface is shown not degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "(3D) Surface is shown not degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] (3D) Surface has wrong number of degenerated edges." ); + "(3D) Surface has wrong number of degenerated edges." ); surface->enable_edges(); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == surface->edges().edge_from_vertices( { 1, 3 } ), - "[Test] (3D) Surface has wrong degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == surface->edges().edge_from_vertices( { 1, 3 } ), + "(3D) Surface has wrong degenerated edges." ); } void check_degeneration_by_point_multiple_presence3D() @@ -162,22 +170,24 @@ void check_degeneration_by_point_multiple_presence3D() builder->create_triangle( { 1, 2, 1 } ); const geode::SurfaceMeshDegeneration3D degeneration_inspector{ *surface }; - OPENGEODE_EXCEPTION( degeneration_inspector.is_mesh_degenerated(), - "[Test] (3D) Surface is not shown degenerated whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.is_mesh_degenerated(), + "(3D) Surface is not shown degenerated whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( degeneration_inspector.degenerated_edges().nb_issues() == 1, - "[Test] (3D) Surface has the wrong number of degenerated edges." ); + "(3D) Surface has the wrong number of degenerated edges." ); surface->enable_edges(); - OPENGEODE_EXCEPTION( degeneration_inspector.degenerated_edges().issues()[0] - == surface->edges().edge_from_vertices( { 1, 1 } ), - "[Test] (3D) Surface shows the wrong degenerated edges." ); + geode::OpenGeodeInspectorInspectorException::test( + degeneration_inspector.degenerated_edges().issues()[0] + == surface->edges().edge_from_vertices( { 1, 1 } ), + "(3D) Surface shows the wrong degenerated edges." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_non_degeneration2D(); check_degeneration_by_colocalisation2D(); check_degeneration_by_point_multiple_presence2D(); diff --git a/tests/inspector/test-surface-intersections.cpp b/tests/inspector/test-surface-intersections.cpp index 393d70c2..78c0f067 100644 --- a/tests/inspector/test-surface-intersections.cpp +++ b/tests/inspector/test-surface-intersections.cpp @@ -49,11 +49,13 @@ void check_intersections2D() builder->set_polygon_adjacent( { 2, 0 }, 1 ); const geode::SurfaceMeshIntersections2D intersections_inspector{ *surface }; - OPENGEODE_EXCEPTION( intersections_inspector.mesh_has_self_intersections(), - "[Test] 2D Surface should have intersections." ); + geode::OpenGeodeInspectorInspectorException::test( + intersections_inspector.mesh_has_self_intersections(), + "2D Surface should have intersections." ); const auto inspection = intersections_inspector.intersecting_elements(); - OPENGEODE_EXCEPTION( inspection.nb_issues() == 3, - "[Test] 2D Surface should have 3 intersecting elements pair." ); + geode::OpenGeodeInspectorInspectorException::test( + inspection.nb_issues() == 3, + "2D Surface should have 3 intersecting elements pair." ); bool right_intersections{ true }; const auto &triangles_inter = inspection.issues(); if( absl::c_find( triangles_inter, std::make_pair( 2u, 0u ) ) @@ -71,8 +73,8 @@ void check_intersections2D() { right_intersections = false; } - OPENGEODE_EXCEPTION( right_intersections, - "[Test] 2D Surface has wrong intersecting elements pairs." ); + geode::OpenGeodeInspectorInspectorException::test( right_intersections, + "2D Surface has wrong intersecting elements pairs." ); } void check_intersections3D() @@ -100,11 +102,13 @@ void check_intersections3D() builder->set_polygon_adjacent( { 3, 0 }, 2 ); const geode::SurfaceMeshIntersections3D intersections_inspector{ *surface }; - OPENGEODE_EXCEPTION( intersections_inspector.mesh_has_self_intersections(), - "[Test] 3D Surface should have intersections." ); + geode::OpenGeodeInspectorInspectorException::test( + intersections_inspector.mesh_has_self_intersections(), + "3D Surface should have intersections." ); const auto inspection = intersections_inspector.intersecting_elements(); - OPENGEODE_EXCEPTION( inspection.nb_issues() == 2, - "[Test] 3D Surface should have 2 intersecting elements pair, not ", + geode::OpenGeodeInspectorInspectorException::test( + inspection.nb_issues() == 2, + "3D Surface should have 2 intersecting elements pair, not ", inspection.nb_issues(), "." ); bool right_intersections{ true }; const auto &triangles_inter = inspection.issues(); @@ -118,15 +122,15 @@ void check_intersections3D() { right_intersections = false; } - OPENGEODE_EXCEPTION( right_intersections, - "[Test] 3D Surface has wrong intersecting elements pairs." ); + geode::OpenGeodeInspectorInspectorException::test( right_intersections, + "3D Surface has wrong intersecting elements pairs." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_intersections2D(); check_intersections3D(); diff --git a/tests/inspector/test-surface-manifold.cpp b/tests/inspector/test-surface-manifold.cpp index a57fb3af..23fa4a11 100644 --- a/tests/inspector/test-surface-manifold.cpp +++ b/tests/inspector/test-surface-manifold.cpp @@ -47,11 +47,12 @@ void check_vertex_manifold2D() builder->set_polygon_adjacent( { 1, 2 }, 0 ); const geode::SurfaceMeshVertexManifold2D manifold_inspector{ *surface }; - OPENGEODE_EXCEPTION( manifold_inspector.mesh_vertices_are_manifold(), - "[Test] Surface is shown non-manifold whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + manifold_inspector.mesh_vertices_are_manifold(), + "Surface is shown non-manifold whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().nb_issues() == 0, - "[Test] Surface has more non manifold vertices than it should." ); + "Surface has more non manifold vertices than it should." ); } void check_vertex_non_manifold2D() @@ -68,14 +69,15 @@ void check_vertex_non_manifold2D() builder->create_triangle( { 1, 3, 4 } ); const geode::SurfaceMeshVertexManifold2D manifold_inspector{ *surface }; - OPENGEODE_EXCEPTION( !manifold_inspector.mesh_vertices_are_manifold(), - "[Test] Surface vertices are shown manifold whereas one is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !manifold_inspector.mesh_vertices_are_manifold(), + "Surface vertices are shown manifold whereas one is not." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().nb_issues() == 1, - "[Test] Surface has wrong number of non manifold vertices." ); - OPENGEODE_EXCEPTION( + "Surface has wrong number of non manifold vertices." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_vertices().issues()[0] == 1, - "[Test] Surface shows wrong non manifold vertex id." ); + "Surface shows wrong non manifold vertex id." ); } void check_edge_manifold2D() @@ -97,11 +99,12 @@ void check_edge_manifold2D() builder->set_polygon_adjacent( { 2, 2 }, 1 ); const geode::SurfaceMeshEdgeManifold2D manifold_inspector{ *surface }; - OPENGEODE_EXCEPTION( manifold_inspector.mesh_edges_are_manifold(), - "[Test] Surface is shown non-manifold through edges whereas it is." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + manifold_inspector.mesh_edges_are_manifold(), + "Surface is shown non-manifold through edges whereas it is." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_edges().nb_issues() == 0, - "[Test] Surface has more non manifold edges than it should." ); + "Surface has more non manifold edges than it should." ); } void check_edge_non_manifold2D() @@ -122,22 +125,23 @@ void check_edge_non_manifold2D() builder->set_polygon_adjacent( { 2, 2 }, 0 ); const geode::SurfaceMeshEdgeManifold2D manifold_inspector{ *surface }; - OPENGEODE_EXCEPTION( !manifold_inspector.mesh_edges_are_manifold(), - "[Test] Surface is shown manifold through edges whereas it is not." ); - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( + !manifold_inspector.mesh_edges_are_manifold(), + "Surface is shown manifold through edges whereas it is not." ); + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_edges().nb_issues() == 1, - "[Test] Surface has wrong number of non manifold edges." ); + "Surface has wrong number of non manifold edges." ); const std::array< geode::index_t, 2 > pt1_pt2_edge{ 1, 2 }; - OPENGEODE_EXCEPTION( + geode::OpenGeodeInspectorInspectorException::test( manifold_inspector.non_manifold_edges().issues()[0] == pt1_pt2_edge, - "[Test] Surface edges are shown non manifold whereas they are." ); + "Surface edges are shown non manifold whereas they are." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_vertex_manifold2D(); check_vertex_non_manifold2D(); check_edge_manifold2D(); diff --git a/tests/inspector/test-surface-negative-elements.cpp b/tests/inspector/test-surface-negative-elements.cpp index 5a4c5af8..7cf3678c 100644 --- a/tests/inspector/test-surface-negative-elements.cpp +++ b/tests/inspector/test-surface-negative-elements.cpp @@ -44,20 +44,21 @@ void check_negative_elements() builder->create_triangle( { 2, 3, 1 } ); const geode::SurfaceMeshNegativeElements2D inspector{ *surface }; - OPENGEODE_EXCEPTION( inspector.mesh_has_negative_elements(), - "[Test] Surface should have negative elements." ); + geode::OpenGeodeInspectorInspectorException::test( + inspector.mesh_has_negative_elements(), + "Surface should have negative elements." ); const auto issues = inspector.negative_polygons(); - OPENGEODE_EXCEPTION( issues.nb_issues() == 1, - "[Test] Surface should have 1 negative element." ); - OPENGEODE_EXCEPTION( issues.issues().at( 0 ) == 1, - "[Test] Surface negative element should be 1." ); + geode::OpenGeodeInspectorInspectorException::test( + issues.nb_issues() == 1, "Surface should have 1 negative element." ); + geode::OpenGeodeInspectorInspectorException::test( + issues.issues().at( 0 ) == 1, "Surface negative element should be 1." ); } int main() { try { - geode::InspectorInspectorLibrary::initialize(); + geode::OpenGeodeInspectorInspectorLibrary::initialize(); check_negative_elements(); geode::Logger::info( "TEST SUCCESS" );