From b3911eb17111d4d93aa8c136e77460d69d92e75a Mon Sep 17 00:00:00 2001 From: Francois Bonneau Date: Fri, 12 Jan 2024 17:42:02 +0100 Subject: [PATCH] try fix python tests --- bindings/python/src/inspector/information.h | 32 +- bindings/python/tests/CMakeLists.txt | 154 ++-- bindings/python/tests/test-py-brep.py | 663 +++++------------- .../tests/test-py-edgedcurve-colocation.py | 20 +- .../tests/test-py-edgedcurve-degeneration.py | 12 +- .../tests/test-py-pointset-colocation.py | 18 +- bindings/python/tests/test-py-section.py | 344 ++++----- .../python/tests/test-py-solid-adjacency.py | 20 +- .../python/tests/test-py-solid-colocation.py | 8 +- .../tests/test-py-solid-degeneration.py | 10 +- .../python/tests/test-py-solid-manifold.py | 18 +- .../python/tests/test-py-surface-adjacency.py | 36 +- .../tests/test-py-surface-colocation.py | 16 +- .../test-py-surface-curve-intersections.py | 4 +- .../tests/test-py-surface-degeneration.py | 20 +- .../tests/test-py-surface-intersections.py | 8 +- .../python/tests/test-py-surface-manifold.py | 10 +- tests/inspector/test-brep.cpp | 4 +- tests/inspector/test-section.cpp | 43 -- tests/inspector/test-solid-adjacency.cpp | 22 +- 20 files changed, 531 insertions(+), 931 deletions(-) diff --git a/bindings/python/src/inspector/information.h b/bindings/python/src/inspector/information.h index dc3e6b11..f9fb83b6 100644 --- a/bindings/python/src/inspector/information.h +++ b/bindings/python/src/inspector/information.h @@ -26,14 +26,32 @@ namespace geode { + template < typename ProblemType > + void do_define_information( + pybind11::module& module, const std::string& typestr ) + { + using InspectionIssues = geode::InspectionIssues< ProblemType >; + const auto name = absl::StrCat( "InspectionIssues", typestr ); + pybind11::class_< InspectionIssues >( module, name.c_str() ) + .def_readwrite( "description", &InspectionIssues::description ) + .def_readwrite( "problems", &InspectionIssues::problems ) + .def_readwrite( "messages", &InspectionIssues::messages ) + .def( "number", &InspectionIssues::number ) + .def( "string", &InspectionIssues::string ); + } void define_information( pybind11::module& module ) { - // pybind11::class_< InspectionIssues >( module, "InspectionIssues" ) - // // .def( pybind11::init<>() ) - // .def_readwrite( "description", &InspectionIssues::description ) - // .def_readwrite( "problems", &InspectionIssues::problems ) - // .def_readwrite( "messages", &InspectionIssues::messages ) - // .def( "number", &InspectionIssues::number ) - // .def( "string", &InspectionIssues::string ); + do_define_information< index_t >( module, "Index" ); + do_define_information< std::vector< index_t > >( + module, "VectorIndex" ); + do_define_information< PolyhedronFacet >( module, "PolyhedronFacet" ); + do_define_information< std::array< index_t, 2 > >( + module, "ArrayIndex2" ); + do_define_information< PolyhedronFacetVertices >( + module, "PolyhedronFacetVertices" ); + do_define_information< PolygonEdge >( module, "PolygonEdge" ); + do_define_information< std::pair< index_t, index_t > >( + module, "PairIndex" ); + do_define_information< uuid >( module, "UUID" ); } } // namespace geode diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt index 948a49d1..8baaad94 100644 --- a/bindings/python/tests/CMakeLists.txt +++ b/bindings/python/tests/CMakeLists.txt @@ -18,80 +18,80 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# add_geode_python_test( -# SOURCE "test-py-brep.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-section.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-edgedcurve-colocation.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-edgedcurve-degeneration.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-pointset-colocation.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-solid-colocation.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-solid-degeneration.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-adjacency.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-colocation.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-degeneration.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-intersections.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-curve-intersections.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) -# -# add_geode_python_test( -# SOURCE "test-py-surface-manifold.py" -# DEPENDENCIES -# ${PROJECT_NAME}::py_inspector -# ) \ No newline at end of file + add_geode_python_test( + SOURCE "test-py-brep.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-section.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-edgedcurve-colocation.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-edgedcurve-degeneration.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-pointset-colocation.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-solid-colocation.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-solid-degeneration.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-adjacency.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-colocation.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-degeneration.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-intersections.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-curve-intersections.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) + + add_geode_python_test( + SOURCE "test-py-surface-manifold.py" + DEPENDENCIES + ${PROJECT_NAME}::py_inspector + ) \ No newline at end of file diff --git a/bindings/python/tests/test-py-brep.py b/bindings/python/tests/test-py-brep.py index 8327bff1..9f8c64d5 100644 --- a/bindings/python/tests/test-py-brep.py +++ b/bindings/python/tests/test-py-brep.py @@ -24,567 +24,276 @@ 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 import opengeode_inspector_py_inspector as inspector -def check_components_linking(brep_inspector): - # nb_unlinked_corners = brep_inspector.nb_corners_not_linked_to_a_unique_vertex() - # print("There are ", nb_unlinked_corners, - # " corners not linked to a unique vertex.") - # nb_unlinked_lines = brep_inspector.nb_lines_meshed_but_not_linked_to_unique_vertices() - # print("There are ", nb_unlinked_lines, - # " lines meshed but not linked to unique vertices.") - # nb_unlinked_surfaces = brep_inspector.nb_surfaces_meshed_but_not_linked_to_unique_vertices() - # print("There are ", nb_unlinked_surfaces, - # " surfaces meshed but not linked to unique vertices.") - # nb_unlinked_blocks = brep_inspector.nb_blocks_meshed_but_not_linked_to_unique_vertices() - # print("There are ", nb_unlinked_blocks, - # " blocks meshed but not linked to unique vertices.") - nb_unlinked_uv = len( - brep_inspector.unique_vertices_not_linked_to_a_component_vertex() - ) - print( - "There are ", - nb_unlinked_uv, - " unique vertices not linked to a component mesh vertex.", - ) - return nb_unlinked_uv - - -# return nb_unlinked_blocks + nb_unlinked_surfaces + nb_unlinked_lines + nb_unlinked_corners + nb_unlinked_uv - - -def check_unique_vertices_colocation(brep_inspector): - nb_unique_vertices_linked_to_different_points = ( - brep_inspector.nb_unique_vertices_linked_to_different_points() - ) - print( - "There are ", - nb_unique_vertices_linked_to_different_points, - " vertices linked to different points in space.", - ) - nb_colocated_unique_vertices = brep_inspector.nb_colocated_unique_vertices() - print( - "There are ", - nb_colocated_unique_vertices, - " vertices linked to different points in space.", - ) - return nb_unique_vertices_linked_to_different_points + nb_colocated_unique_vertices - - -def check_invalid_components_topology_unique_vertices(brep_inspector): - invalid_components_unique_vertices = ( - brep_inspector.invalid_components_topology_unique_vertices() - ) - print( - "There are ", - len(invalid_components_unique_vertices), - " vertices with invalid components.", - ) - for vertex_index in invalid_components_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " has invalid components.", - ) - return len(invalid_components_unique_vertices) - - -def check_multiple_corners_unique_vertices(brep_inspector): - multiple_corners_unique_vertices = brep_inspector.multiple_corners_unique_vertices() - print( - "There are ", - len(multiple_corners_unique_vertices), - " vertices with multiple corners.", - ) - for vertex_index in multiple_corners_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is associated to multiple corners.", - ) - return len(multiple_corners_unique_vertices) - - -def check_multiple_internals_corner_vertices(brep_inspector): - multiple_internals_corner_vertices = ( - brep_inspector.multiple_internals_corner_vertices() - ) - print( - "There are ", - len(multiple_internals_corner_vertices), - " vertices with multiple internals.", - ) - for vertex_index in multiple_internals_corner_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is a corner associated with multiple embeddings.", - ) - return len(multiple_internals_corner_vertices) - - -def check_not_internal_nor_boundary_corner_vertices(brep_inspector): - not_internal_nor_boundary_corner_vertices = ( - brep_inspector.not_internal_nor_boundary_corner_vertices() - ) - print( - "There are ", - len(not_internal_nor_boundary_corner_vertices), - " corner vertices with no boundary nor internal property.", - ) - for vertex_index in not_internal_nor_boundary_corner_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is neither internal nor a boundary.", - ) - return len(not_internal_nor_boundary_corner_vertices) - - -def check_line_corners_without_boundary_status(brep_inspector): - line_corners_without_boundary_status = ( - brep_inspector.line_corners_without_boundary_status() - ) - print( - "There are ", - len(line_corners_without_boundary_status), - " corner vertices part of a line but not its boundary.", - ) - for vertex_index in line_corners_without_boundary_status: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is a corner but has a line for which it is not a boundary.", - ) - return len(line_corners_without_boundary_status) - - -def check_part_of_not_boundary_nor_internal_line_unique_vertices(brep_inspector): - part_of_not_boundary_nor_internal_line_unique_vertices = ( - brep_inspector.part_of_not_boundary_nor_internal_line_unique_vertices() - ) - print( - "There are ", - len(part_of_not_boundary_nor_internal_line_unique_vertices), - " vertices part of a line which is not boundary not internal.", - ) - for vertex_index in part_of_not_boundary_nor_internal_line_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a line which is neither boundary nor internal.", - ) - return len(part_of_not_boundary_nor_internal_line_unique_vertices) - - -def check_part_of_line_with_invalid_internal_topology_unique_vertices(brep_inspector): - part_of_line_with_invalid_internal_topology_unique_vertices = ( - brep_inspector.part_of_line_with_invalid_internal_topology_unique_vertices() - ) - print( - "There are ", - len(part_of_line_with_invalid_internal_topology_unique_vertices), - " vertices part of lines with invalid internal property.", - ) - for vertex_index in part_of_line_with_invalid_internal_topology_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a line with invalid internal properties.", - ) - return len(part_of_line_with_invalid_internal_topology_unique_vertices) - - -def check_part_of_invalid_unique_line_unique_vertices(brep_inspector): - part_of_invalid_unique_line_unique_vertices = ( - brep_inspector.part_of_invalid_unique_line_unique_vertices() - ) - print( - "There are ", - len(part_of_invalid_unique_line_unique_vertices), - " vertices part of a unique line with invalid toplogy.", - ) - for vertex_index in part_of_invalid_unique_line_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a unique line with invalid topological properties.", - ) - return len(part_of_invalid_unique_line_unique_vertices) - +def corners_topological_validity(result, verbose ) : + nb_issues = 0 + corners_not_linked_to_a_unique_vertex = result.corners_not_linked_to_a_unique_vertex + for corner_issue in corners_not_linked_to_a_unique_vertex : + nb_issues += corner_issue.second.number() + corners_not_meshed = result.corners_not_meshed + nb_issues += corners_not_meshed.number() + unique_vertices_liked_to_not_boundary_line_corner = result.unique_vertices_liked_to_not_boundary_line_corner + nb_issues += unique_vertices_liked_to_not_boundary_line_corner.number() + unique_vertices_linked_to_multiple_corners = result.unique_vertices_linked_to_multiple_corners + nb_issues += unique_vertices_linked_to_multiple_corners.number() + unique_vertices_linked_to_multiple_internals_corner = result.unique_vertices_linked_to_multiple_internals_corner + nb_issues += unique_vertices_linked_to_multiple_internals_corner.number() + unique_vertices_linked_to_not_internal_nor_boundary_corner = result.unique_vertices_linked_to_not_internal_nor_boundary_corner + nb_issues += unique_vertices_linked_to_not_internal_nor_boundary_corner.number() + print( "BRep Corners Topology check: ", nb_issues, " issues." ) + if verbose : + print(result.string(), "\n" ) + return nb_issues -def check_part_of_lines_but_not_corner_unique_vertices(brep_inspector): - part_of_lines_but_not_corner_unique_vertices = ( - brep_inspector.part_of_lines_but_not_corner_unique_vertices() - ) - print( - "There are ", - len(part_of_lines_but_not_corner_unique_vertices), - " vertices part of multiple lines but not corner.", - ) - for vertex_index in part_of_lines_but_not_corner_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of multiple lines but is not a corner.", - ) - return len(part_of_lines_but_not_corner_unique_vertices) +def lines_topological_validity(result, verbose): + nb_issues = 0 + lines_not_linked_to_a_unique_vertex = result.lines_not_linked_to_a_unique_vertex + for issue in lines_not_linked_to_a_unique_vertex : + nb_issues += issue.second.number() + lines_not_meshed = result.lines_not_meshed + nb_issues += lines_not_meshed.number() + unique_vertices_linked_to_a_line_with_invalid_embeddings = result.unique_vertices_linked_to_a_line_with_invalid_embeddings + nb_issues += unique_vertices_linked_to_a_line_with_invalid_embeddings.number() + unique_vertices_linked_to_a_single_and_invalid_line = result.unique_vertices_linked_to_a_single_and_invalid_line + nb_issues += unique_vertices_linked_to_a_single_and_invalid_line.number() + unique_vertices_linked_to_not_internal_nor_boundary_line = result.unique_vertices_linked_to_not_internal_nor_boundary_line + nb_issues +=unique_vertices_linked_to_not_internal_nor_boundary_line.number() + unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner = result.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner + nb_issues +=unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner.number() + print("BRep Lines Topology check: ", nb_issues, " issues." ) + if verbose : print(result.string(), "\n" ) + return nb_issues +def surfaces_topological_validity( result, verbose ) : + nb_issues = 0 + surfaces_not_linked_to_a_unique_vertex = result.surfaces_not_linked_to_a_unique_vertex + for issue in surfaces_not_linked_to_a_unique_vertex : + nb_issues += issue.second.number() + surfaces_not_meshed = result.surfaces_not_meshed + nb_issues += surfaces_not_meshed.number() + unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border = result.unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border + nb_issues += unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border.number() + unique_vertices_linked_to_a_single_and_invalid_surface = result.unique_vertices_linked_to_a_single_and_invalid_surface + nb_issues += unique_vertices_linked_to_a_single_and_invalid_surface.number() + unique_vertices_linked_to_not_internal_nor_boundary_surface = result.unique_vertices_linked_to_not_internal_nor_boundary_surface + nb_issues += unique_vertices_linked_to_not_internal_nor_boundary_surface.number() + unique_vertices_linked_to_several_and_invalid_surfaces = result.unique_vertices_linked_to_several_and_invalid_surfaces + nb_issues += unique_vertices_linked_to_several_and_invalid_surfaces.number() + + print("BRep Surfaces Topology check: ", nb_issues, " issues." ) + if verbose : + print(result.string(), "\n" ) + return nb_issues -def check_part_of_not_boundary_nor_internal_surface_unique_vertices(brep_inspector): - part_of_not_boundary_nor_internal_surface_unique_vertices = ( - brep_inspector.part_of_not_boundary_nor_internal_surface_unique_vertices() - ) +def blocks_topological_validity(result, verbose ): + nb_issues = 0 + blocks_not_linked_to_a_unique_vertex = result.blocks_not_linked_to_a_unique_vertex + for issue in blocks_not_linked_to_a_unique_vertex : + nb_issues += issue.second.number() + blocks_not_meshed = result.blocks_not_meshed + nb_issues += blocks_not_meshed.number() + unique_vertices_part_of_two_blocks_and_no_boundary_surface = result.unique_vertices_part_of_two_blocks_and_no_boundary_surface + nb_issues += unique_vertices_part_of_two_blocks_and_no_boundary_surface.number() + unique_vertices_with_incorrect_block_cmvs_count = result.unique_vertices_with_incorrect_block_cmvs_count + nb_issues += unique_vertices_with_incorrect_block_cmvs_count.number() print( - "There are ", - len(part_of_not_boundary_nor_internal_surface_unique_vertices), - " vertices part of a surface which is neither internal nor boundary.", - ) - for vertex_index in part_of_not_boundary_nor_internal_surface_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a surface which is neither internal nor boundary.", - ) - return len(part_of_not_boundary_nor_internal_surface_unique_vertices) + "BRep Blocks Topology check: ", nb_issues, " issues." ) + if verbose : + print(result.string(), "\n" ) + return nb_issues +def launch_topological_validity_checks(result, verbose ): + nb_issues = corners_topological_validity( result.corners, verbose ) + nb_issues += lines_topological_validity( result.lines, verbose ) + nb_issues += surfaces_topological_validity( result.surfaces, verbose ) + nb_issues += blocks_topological_validity( result.blocks, verbose ) + return nb_issues -def check_part_of_surface_with_invalid_internal_topology_unique_vertices( - brep_inspector, -): - part_of_surface_with_invalid_internal_topology_unique_vertices = ( - brep_inspector.part_of_surface_with_invalid_internal_topology_unique_vertices() - ) +def meshes_adjacencies_validity(result, verbose ) : + nb_issues= 0 + surfaces_edges_with_wrong_adjacencies = result.surfaces_edges_with_wrong_adjacencies + for issue in surfaces_edges_with_wrong_adjacencies : + nb_issues += issue.second.number() + blocks_facets_with_wrong_adjacencies = result.blocks_facets_with_wrong_adjacencies + for issue in blocks_facets_with_wrong_adjacencies : + nb_issues += issue.second.number() print( - "There are ", - len(part_of_surface_with_invalid_internal_topology_unique_vertices), - " vertices part of a surface with invalid internal topology.", - ) - for vertex_index in part_of_surface_with_invalid_internal_topology_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a surface with invalid internal topology.", - ) - return len(part_of_surface_with_invalid_internal_topology_unique_vertices) + "BRep meshes adjacencies check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def check_part_of_invalid_unique_surface_unique_vertices(brep_inspector): - part_of_invalid_unique_surface_unique_vertices = ( - brep_inspector.part_of_invalid_unique_surface_unique_vertices() - ) +def meshes_degenerations_validity (result, verbose) : + nb_issues = 0 + elements = result.elements + for degenerated_elements in elements : + nb_issues += degenerated_elements.second.degenerated_edges.number() + nb_issues += degenerated_elements.second.degenerated_polygons.number() + nb_issues += degenerated_elements.second.degenerated_polyhedra.number() print( - "There are ", - len(part_of_invalid_unique_surface_unique_vertices), - " vertices part of a unique surface with invalid topology.", - ) - for vertex_index in part_of_invalid_unique_surface_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a unique surface with invalid topology.", - ) - return len(part_of_invalid_unique_surface_unique_vertices) - + "BRep meshes degenerated elements check: ", nb_issues, " issues." ) + if verbose : print( result.string(), "\n" ) + return nb_issues -def check_part_of_invalid_multiple_surfaces_unique_vertices(brep_inspector): - part_of_invalid_multiple_surfaces_unique_vertices = ( - brep_inspector.part_of_invalid_multiple_surfaces_unique_vertices() - ) +def meshes_intersections_validity( result, verbose ) : + nb_issues = 0 + elements_intersections = result.elements_intersections + nb_issues += elements_intersections.number() print( - "There are ", - len(part_of_invalid_multiple_surfaces_unique_vertices), - " vertices part of invalid multiple surfaces.", - ) - for vertex_index in part_of_invalid_multiple_surfaces_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of invalid multiple surfaces.", - ) - return len(part_of_invalid_multiple_surfaces_unique_vertices) - + "BRep meshes element intersections check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def check_part_of_line_and_not_on_surface_border_unique_vertices(brep_inspector): - part_of_line_and_not_on_surface_border_unique_vertices = ( - brep_inspector.part_of_line_and_not_on_surface_border_unique_vertices() - ) - print( - "There are ", - len(part_of_line_and_not_on_surface_border_unique_vertices), - " vertices part of invalid multiple surfaces.", - ) - for vertex_index in part_of_line_and_not_on_surface_border_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " is part of a line and a surface but is not on the border of the surface mesh.", - ) - return len(part_of_line_and_not_on_surface_border_unique_vertices) +def meshes_manifolds_validity(result, verbose) : + nb_issues= 0 + meshes_non_manifold_vertices = result.meshes_non_manifold_vertices + for issue in meshes_non_manifold_vertices : + nb_issues += issue.second.number() + meshes_non_manifold_edges = result.meshes_non_manifold_edges + for issue in meshes_non_manifold_edges : + nb_issues += issue.second.number() + meshes_non_manifold_facets = result.meshes_non_manifold_facets + for issue in meshes_non_manifold_facets : + nb_issues += issue.second.number() + model_non_manifold_edges = result.model_non_manifold_edges + for issue in model_non_manifold_edges : + nb_issues += issue.second.number() + print("BRep meshes non manifolds check: ", nb_issues, " issues." ) + if verbose : + print(result.string(), "\n" ) + return nb_issues -def check_part_of_invalid_blocks_unique_vertices(brep_inspector): - part_of_invalid_blocks_unique_vertices = ( - brep_inspector.part_of_invalid_blocks_unique_vertices() - ) +def meshes_colocations_validity(result, verbose): + nb_issues = 0 + colocated_points_groups = result.colocated_points_groups + for issue in colocated_points_groups: + nb_issues += issue.second.number() print( - "There are ", - len(part_of_invalid_blocks_unique_vertices), - " vertices with invalid block topology.", - ) - for vertex_index in part_of_invalid_blocks_unique_vertices: - print( - "[Test] Model unique vertex with index ", - vertex_index, - " has invalid blocks topology.", - ) - return len(part_of_invalid_blocks_unique_vertices) - - -def launch_topological_validity_checks(brep_inspector): - nb_invalids = check_multiple_corners_unique_vertices(brep_inspector) - nb_invalids += check_multiple_internals_corner_vertices(brep_inspector) - nb_invalids += check_not_internal_nor_boundary_corner_vertices(brep_inspector) - nb_invalids += check_line_corners_without_boundary_status(brep_inspector) - nb_invalids += check_part_of_not_boundary_nor_internal_line_unique_vertices( - brep_inspector - ) - nb_invalids += check_part_of_invalid_unique_line_unique_vertices(brep_inspector) - nb_invalids += check_part_of_lines_but_not_corner_unique_vertices(brep_inspector) - nb_invalids += check_part_of_not_boundary_nor_internal_surface_unique_vertices( - brep_inspector - ) - nb_invalids += check_part_of_surface_with_invalid_internal_topology_unique_vertices( - brep_inspector - ) - nb_invalids += check_part_of_invalid_unique_surface_unique_vertices(brep_inspector) - nb_invalids += check_part_of_invalid_multiple_surfaces_unique_vertices( - brep_inspector - ) - nb_invalids += check_part_of_line_and_not_on_surface_border_unique_vertices( - brep_inspector - ) - nb_invalids += check_part_of_invalid_blocks_unique_vertices(brep_inspector) - - if nb_invalids != check_invalid_components_topology_unique_vertices(brep_inspector): - raise ValueError("[Test] Wrong number of invalid checks.") - nb_invalids += check_components_linking(brep_inspector) - nb_invalids += check_unique_vertices_colocation(brep_inspector) - return nb_invalids - - -def check_component_meshes_adjacency(brep_inspector): - nb_wrong_adjacencies = 0 - surfaces_wrong_adjacencies = ( - brep_inspector.surfaces_nb_edges_with_wrong_adjacencies() - ) - blocks_wrong_adjacencies = brep_inspector.blocks_nb_facets_with_wrong_adjacencies() - for surf_id in surfaces_wrong_adjacencies: - print( - "There are ", - surfaces_wrong_adjacencies[surf_id], - " edges with wrong adjacencies in mesh with id ", - surf_id.string(), - ) - nb_wrong_adjacencies += surf_id - for block_id in blocks_wrong_adjacencies: - print( - "There are ", - blocks_wrong_adjacencies[block_id], - " facets with wrong adjacencies in mesh with id ", - block_id.string(), - ) - nb_wrong_adjacencies += blocks_wrong_adjacencies[block_id] - return nb_wrong_adjacencies - - -def check_component_meshes_colocation(brep_inspector): - nb_colocated = 0 - components_nb_colocated_points = brep_inspector.components_nb_colocated_points() - for comp_id in components_nb_colocated_points: - print( - "There are ", - components_nb_colocated_points[comp_id], - " colocated vertices in mesh with id ", - comp_id.string(), - ) - nb_colocated += components_nb_colocated_points[comp_id] - return nb_colocated - - -def check_component_meshes_degeneration(brep_inspector): - nb_degenerated = 0 - components_nb_degenerated_elements = ( - brep_inspector.components_nb_degenerated_elements() - ) - for degenerated_id in components_nb_degenerated_elements: - print( - "There are ", - components_nb_degenerated_elements[degenerated_id], - " degenerated edges in mesh with id ", - degenerated_id.string(), - ) - nb_degenerated += components_nb_degenerated_elements[degenerated_id] - return nb_degenerated - + "BRep meshes Colocations check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def check_components_manifold(brep_inspector): +def meshes_unique_vertices_validity(result, verbose): nb_issues = 0 - components_nb_non_manifold_vertices = ( - brep_inspector.component_meshes_nb_non_manifold_vertices() - ) - components_nb_non_manifold_edges = ( - brep_inspector.component_meshes_nb_non_manifold_edges() - ) - components_nb_non_manifold_facets = ( - brep_inspector.component_meshes_nb_non_manifold_facets() - ) - if ( - not components_nb_non_manifold_vertices - and not components_nb_non_manifold_edges - and not components_nb_non_manifold_facets - ): - print("BRep component meshes are manifold.") - for non_manifold_vertices in components_nb_non_manifold_vertices: - print( - "Mesh of surface with uuid ", - non_manifold_vertices.string(), - " has ", - components_nb_non_manifold_vertices[non_manifold_vertices], - " non manifold vertices.", - ) - nb_issues += components_nb_non_manifold_vertices[non_manifold_vertices] - for non_manifold_edges in components_nb_non_manifold_edges: - print( - "Mesh of surface with uuid ", - non_manifold_edges.string(), - " has ", - components_nb_non_manifold_edges[non_manifold_edges], - " non manifold edges.", - ) - nb_issues += components_nb_non_manifold_edges[non_manifold_edges] - for non_manifold_facets in components_nb_non_manifold_facets: - print( - "Mesh of surface with uuid ", - non_manifold_facets.string(), - " has ", - components_nb_non_manifold_facets[non_manifold_facets], - " non manifold facets.", - ) - nb_issues += components_nb_non_manifold_facets[non_manifold_facets] + colocated_unique_vertices_groups = result.colocated_unique_vertices_groups + for issue in colocated_unique_vertices_groups.problems : + nb_issues += issue.size() + unique_vertices_linked_to_different_points = result.unique_vertices_linked_to_different_points + nb_issues += unique_vertices_linked_to_different_points.number() + print("BRep meshes Colocations check: ", nb_issues, " issues." ) + if verbose : + print(result.string(), "\n" ) return nb_issues - -def check_components_intersections(brep_inspector): - nb_surfaces_intersections = brep_inspector.nb_intersecting_surfaces_elements_pair() - if nb_surfaces_intersections == 0: - print("BRep meshes have no intersection problems.") - else: - print( - "There are ", - nb_surfaces_intersections, - " pairs of intersecting triangles in the BRep.", - ) - return nb_surfaces_intersections - - -def launch_component_meshes_validity_checks(brep_inspector): - nb_invalids = check_component_meshes_adjacency(brep_inspector) - nb_invalids += check_component_meshes_colocation(brep_inspector) - nb_invalids += check_component_meshes_degeneration(brep_inspector) - nb_invalids += check_components_manifold(brep_inspector) - nb_invalids += check_components_intersections(brep_inspector) +def launch_component_meshes_validity_checks(result, verbose): + nb_invalids = meshes_adjacencies_validity(result.adjacencies,verbose) + nb_invalids += meshes_degenerations_validity(result.degenerations,verbose) + nb_invalids += meshes_intersections_validity(result.intersections,verbose) + nb_invalids += meshes_manifolds_validity(result.manifolds,verbose) + nb_invalids += meshes_colocations_validity(result.colocation,verbose) + nb_invalids += meshes_unique_vertices_validity(result.unique_vertices_colocation,verbose) return nb_invalids -def check_a1_vertices_topology(): +def check_a1(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.og_brep") brep_inspector = inspector.BRepInspector(model_brep) + result = brep_inspector.inspect_brep() if brep_inspector.brep_topology_is_valid(): print("model_A1 topology is valid.") else: print("model_A1 topology is invalid.") - nb_model_issues = launch_topological_validity_checks(brep_inspector) - if nb_model_issues != 1998: + nb_model_issues = launch_topological_validity_checks(result.topology,verbose) + if nb_model_issues != 267: raise ValueError( - "[Test] model model_A1 should have 1998 unique vertices with topological problems." + "[Test] model model_A1 should have 267 unique vertices with topological problems." ) - nb_component_meshes_issues = launch_component_meshes_validity_checks(brep_inspector) - if nb_component_meshes_issues != 11759: + nb_component_meshes_issues = launch_component_meshes_validity_checks(result.meshes,verbose) + if nb_component_meshes_issues != 13494: raise ValueError( - "[Test] model model_A1_valid should have 11759 component meshes issues (pairs of component meshes triangles intersecting)." + "[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)." ) -def check_a1_valid_vertices_topology(): +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") brep_inspector = inspector.BRepInspector(model_brep) + result = brep_inspector.inspect_brep() if brep_inspector.brep_topology_is_valid(): print("model_A1_valid topology is valid.") else: print("model_A1_valid topology is invalid.") - nb_model_issues = launch_topological_validity_checks(brep_inspector) - if nb_model_issues != 1998: + nb_model_issues = launch_topological_validity_checks(result.topology,verbose) + if nb_model_issues != 267: raise ValueError( - "[Test] model model_A1_valid should have 1998 unique vertices with topological problems." + "[Test] model model_A1_valid should have 267 topological problems." ) - nb_component_meshes_issues = launch_component_meshes_validity_checks(brep_inspector) - if nb_component_meshes_issues != 11759: + nb_component_meshes_issues = launch_component_meshes_validity_checks(result.meshes,verbose) + if nb_component_meshes_issues != 13494: raise ValueError( - "[Test] model model_A1_valid should have 11759 component meshes issues (pairs of component meshes triangles intersecting)." + "[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)." ) -def check_mss_vertices_topology(): +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") brep_inspector = inspector.BRepInspector(model_brep) + result = brep_inspector.inspect_brep() if brep_inspector.brep_topology_is_valid(): print("model mss topology is valid.") else: print("model mss topology is invalid.") - nb_model_issues = launch_topological_validity_checks(brep_inspector) - if nb_model_issues != 17: + nb_model_issues = launch_topological_validity_checks(result.topology,verbose) + if nb_model_issues != 34: raise ValueError( - "[Test] model mss.og_strm should have 17 unique vertices with topological problems." + "[Test] model mss.og_strm should have 34 topological problems." ) - nb_component_meshes_issues = launch_component_meshes_validity_checks(brep_inspector) + nb_component_meshes_issues = launch_component_meshes_validity_checks(result.meshes, verbose) if nb_component_meshes_issues != 0: raise ValueError("[Test] model mss should have no component meshes issues.") -def check_model_D_vertices_topology(): +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") brep_inspector = inspector.BRepInspector(model_brep) + result = brep_inspector.inspect_brep() + if brep_inspector.brep_topology_is_valid(): print("model_D topology is valid.") else: print("model_D topology is invalid.") - nb_model_issues = launch_topological_validity_checks(brep_inspector) - if nb_model_issues != 0: + nb_model_issues = launch_topological_validity_checks(result.topology, verbose) + if nb_model_issues != 5: raise ValueError( - "[Test] model model_D.og_brep should have 0 unique vertices with topological problems." + "[Test] model model_D.og_brep should have 5 topological problems (blocks not meshed)." ) - nb_component_meshes_issues = launch_component_meshes_validity_checks(brep_inspector) + nb_component_meshes_issues = launch_component_meshes_validity_checks(result.meshes, verbose) if nb_component_meshes_issues != 0: raise ValueError("[Test] model_D should have no component meshes issues.") if __name__ == "__main__": inspector.InspectorInspectorLibrary.initialize() - check_a1_vertices_topology() - check_a1_valid_vertices_topology() - check_mss_vertices_topology() - check_model_D_vertices_topology() + verbose = False + check_a1(verbose) + check_a1_valid(verbose) + check_model_mss(verbose) + check_model_D(verbose) diff --git a/bindings/python/tests/test-py-edgedcurve-colocation.py b/bindings/python/tests/test-py-edgedcurve-colocation.py index ddb42950..ad8ada06 100644 --- a/bindings/python/tests/test-py-edgedcurve-colocation.py +++ b/bindings/python/tests/test-py-edgedcurve-colocation.py @@ -43,7 +43,7 @@ def check_non_colocation2D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] EdgedCurve has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] EdgedCurve has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -67,15 +67,15 @@ def check_colocation2D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] EdgedCurve doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( - "[Test] EdgedCurve has wrong number of colocated points.") + "[Test] EdgedCurve has wrong number of colocated points groups.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] EdgedCurve has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] EdgedCurve has wrong second colocated points group.") @@ -93,7 +93,7 @@ def check_non_colocation3D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) EdgedCurve has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] (3D) EdgedCurve has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -118,15 +118,15 @@ def check_colocation3D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( - "[Test] (3D) EdgedCurve has wrong number of colocated points.") + "[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] (3D) EdgedCurve has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] (3D) EdgedCurve has wrong second colocated points group.") diff --git a/bindings/python/tests/test-py-edgedcurve-degeneration.py b/bindings/python/tests/test-py-edgedcurve-degeneration.py index 7ee0d179..bc09e680 100644 --- a/bindings/python/tests/test-py-edgedcurve-degeneration.py +++ b/bindings/python/tests/test-py-edgedcurve-degeneration.py @@ -46,7 +46,7 @@ def check_non_degeneration2D(): if degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] EdgedCurve is shown degenerated whereas it is not.") - if not degeneration_inspector.nb_degenerated_edges() == 0: + if not degeneration_inspector.degenerated_edges().number() == 0: raise ValueError( "[Test] EdgedCurve has more degenerated edges than it should.") if degeneration_inspector.degenerated_edges(): @@ -70,10 +70,10 @@ def check_degeneration_by_colocalisation2D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] EdgedCurve is shown not degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] EdgedCurve has wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges()[0] == 2: + if not degeneration_inspector.degenerated_edges().problems[0] == 2: raise ValueError("[Test] EdgedCurve has wrong degenerated edges.") @@ -93,7 +93,7 @@ def check_non_degeneration3D(): if degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] (3D) EdgedCurve is shown degenerated whereas it is not.") - if not degeneration_inspector.nb_degenerated_edges() == 0: + if not degeneration_inspector.degenerated_edges().number() == 0: raise ValueError( "[Test] (3D) EdgedCurve has more degenerated edges than it should.") if degeneration_inspector.degenerated_edges(): @@ -118,10 +118,10 @@ def check_degeneration_by_colocalisation3D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] (3D) EdgedCurve is shown not degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] (3D) EdgedCurve has wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges()[0] == 2: + if not degeneration_inspector.degenerated_edges().problems[0] == 2: raise ValueError("[Test] (3D) EdgedCurve has wrong degenerated edges.") diff --git a/bindings/python/tests/test-py-pointset-colocation.py b/bindings/python/tests/test-py-pointset-colocation.py index 991ea8e0..8d901a4e 100644 --- a/bindings/python/tests/test-py-pointset-colocation.py +++ b/bindings/python/tests/test-py-pointset-colocation.py @@ -44,7 +44,7 @@ def check_non_colocation2D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] PointSet has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] PointSet has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -68,15 +68,15 @@ def check_colocation2D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] PointSet doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( - "[Test] PointSet has wrong number of colocated points.") + "[Test] PointSet has wrong number of group of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] PointSet has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] PointSet has wrong second colocated points group.") @@ -94,7 +94,7 @@ def check_non_colocation3D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) PointSet has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.nb_colocated_points_groups().number() == 0: raise ValueError( "[Test] (3D) PointSet has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -119,15 +119,15 @@ def check_colocation3D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) PointSet doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( "[Test] (3D) PointSet has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] (3D) PointSet has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] (3D) PointSet has wrong second colocated points group.") diff --git a/bindings/python/tests/test-py-section.py b/bindings/python/tests/test-py-section.py index 90850104..35b88940 100644 --- a/bindings/python/tests/test-py-section.py +++ b/bindings/python/tests/test-py-section.py @@ -23,253 +23,166 @@ 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 import opengeode_inspector_py_inspector as inspector -def check_components_linking(section_inspector): -# nb_unlinked_corners = section_inspector.nb_corners_not_linked_to_a_unique_vertex() -# print("There are ", nb_unlinked_corners, -# " corners not linked to a unique vertex.") -# nb_unlinked_lines = section_inspector.nb_lines_meshed_but_not_linked_to_unique_vertices() -# print("There are ", nb_unlinked_lines, -# " lines meshed but not linked to unique vertices.") -# nb_unlinked_surfaces = section_inspector.nb_surfaces_meshed_but_not_linked_to_unique_vertices() -# print("There are ", nb_unlinked_surfaces, -# " surfaces meshed but not linked to unique vertices.") - nb_unlinked_uv = len(section_inspector.unique_vertices_not_linked_to_a_component_vertex()) - print("There are ", nb_unlinked_uv, - " unique vertices not linked to a component mesh vertex.") - return nb_unlinked_uv -# return nb_unlinked_corners + nb_unlinked_lines + nb_unlinked_surfaces + nb_unlinked_uv - - -def check_unique_vertices_colocation(section_inspector): - nb_unique_vertices_linked_to_different_points = section_inspector.nb_unique_vertices_linked_to_different_points() - print("There are ", nb_unique_vertices_linked_to_different_points, - " vertices linked to different points in space.") - nb_colocated_unique_vertices = section_inspector.nb_colocated_unique_vertices() - print("There are ", nb_colocated_unique_vertices, - " vertices linked to different points in space.") - return nb_unique_vertices_linked_to_different_points + nb_colocated_unique_vertices - - -def check_invalid_components_topology_unique_vertices(section_inspector): - invalid_components_unique_vertices = section_inspector.invalid_components_topology_unique_vertices() - print("There are ", len(invalid_components_unique_vertices), - " vertices with invalid components.") - for vertex_index in invalid_components_unique_vertices: - print("[Test] Model unique vertex with index ", - vertex_index, " has invalid components.") - return len(invalid_components_unique_vertices) - - -def check_unique_vertices_linked_to_multiple_corners(inspection_result): - unique_vertices_linked_to_multiple_corners = inspection_result.corners.unique_vertices_linked_to_multiple_corners - print("There are ", len(unique_vertices_linked_to_multiple_corners), - " vertices with multiple corners.") - for vertex_index in unique_vertices_linked_to_multiple_corners: - print("[Test] Model unique vertex with index ", - vertex_index, " is associated to multiple corners.") - return len(unique_vertices_linked_to_multiple_corners) - - -def check_unique_vertices_linked_to_multiple_internals_corner(inspection_result): - unique_vertices_linked_to_multiple_internals_corner = inspection_result.corners.unique_vertices_linked_to_multiple_internals_corner - print("There are ", len(unique_vertices_linked_to_multiple_internals_corner), - " vertices with multiple internals.") - for vertex_index in unique_vertices_linked_to_multiple_internals_corner: - print("[Test] Model unique vertex with index ", vertex_index, - " is a corner associated with multiple embeddings.") - return len(unique_vertices_linked_to_multiple_internals_corner) - - -def check_unique_vertices_linked_to_not_internal_nor_boundary_corner(inspection_result): - unique_vertices_linked_to_not_internal_nor_boundary_corner = inspection_result.corners.unique_vertices_linked_to_not_internal_nor_boundary_corner - print("There are ", len(unique_vertices_linked_to_not_internal_nor_boundary_corner), - " corner vertices with no boundary nor internal property.") - for vertex_index in unique_vertices_linked_to_not_internal_nor_boundary_corner: - print("[Test] Model unique vertex with index ", - vertex_index, " is neither internal nor a boundary.") - return len(unique_vertices_linked_to_not_internal_nor_boundary_corner) - - -def check_unique_vertices_liked_to_not_boundary_line_corner(inspection_result): - unique_vertices_liked_to_not_boundary_line_corner = inspection_result.corners.unique_vertices_liked_to_not_boundary_line_corner - print("There are ", len(unique_vertices_liked_to_not_boundary_line_corner), - " corner vertices part of a line but not its boundary.") - for vertex_index in unique_vertices_liked_to_not_boundary_line_corner: - print("[Test] Model unique vertex with index ", vertex_index, - " is a corner but has a line for which it is not a boundary.") - return len(unique_vertices_liked_to_not_boundary_line_corner) - - -def check_unique_vertices_linked_to_not_internal_nor_boundary_line(inspection_result): - unique_vertices_linked_to_not_internal_nor_boundary_line = inspection_result.lines.unique_vertices_linked_to_not_internal_nor_boundary_line - print("There are ", len(unique_vertices_linked_to_not_internal_nor_boundary_line), - " vertices part of a line which is not boundary not internal.") - for vertex_index in unique_vertices_linked_to_not_internal_nor_boundary_line: - print("[Test] Model unique vertex with index ", vertex_index, - " is part of a line which is neither boundary nor internal.") - return len(unique_vertices_linked_to_not_internal_nor_boundary_line) - - -def check_unique_vertices_linked_to_a_line_with_invalid_embeddings(inspection_result): - unique_vertices_linked_to_a_line_with_invalid_embeddings = inspection_result.lines.unique_vertices_linked_to_a_line_with_invalid_embeddings - print("There are ", len(unique_vertices_linked_to_a_line_with_invalid_embeddings), - " vertices part of lines with invalid internal property.") - for vertex_index in unique_vertices_linked_to_a_line_with_invalid_embeddings: - print("[Test] Model unique vertex with index ", vertex_index, - " is part of a line with invalid internal properties.") - return len(unique_vertices_linked_to_a_line_with_invalid_embeddings) - - -def check_unique_vertices_linked_to_a_single_and_invalid_line(inspection_result): - unique_vertices_linked_to_a_single_and_invalid_line = inspection_result.lines.unique_vertices_linked_to_a_single_and_invalid_line - print("There are ", len(unique_vertices_linked_to_a_single_and_invalid_line), - " vertices part of a unique line with invalid toplogy.") - for vertex_index in unique_vertices_linked_to_a_single_and_invalid_line: - print("[Test] Model unique vertex with index ", vertex_index, - " is part of a unique line with invalid topological properties.") - return len(unique_vertices_linked_to_a_single_and_invalid_line) - - -def check_unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner(inspection_result): - unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner = inspection_result.lines.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner - print("There are ", len(unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner), - " vertices part of multiple lines but not corner.") - for vertex_index in unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner: - print("[Test] Model unique vertex with index ", vertex_index, - " is part of multiple lines but is not a corner.") - return len(unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner) - - -def check_unique_vertices_linked_to_a_surface_with_invalid_embbedings(inspection_result): - unique_vertices_linked_to_a_surface_with_invalid_embbedings = inspection_result.surfaces.unique_vertices_linked_to_a_surface_with_invalid_embbedings - print("There are ", len(unique_vertices_linked_to_a_surface_with_invalid_embbedings), - " vertices with invalid surface topology.") - for vertex_index in unique_vertices_linked_to_a_surface_with_invalid_embbedings: - print("[Test] Model unique vertex with index ", - vertex_index, " has invalid surfaces topology.") - return len(unique_vertices_linked_to_a_surface_with_invalid_embbedings) - - -def check_unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border(inspection_result): - unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border = inspection_result.surfaces.unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border - print("There are ", len(unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border), - " vertices part of a line and a surface but not on surface mesh border.") - for vertex_index in unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border: - print("[Test] Model unique vertex with index ", vertex_index, - " is part of a line and a surface but is not on surface mesh border.") - return len(unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border) - - -def launch_topological_validity_checks(section_inspector): - inspection_result = section_inspector.inspect_section() - nb_issues = check_unique_vertices_linked_to_multiple_corners(inpection_result) - nb_issues += check_unique_vertices_linked_to_multiple_internals_corner(inpection_result) - nb_issues += check_unique_vertices_linked_to_not_internal_nor_boundary_corner( - inpection_result) - nb_issues += check_unique_vertices_liked_to_not_boundary_line_corner(inpection_result) - nb_issues += check_unique_vertices_linked_to_not_internal_nor_boundary_line( - inpection_result) - nb_issues += check_unique_vertices_linked_to_a_single_and_invalid_line( - inpection_result) - nb_issues += check_unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner( - inpection_result) - nb_issues += check_unique_vertices_linked_to_a_surface_with_invalid_embbedings( - inpection_result) - nb_issues += check_unique_vertices_linked_to_a_line_with_invalid_embeddings( - inpection_result) - - if nb_issues != check_invalid_components_topology_unique_vertices(section_inspector): - raise ValueError("[Test] Wrong number of invalid checks.") - nb_issues += check_components_linking(section_inspector) - nb_issues += check_unique_vertices_colocation(section_inspector) +def corners_topological_validity( result, verbose ): + nb_issues = 0 + corners_not_linked_to_a_unique_vertex = result.corners_not_linked_to_a_unique_vertex + for corner_issue in corners_not_linked_to_a_unique_vertex : + nb_issues += corner_issue.second.number() + corners_not_meshed = result.corners_not_meshed + nb_issues += corners_not_meshed.number() + unique_vertices_liked_to_not_boundary_line_corner = result.unique_vertices_liked_to_not_boundary_line_corner + nb_issues += unique_vertices_liked_to_not_boundary_line_corner.number() + unique_vertices_linked_to_multiple_corners = result.unique_vertices_linked_to_multiple_corners + nb_issues += unique_vertices_linked_to_multiple_corners.number() + unique_vertices_linked_to_multiple_internals_corner = result.unique_vertices_linked_to_multiple_internals_corner + nb_issues += unique_vertices_linked_to_multiple_internals_corner.number() + unique_vertices_linked_to_not_internal_nor_boundary_corner = result.unique_vertices_linked_to_not_internal_nor_boundary_corner + nb_issues += unique_vertices_linked_to_not_internal_nor_boundary_corner.number() + print( "Section Corners Topology check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) return nb_issues +def lines_topological_validity( result, verbose ): + nb_issues = 0 + lines_not_linked_to_a_unique_vertex = result.lines_not_linked_to_a_unique_vertex + for issue in lines_not_linked_to_a_unique_vertex : + nb_issues += issue.second.number() + lines_not_meshed = result.lines_not_meshed + nb_issues += lines_not_meshed.number() + unique_vertices_linked_to_a_line_with_invalid_embeddings = result.unique_vertices_linked_to_a_line_with_invalid_embeddings + nb_issues += unique_vertices_linked_to_a_line_with_invalid_embeddings.number() + unique_vertices_linked_to_a_single_and_invalid_line = result.unique_vertices_linked_to_a_single_and_invalid_line + nb_issues += unique_vertices_linked_to_a_single_and_invalid_line.number() + unique_vertices_linked_to_not_internal_nor_boundary_line = result.unique_vertices_linked_to_not_internal_nor_boundary_line + nb_issues += unique_vertices_linked_to_not_internal_nor_boundary_line.number() + unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner = result.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner + nb_issues += unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner.number() + print( "Section Lines Topology check: ", nb_issues, " issues." ) + if verbose : print( result.string(), "\n" ) + return nb_issues -def check_component_meshes_adjacency(section_inspector): - nb_wrong_adjacencies = 0 - surfaces_wrong_adjacencies = section_inspector.surfaces_nb_edges_with_wrong_adjacencies() - for surf_id in surfaces_wrong_adjacencies: - print("There are ", surfaces_wrong_adjacencies[surf_id], - " edges with wrong adjacencies in mesh with id ", surf_id.string()) - nb_wrong_adjacencies += surfaces_wrong_adjacencies[surf_id] - return nb_wrong_adjacencies +def surfaces_topological_validity( result, verbose ): + nb_issues = 0 + surfaces_not_linked_to_a_unique_vertex = result.surfaces_not_linked_to_a_unique_vertex + for issue in surfaces_not_linked_to_a_unique_vertex : + nb_issues += issue.second.number() + surfaces_not_meshed = result.surfaces_not_meshed + nb_issues += surfaces_not_meshed.number() + unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border = result.unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border + nb_issues += unique_vertices_linked_to_a_line_but_is_not_on_a_surface_border.number() + unique_vertices_linked_to_a_surface_with_invalid_embbedings = result.unique_vertices_linked_to_a_surface_with_invalid_embbedings + nb_issues += unique_vertices_linked_to_a_surface_with_invalid_embbedings.number() + print( "Section Surfaces Topology check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues +def launch_topological_validity_checks( result, verbose ) : + nb_issues = corners_topological_validity( result.corners, verbose ) + nb_issues += lines_topological_validity( result.lines, verbose ) + nb_issues += surfaces_topological_validity( result.surfaces, verbose ) + return nb_issues -def check_component_meshes_colocation(section_inspector): - nb_colocated = 0 - components_nb_colocated_points = section_inspector.components_nb_colocated_points() - for comp_id in components_nb_colocated_points: - print("There are ", components_nb_colocated_points[comp_id], - " colocated vertices in mesh with id ", comp_id.string()) - nb_colocated += components_nb_colocated_points[comp_id] - return nb_colocated +def meshes_adjacencies_validity( result, verbose ): + nb_issues = 0 + surfaces_edges_with_wrong_adjacencies = result.surfaces_edges_with_wrong_adjacencies + for issue in surfaces_edges_with_wrong_adjacencies : + nb_issues += issue.second.number() + print( "Section meshes adjacencies check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues +def meshes_degenerations_validity( result, verbose ): + nb_issues = 0 + elements = result.elements + for degenerated_elements in elements : + nb_issues += degenerated_elements.second.degenerated_edges.number() + nb_issues += degenerated_elements.second.degenerated_polygons.number() + print("Section meshes degenerated elements check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def check_component_meshes_degeneration(section_inspector): - nb_degenerated = 0 - components_nb_degenerated_elements = section_inspector.components_nb_degenerated_elements() - for comp_id in components_nb_degenerated_elements: - print("There are ", components_nb_degenerated_elements[comp_id], - " degenerated edges in mesh with id ", comp_id.string()) - nb_degenerated += components_nb_degenerated_elements[comp_id] - return nb_degenerated +def meshes_intersections_validity( result, verbose ) : + nb_issues = 0 + elements_intersections = result.elements_intersections + nb_issues += elements_intersections.number() + print( "Section meshes element intersections check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def check_components_manifold(section_inspector): +def meshes_manifolds_validity( result, verbose ): nb_issues = 0 - components_nb_non_manifold_vertices = section_inspector.component_meshes_nb_non_manifold_vertices() - components_nb_non_manifold_edges = section_inspector.component_meshes_nb_non_manifold_edges() - if not components_nb_non_manifold_vertices and not components_nb_non_manifold_edges: - print("BRep component meshes are manifold.") - for non_manifold_vertices in components_nb_non_manifold_vertices: - print("Mesh of surface with uuid ", non_manifold_vertices.string(), " has ", - components_nb_non_manifold_vertices[non_manifold_vertices], " non manifold vertices.") - nb_issues += components_nb_non_manifold_vertices[non_manifold_vertices] - for non_manifold_edges in components_nb_non_manifold_edges: - print("Mesh of surface with uuid ", non_manifold_edges.string(), " has ", - components_nb_non_manifold_edges[non_manifold_edges], " non manifold edges.") - nb_issues += components_nb_non_manifold_edges[non_manifold_edges] + meshes_non_manifold_vertices = result.meshes_non_manifold_vertices + for issue in meshes_non_manifold_vertices : + nb_issues += issue.second.number() + meshes_non_manifold_edges = result.meshes_non_manifold_edges + for issue in meshes_non_manifold_edges : + nb_issues += issue.second.number() + print( "Section meshes non manifolds check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) return nb_issues -def check_components_intersections( section_inspector ): - nb_surfaces_intersections = section_inspector.nb_intersecting_surfaces_elements_pair() - if nb_surfaces_intersections == 0: - print( "Section meshes have no intersection problems." ) - else: - print( "There are ", nb_surfaces_intersections, " pairs of intersecting triangles in the Section." ) - return nb_surfaces_intersections - +def meshes_colocations_validity( result, verbose ): + nb_issues = 0 + colocated_points_groups = result.colocated_points_groups + for issue in colocated_points_groups : + nb_issues += issue.second.number() + print( "Section meshes Colocations check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues -def launch_component_meshes_validity_checks(section_inspector): - nb_invalids = check_component_meshes_adjacency(section_inspector) - nb_invalids += check_component_meshes_colocation(section_inspector) - nb_invalids += check_component_meshes_degeneration(section_inspector) - nb_invalids += check_components_manifold(section_inspector) - return nb_invalids +def meshes_unique_vertices_validity( result, verbose ): + nb_issues = 0 + colocated_unique_vertices_groups = result.colocated_unique_vertices_groups + for issue in colocated_unique_vertices_groups.problems : + nb_issues += issue.size() + unique_vertices_linked_to_different_points = result.unique_vertices_linked_to_different_points + nb_issues += unique_vertices_linked_to_different_points.number() + print("Section unique vertices check: ", nb_issues, " issues." ) + if verbose : + print( result.string(), "\n" ) + return nb_issues +def launch_component_meshes_validity_checks(result, verbose ): + nb_issues = meshes_adjacencies_validity( result.adjacencies, verbose ) + nb_issues = meshes_degenerations_validity( result.degenerations, verbose ) + nb_issues += meshes_intersections_validity( result.intersections, verbose ) + nb_issues += meshes_manifolds_validity( result.manifolds, verbose ) + nb_issues += meshes_colocations_validity( result.meshes_colocation, verbose ) + nb_issues += meshes_unique_vertices_validity( + result.unique_vertices_colocation, verbose ) + return nb_issues -def check_vertical_lines_vertices_topology(): +def check_section(verbose): test_dir = os.path.dirname(__file__) data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data")) model_section = opengeode.load_section( data_dir + "/vertical_lines.og_sctn") section_inspector = inspector.SectionInspector(model_section) + result = section_inspector.inspect_section() if section_inspector.section_topology_is_valid(): print("model vertical_lines topology is valid.") else: print("model vertical_lines topology is invalid.") - nb_issues = launch_topological_validity_checks(section_inspector) + nb_issues = launch_topological_validity_checks(result.topology, verbose) if nb_issues != 0: raise ValueError( "[Test] There should be no topological issues with vertical_lines.og_sctn") - nb_issues = launch_component_meshes_validity_checks(section_inspector) + nb_issues = launch_component_meshes_validity_checks(result.meshes, verbose) if nb_issues != 0: raise ValueError( "[Test] There should be no mesh issues with vertical_lines.og_sctn") @@ -277,4 +190,5 @@ def check_vertical_lines_vertices_topology(): if __name__ == '__main__': inspector.InspectorInspectorLibrary.initialize() - check_vertical_lines_vertices_topology() + 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 81ebe243..82cb267f 100644 --- a/bindings/python/tests/test-py-solid-adjacency.py +++ b/bindings/python/tests/test-py-solid-adjacency.py @@ -48,10 +48,10 @@ def check_adjacency(): if adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Solid shows wrong adjacencies where there are none.") - if not adjacency_inspector.nb_facets_with_wrong_adjacency() == 0: + if not adjacency_inspector.non_manifold_facets().number() == 0: raise ValueError( "[Test] Solid has more wrong adjacencies than it should.") - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency(): + if adjacency_inspector.non_manifold_facets(): raise ValueError( "[Test] Solid facets adjacencies are shown wrong whereas they are not.") @@ -77,11 +77,11 @@ def check_non_adjacency_no_bijection(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Solid should have a wrong adjacency due to non-bijection.") - if adjacency_inspector.nb_facets_with_wrong_adjacency() != 1: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().number() != 1: raise ValueError( "[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()[0] != polyhedron_facet: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[0] != polyhedron_facet: raise ValueError("[Test] Solid facets show wrong adjacency problems.") @@ -103,15 +103,15 @@ def check_non_adjacency_wrong_facet(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError("[Test] Solid should have wrong adjacencies due to wrong facet for " "adjacency.") - if adjacency_inspector.nb_facets_with_wrong_adjacency() != 2: + if adjacency_inspector.nb_facets_with_wrong_adjacency().number() != 2: raise ValueError( "[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()[0] != polyhedron_facet1: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[0] != polyhedron_facet1: raise ValueError( "[Test] Solid shows wrong first facet with adjacency problems.") polyhedron_facet2 = geode.PolyhedronFacet(1, 0) - if adjacency_inspector.polyhedron_facets_with_wrong_adjacency()[1] != polyhedron_facet2: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[1] != polyhedron_facet2: raise ValueError( "[Test] Solid shows wrong second facet with adjacency problems.") @@ -134,15 +134,15 @@ def check_non_adjacency_inversed_tetrahedron(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Solid should have wrong adjacencies due to an inversed triangle.") - if adjacency_inspector.nb_facets_with_wrong_adjacency() != 2: + if adjacency_inspector.nb_facets_with_wrong_adjacency().number() != 2: raise ValueError( "[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()[0] != polyhedron_facet1: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[0] != polyhedron_facet1: raise ValueError( "[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()[1] != polyhedron_facet2: + if adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[1] != polyhedron_facet2: raise ValueError( "[Test] Solid shows wrong second facet with adjacency problems due to an inversed triangle..") diff --git a/bindings/python/tests/test-py-solid-colocation.py b/bindings/python/tests/test-py-solid-colocation.py index 4c29184a..1d7c8498 100644 --- a/bindings/python/tests/test-py-solid-colocation.py +++ b/bindings/python/tests/test-py-solid-colocation.py @@ -44,7 +44,7 @@ def check_non_colocation(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] Solid has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] Solid has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -70,14 +70,14 @@ def check_colocation(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] Solid doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups() == 2: raise ValueError("[Test] Solid has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] Solid has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] Solid has wrong second colocated points group.") diff --git a/bindings/python/tests/test-py-solid-degeneration.py b/bindings/python/tests/test-py-solid-degeneration.py index d311907b..a9ca9574 100644 --- a/bindings/python/tests/test-py-solid-degeneration.py +++ b/bindings/python/tests/test-py-solid-degeneration.py @@ -47,7 +47,7 @@ def check_non_degeneration(): if degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Solid is shown degenerated whereas it is not.") - if not degeneration_inspector.nb_degenerated_edges() == 0: + if not degeneration_inspector.degenerated_edges().number() == 0: raise ValueError( "[Test] Solid has more degenerated edges than it should.") if degeneration_inspector.degenerated_edges(): @@ -73,9 +73,9 @@ def check_degeneration_by_colocalisation(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Solid is shown not degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError("[Test] Solid has wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges()[0] == solid.edges().edge_from_vertices([1, 4]): + if not degeneration_inspector.degenerated_edges().problems[0] == solid.edges().edge_from_vertices([1, 4]): raise ValueError("[Test] Solid has wrong degenerated edges.") @@ -96,10 +96,10 @@ def check_degeneration_by_point_multiple_presence(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Solid is not shown degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] Solid has the wrong number of degenerated edges.") - if not degeneration_inspector.degenerated_edges()[0] == solid.edges().edge_from_vertices([1, 1]): + if not degeneration_inspector.degenerated_edges().problems[0] == solid.edges().edge_from_vertices([1, 1]): raise ValueError("[Test] Solid shows the wrong degenerated edges.") diff --git a/bindings/python/tests/test-py-solid-manifold.py b/bindings/python/tests/test-py-solid-manifold.py index b9eca465..2bc4f89f 100644 --- a/bindings/python/tests/test-py-solid-manifold.py +++ b/bindings/python/tests/test-py-solid-manifold.py @@ -47,7 +47,7 @@ def check_vertex_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if not manifold_inspector.mesh_vertices_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") - if manifold_inspector.nb_non_manifold_vertices() != 0: + if manifold_inspector.non_manifold_vertices().number() != 0: raise ValueError( "[Test] Solid has more non manifold vertices than it should.") if manifold_inspector.non_manifold_vertices(): @@ -72,10 +72,10 @@ def check_vertex_non_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if manifold_inspector.mesh_vertices_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") - if manifold_inspector.nb_non_manifold_vertices() != 1: + if manifold_inspector.non_manifold_vertices().number() != 1: raise ValueError( "[Test] Solid has wrong number of non manifold vertices.") - if manifold_inspector.non_manifold_vertices()[0] != 3: + if manifold_inspector.non_manifold_vertices().problems[0] != 3: raise ValueError("[Test] Solid shows wrong non manifold vertex id.") @@ -96,7 +96,7 @@ def check_edge_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if not manifold_inspector.mesh_edges_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") - if manifold_inspector.nb_non_manifold_edges() != 0: + if manifold_inspector.non_manifold_edges().number() != 0: raise ValueError( "[Test] Solid has more non manifold edges than it should.") if manifold_inspector.non_manifold_edges(): @@ -120,10 +120,10 @@ def check_edge_non_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if manifold_inspector.mesh_edges_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") - if manifold_inspector.nb_non_manifold_edges() != 1: + if manifold_inspector.non_manifold_edges().number() != 1: raise ValueError( "[Test] Solid has wrong number of non manifold edges.") - non_manifold_e = manifold_inspector.non_manifold_edges() + non_manifold_e = manifold_inspector.non_manifold_edges().problems if non_manifold_e[0][0] != 2 or non_manifold_e[0][1] != 3: raise ValueError("[Test] Solid shows wrong non manifold edge id.") @@ -143,7 +143,7 @@ def check_facet_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if manifold_inspector.mesh_facets_are_manifold(): raise ValueError("[Test] Solid is shown non-manifold whereas it is.") - if manifold_inspector.nb_non_manifold_facets() != 0: + if manifold_inspector.non_manifold_facets().number() != 0: raise ValueError( "[Test] Solid has more non manifold facets than it should.") if manifold_inspector.non_manifold_facets(): @@ -168,10 +168,10 @@ def check_facet_non_manifold(): manifold_inspector = geode.SolidMeshInspector3D(solid) if manifold_inspector.mesh_facets_are_manifold(): raise ValueError("[Test] Solid is shown manifold whereas it is not.") - if manifold_inspector.nb_non_manifold_facets() != 1: + if manifold_inspector.non_manifold_facets().number() != 1: raise ValueError( "[Test] Solid has wrong number of non manifold facets.") - non_manifold_f = manifold_inspector.non_manifold_facets() + non_manifold_f = manifold_inspector.non_manifold_facets().problems 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.") diff --git a/bindings/python/tests/test-py-surface-adjacency.py b/bindings/python/tests/test-py-surface-adjacency.py index 0b9d5cf1..8a32646e 100644 --- a/bindings/python/tests/test-py-surface-adjacency.py +++ b/bindings/python/tests/test-py-surface-adjacency.py @@ -46,7 +46,7 @@ def check_adjacency2D(): if adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Surface has wrong adjacencies when it should have none.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 0: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 0: raise ValueError( "[Test] Surface has more wrong adjacencies on edges than it should.") if adjacency_inspector.polygon_edges_with_wrong_adjacency(): @@ -73,11 +73,11 @@ def check_non_adjacency_no_bijection2D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Surface should have a wrong adjacency due to non-bijection.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 1: raise ValueError( "[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()[0] == polygon_edge: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge: raise ValueError("[Test] Surface edges show wrong adjacency problems.") def check_non_adjacency_wrong_edge2D(): @@ -97,15 +97,15 @@ def check_non_adjacency_wrong_edge2D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Surface should have wrong adjacencies due to wrong edge for adjacency.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 2: raise ValueError( "[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()[0] == polygon_edge1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge1: raise ValueError( "[Test] Surface shows wrong first edge with adjacency problems.") polygon_edge2 = geode.PolygonEdge(1, 1) - if not adjacency_inspector.polygon_edges_with_wrong_adjacency()[1] == polygon_edge2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[1] == polygon_edge2: raise ValueError( "[Test] Surface shows wrong second edge with adjacency problems.") @@ -126,15 +126,15 @@ def check_non_adjacency_inversed_triangle2D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] Surface should have wrong adjacencies due to an inversed triangle.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 2: raise ValueError( "[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()[0] == polygon_edge1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge1: raise ValueError( "[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()[1] == polygon_edge2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[1] == polygon_edge2: raise ValueError( "[Test] Surface shows wrong second edge with adjacency problems due to an inversed triangle..") @@ -155,7 +155,7 @@ def check_adjacency3D(): if adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] 3D Surface has wrong adjacencies when it should have none.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 0: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 0: raise ValueError( "[Test] 3D Surface has more wrong adjacencies on edges than it should.") if adjacency_inspector.polygon_edges_with_wrong_adjacency(): @@ -182,11 +182,11 @@ def check_non_adjacency_no_bijection3D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] 3D Surface should have a wrong adjacency due to non-bijection.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 1: raise ValueError( "[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()[0] == polygon_edge: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge: raise ValueError( "[Test] 3D Surface edges show wrong adjacency problems.") @@ -207,15 +207,15 @@ def check_non_adjacency_wrong_edge3D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] 3D Surface should have wrong adjacencies due to wrong edge for adjacency.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 2: raise ValueError( "[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()[0] == polygon_edge1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge1: raise ValueError( "[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()[1] == polygon_edge2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[1] == polygon_edge2: raise ValueError( "[Test] Surface shows wrong second edge with adjacency problems.") @@ -236,15 +236,15 @@ def check_non_adjacency_inversed_triangle3D(): if not adjacency_inspector.mesh_has_wrong_adjacencies(): raise ValueError( "[Test] 3D Surface should have wrong adjacencies due to an inversed triangle.") - if not adjacency_inspector.nb_edges_with_wrong_adjacency() == 2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().number() == 2: raise ValueError( "[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()[0] == polygon_edge1: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[0] == polygon_edge1: raise ValueError( "[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()[1] == polygon_edge2: + if not adjacency_inspector.polygon_edges_with_wrong_adjacency().problems[1] == polygon_edge2: raise ValueError( "[Test] 3D Surface shows wrong second edge with adjacency problems due to an inversed triangle..") diff --git a/bindings/python/tests/test-py-surface-colocation.py b/bindings/python/tests/test-py-surface-colocation.py index 17ef02a4..0a5ed105 100644 --- a/bindings/python/tests/test-py-surface-colocation.py +++ b/bindings/python/tests/test-py-surface-colocation.py @@ -43,7 +43,7 @@ def check_non_colocation2D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] Surface has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] Surface has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -67,15 +67,15 @@ def check_colocation2D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] Surface doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( "[Test] Surface has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] Surface has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] Surface has wrong second colocated points group.") @@ -93,7 +93,7 @@ def check_non_colocation3D(): if colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) Surface has colocated points when it should have none.") - if not colocation_inspector.nb_colocated_points() == 0: + if not colocation_inspector.colocated_points_groups().number() == 0: raise ValueError( "[Test] (3D) Surface has more colocated points than it should.") if colocation_inspector.colocated_points_groups(): @@ -118,15 +118,15 @@ def check_colocation3D(): if not colocation_inspector.mesh_has_colocated_points(): raise ValueError( "[Test] (3D) Surface doesn't have colocated points whereas it should have several.") - if not colocation_inspector.nb_colocated_points() == 5: + if not colocation_inspector.colocated_points_groups().number() == 2: raise ValueError( "[Test] (3D) Surface has wrong number of colocated points.") first_colocated_points_group = [0, 1, 6] - if not colocation_inspector.colocated_points_groups()[0] == first_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[0] == first_colocated_points_group: raise ValueError( "[Test] (3D) Surface has wrong first colocated points group.") second_colocated_points_group = [3, 5] - if not colocation_inspector.colocated_points_groups()[1] == second_colocated_points_group: + if not colocation_inspector.colocated_points_groups().problems[1] == second_colocated_points_group: raise ValueError( "[Test] (3D) Surface has wrong second colocated points group.") diff --git a/bindings/python/tests/test-py-surface-curve-intersections.py b/bindings/python/tests/test-py-surface-curve-intersections.py index e234a5f8..63892b72 100644 --- a/bindings/python/tests/test-py-surface-curve-intersections.py +++ b/bindings/python/tests/test-py-surface-curve-intersections.py @@ -68,7 +68,7 @@ def check_intersections2D(): intersections_inspector = inspector.SurfaceCurveIntersections2D( surface, curve ) if not intersections_inspector.meshes_have_intersections(): raise ValueError( "[Test] 2D Surface and Curve should have intersections." ) - if not intersections_inspector.nb_intersecting_elements_pair() == 7: + if not intersections_inspector.intersecting_elements().number() == 7: raise ValueError( "[Test] 2D Surface and Curve should have 7 intersecting elements pair." ) def check_intersections3D(): @@ -112,7 +112,7 @@ def check_intersections3D(): intersections_inspector = inspector.SurfaceCurveIntersections3D(surface, curve ) if not intersections_inspector.meshes_have_intersections(): raise ValueError( "[Test] 3D Surface and Curve should have intersections." ) - if not intersections_inspector.nb_intersecting_elements_pair() == 6: + if not intersections_inspector.intersecting_elements().number() == 6: raise ValueError( "[Test] 3D Surface and Curve should have 6 intersecting elements pair." ) if __name__ == '__main__': diff --git a/bindings/python/tests/test-py-surface-degeneration.py b/bindings/python/tests/test-py-surface-degeneration.py index b2022125..94ec3458 100644 --- a/bindings/python/tests/test-py-surface-degeneration.py +++ b/bindings/python/tests/test-py-surface-degeneration.py @@ -46,7 +46,7 @@ def check_non_degeneration2D(): if degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Surface is shown degenerated whereas it is not.") - if not degeneration_inspector.nb_degenerated_edges() == 0: + if not degeneration_inspector.degenerated_edges().number() == 0: raise ValueError( "[Test] Surface has more degenerated edges than it should.") if degeneration_inspector.degenerated_edges(): @@ -70,11 +70,11 @@ def check_degeneration_by_colocalisation2D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Surface is shown not degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] Surface has wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges()[0] == surface.edges().edge_from_vertices([1, 3]): + if not degeneration_inspector.degenerated_edges().problems[0] == surface.edges().edge_from_vertices([1, 3]): raise ValueError("[Test] Surface has wrong degenerated edges.") @@ -93,11 +93,11 @@ def check_degeneration_by_point_multiple_presence2D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] Surface is not shown degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] Surface has the wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges()[0] == surface.edges().edge_from_vertices([1, 1]): + if not degeneration_inspector.degenerated_edges().problems[0] == surface.edges().edge_from_vertices([1, 1]): raise ValueError("[Test] Surface shows the wrong degenerated edges.") @@ -117,7 +117,7 @@ def check_non_degeneration3D(): if degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] (3D) Surface is shown degenerated whereas it is not.") - if not degeneration_inspector.nb_degenerated_edges() == 0: + if not degeneration_inspector.degenerated_edges().number() == 0: raise ValueError( "[Test] (3D) Surface has more degenerated edges than it should.") if degeneration_inspector.degenerated_edges(): @@ -142,11 +142,11 @@ def check_degeneration_by_colocalisation3D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] (3D) Surface is shown not degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] (3D) Surface has wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges()[0] == surface.edges().edge_from_vertices([1, 3]): + if not degeneration_inspector.degenerated_edges().problems[0] == surface.edges().edge_from_vertices([1, 3]): raise ValueError("[Test] (3D) Surface has wrong degenerated edges.") @@ -165,11 +165,11 @@ def check_degeneration_by_point_multiple_presence3D(): if not degeneration_inspector.is_mesh_degenerated(): raise ValueError( "[Test] (3D) Surface is not shown degenerated whereas it is.") - if not degeneration_inspector.nb_degenerated_edges() == 1: + if not degeneration_inspector.degenerated_edges().number() == 1: raise ValueError( "[Test] (3D) Surface has the wrong number of degenerated edges.") surface.enable_edges() - if not degeneration_inspector.degenerated_edges()[0] == surface.edges().edge_from_vertices([1, 1]): + if not degeneration_inspector.degenerated_edges().problems[0] == surface.edges().edge_from_vertices([1, 1]): raise ValueError( "[Test] (3D) Surface shows the wrong degenerated edges.") diff --git a/bindings/python/tests/test-py-surface-intersections.py b/bindings/python/tests/test-py-surface-intersections.py index 16f86a2a..a3a19544 100644 --- a/bindings/python/tests/test-py-surface-intersections.py +++ b/bindings/python/tests/test-py-surface-intersections.py @@ -51,10 +51,10 @@ def check_intersections2D(): surface) if not intersections_inspector.mesh_has_self_intersections(): raise ValueError("[Test] 2D Surface should have intersections.") - if not intersections_inspector.nb_intersecting_elements_pair() == 3: + if not intersections_inspector.intersecting_elements().number() == 3: raise ValueError( "[Test] 2D Surface should have 3 intersecting elements pair.") - triangles_inter = intersections_inspector.intersecting_elements() + triangles_inter = intersections_inspector.intersecting_elements().problems if len(triangles_inter) != 3 or triangles_inter[0][0] != 2 or triangles_inter[0][1] != 0 or triangles_inter[1][0] != 2 or triangles_inter[1][1] != 1 or triangles_inter[2][0] != 0 or triangles_inter[2][1] != 1: raise ValueError( "[Test] 2D Surface has wrong intersecting elements pairs.") @@ -87,11 +87,11 @@ def check_intersections3D(): surface) if not intersections_inspector.mesh_has_self_intersections(): raise ValueError("[Test] 3D Surface should have intersections.") - nb_intersections = intersections_inspector.nb_intersecting_elements_pair() + nb_intersections = intersections_inspector.intersecting_elements().number() if not nb_intersections == 2: raise ValueError( "[Test] 3D Surface should have 2 intersecting elements pair.") - triangles_inter = intersections_inspector.intersecting_elements() + triangles_inter = intersections_inspector.intersecting_elements().problems if len(triangles_inter) != 2 or triangles_inter[0][0] != 0 or triangles_inter[0][1] != 4 or triangles_inter[1][0] != 2 or triangles_inter[1][1] != 4: raise ValueError( "[Test] 3D Surface has wrong intersecting elements pairs.") diff --git a/bindings/python/tests/test-py-surface-manifold.py b/bindings/python/tests/test-py-surface-manifold.py index 302b2be6..03c1bbc7 100644 --- a/bindings/python/tests/test-py-surface-manifold.py +++ b/bindings/python/tests/test-py-surface-manifold.py @@ -46,7 +46,7 @@ def check_vertex_manifold2D(): manifold_inspector = inspector.SurfaceMeshVertexManifold2D(surface) if not manifold_inspector.mesh_vertices_are_manifold(): raise ValueError("[Test] Surface is shown non-manifold whereas it is.") - if not manifold_inspector.nb_non_manifold_vertices() == 0: + if not manifold_inspector.non_manifold_vertices().number() == 0: raise ValueError( "[Test] Surface has more non manifold vertices than it should.") if manifold_inspector.non_manifold_vertices(): @@ -70,10 +70,10 @@ def check_vertex_non_manifold2D(): if manifold_inspector.mesh_vertices_are_manifold(): raise ValueError( "[Test] Surface vertices are shown manifold whereas one is not.") - if not manifold_inspector.nb_non_manifold_vertices() == 1: + if not manifold_inspector.non_manifold_vertices().number() == 1: raise ValueError( "[Test] Surface has wrong number of non manifold vertices.") - if not manifold_inspector.non_manifold_vertices()[0] == 1: + if not manifold_inspector.non_manifold_vertices().problems[0] == 1: raise ValueError("[Test] Surface shows wrong non manifold vertex id.") @@ -98,7 +98,7 @@ def check_edge_manifold2D(): if not manifold_inspector.mesh_edges_are_manifold(): raise ValueError( "[Test] Surface is shown non-manifold through edges whereas it is.") - if not manifold_inspector.nb_non_manifold_edges() == 0: + if not manifold_inspector.non_manifold_vertices().number() == 0: raise ValueError( "[Test] Surface has more non manifold edges than it should.") if manifold_inspector.non_manifold_edges(): @@ -126,7 +126,7 @@ def check_edge_non_manifold2D(): if manifold_inspector.mesh_edges_are_manifold(): raise ValueError( "[Test] Surface is shown manifold through edges whereas it is not.") - if not manifold_inspector.nb_non_manifold_edges() == 1: + if not manifold_inspector.non_manifold_vertices().number() == 1: raise ValueError( "[Test] Surface has wrong number of non manifold edges.") diff --git a/tests/inspector/test-brep.cpp b/tests/inspector/test-brep.cpp index d75465a6..438ac887 100644 --- a/tests/inspector/test-brep.cpp +++ b/tests/inspector/test-brep.cpp @@ -348,7 +348,7 @@ void check_model_a1( bool string ) 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 13761." ); + " meshes problems instead of 13494." ); } void check_model_a1_valid( bool string ) @@ -371,7 +371,7 @@ void check_model_a1_valid( bool string ) 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 13761." ); + " meshes problems instead of 13494." ); } void check_model_mss( bool string ) diff --git a/tests/inspector/test-section.cpp b/tests/inspector/test-section.cpp index ba692ca4..7737305f 100644 --- a/tests/inspector/test-section.cpp +++ b/tests/inspector/test-section.cpp @@ -31,39 +31,6 @@ #include #include -/* - * Copyright (c) 2019 - 2023 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. - * - */ - -#include - -#include -#include - -#include -#include -#include - -#include geode::index_t corners_topological_validity( const geode::SectionCornersTopologyInspectionResult& result, bool string ) @@ -323,16 +290,6 @@ void check_section( bool string ) launch_component_meshes_validity_checks( result.meshes, string ); OPENGEODE_EXCEPTION( nb_component_meshes_issues == 0, "[Test] model_D has ", nb_component_meshes_issues, " meshes problems instead of 0." ); - - /* const auto nb_invalids = - launch_topological_validity_checks( section_inspector ); - OPENGEODE_EXCEPTION( nb_invalids == 0, - "[Test] Model is supposed to be valid but is shown as invalid." ); - const auto nb_mesh_invalids = - launch_component_meshes_validity_checks( section_inspector ); - OPENGEODE_EXCEPTION( nb_mesh_invalids == 0, - "[Test] Model component meshes are supposed to " - "be valid but are shown as invalid." );*/ } int main() diff --git a/tests/inspector/test-solid-adjacency.cpp b/tests/inspector/test-solid-adjacency.cpp index b9c62f0d..551b2ca9 100644 --- a/tests/inspector/test-solid-adjacency.cpp +++ b/tests/inspector/test-solid-adjacency.cpp @@ -87,7 +87,7 @@ void check_non_adjacency_no_bijection() == polyhedron_facet, "[Test] Solid facets show wrong adjacency problems." ); } -/* + void check_non_adjacency_wrong_facet() { auto solid = geode::TetrahedralSolid3D::create(); @@ -108,17 +108,18 @@ void check_non_adjacency_wrong_facet() "[Test] Solid should have wrong adjacencies due to wrong facet for " "adjacency." ); OPENGEODE_EXCEPTION( - adjacency_inspector.nb_facets_with_wrong_adjacency() == 2, + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().number() + == 2, "[Test] Solid should have two wrong adjacencies due to wrong facet " "for adjacency." ); const geode::PolyhedronFacet polyhedron_facet1{ 0, 0 }; OPENGEODE_EXCEPTION( - adjacency_inspector.polyhedron_facets_with_wrong_adjacency()[0] + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[0] == polyhedron_facet1, "[Test] Solid shows wrong first facet with adjacency problems." ); const geode::PolyhedronFacet polyhedron_facet2{ 1, 0 }; OPENGEODE_EXCEPTION( - adjacency_inspector.polyhedron_facets_with_wrong_adjacency()[1] + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[1] == polyhedron_facet2, "[Test] Solid shows wrong second facet with adjacency problems." ); } @@ -143,22 +144,23 @@ void check_non_adjacency_inversed_tetrahedron() "[Test] Solid should have wrong adjacencies due to an inversed " "tetrahedron." ); OPENGEODE_EXCEPTION( - adjacency_inspector.nb_facets_with_wrong_adjacency() == 2, + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().number() + == 2, "[Test] Solid should have two wrong adjacencies due to an inversed " "tetrahedron." ); const geode::PolyhedronFacet polyhedron_facet1{ 0, 0 }; OPENGEODE_EXCEPTION( - adjacency_inspector.polyhedron_facets_with_wrong_adjacency()[0] + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[0] == polyhedron_facet1, "[Test] Solid shows wrong first facet with adjacency problems due to " "an inversed tetrahedron." ); const geode::PolyhedronFacet polyhedron_facet2{ 1, 1 }; OPENGEODE_EXCEPTION( - adjacency_inspector.polyhedron_facets_with_wrong_adjacency()[1] + adjacency_inspector.polyhedron_facets_with_wrong_adjacency().problems[1] == polyhedron_facet2, "[Test] Solid shows wrong second facet with adjacency problems due to " "an inversed tetrahedron." ); -}*/ +} int main() { @@ -167,8 +169,8 @@ int main() geode::InspectorInspectorLibrary::initialize(); check_adjacency(); check_non_adjacency_no_bijection(); - // check_non_adjacency_wrong_facet(); - // check_non_adjacency_inversed_tetrahedron(); + check_non_adjacency_wrong_facet(); + check_non_adjacency_inversed_tetrahedron(); geode::Logger::info( "TEST SUCCESS" ); return 0;