Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ option(OPENGEODE_INSPECTOR_WITH_EXECUTABLES "Compile executable projects" ON)
find_package(OpenGeode REQUIRED)
find_package(Async++ REQUIRED)

install(
FILES include/geode/inspector/project.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/geode/inspector
COMPONENT public
)

#------------------------------------------------------------------------------------------------
# Configure the OpenGeode-inspector libraries
add_subdirectory(src/geode)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@

from opengeode_inspector_py_inspector import *

InspectorInspectorLibrary.initialize()
OpenGeodeInspectorInspectorLibrary.initialize()
7 changes: 4 additions & 3 deletions bindings/python/src/inspector/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "solid_inspector.hpp"
#include "surface_inspector.hpp"

namespace pybind11

Check warning on line 72 in bindings/python/src/inspector/inspector.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/inspector/inspector.cpp:72:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace detail
{
Expand All @@ -90,9 +90,10 @@
PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
{
module.doc() = "OpenGeode-Inspector Python binding";
pybind11::class_< geode::InspectorInspectorLibrary >(
module, "InspectorInspectorLibrary" )
.def( "initialize", &geode::InspectorInspectorLibrary::initialize );
pybind11::class_< geode::OpenGeodeInspectorInspectorLibrary >(
module, "OpenGeodeInspectorInspectorLibrary" )
.def( "initialize",
&geode::OpenGeodeInspectorInspectorLibrary::initialize );
geode::define_information( module );
geode::define_surface_adjacency( module );
geode::define_solid_adjacency( module );
Expand Down
33 changes: 21 additions & 12 deletions bindings/python/tests/test-py-brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def lines_topological_validity(result, verbose):
nb_issues += (
result.unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner.nb_issues()
)
nb_issues+=result.line_edges_with_wrong_component_edges_around.nb_issues()
nb_issues += result.line_edges_with_wrong_component_edges_around.nb_issues()
print("BRep Lines Topology check: ", nb_issues, " issues.")
if verbose:
print(result.string(), "\n")
Expand All @@ -80,8 +80,10 @@ def surfaces_topological_validity(result, verbose):
nb_issues += (
result.unique_vertices_linked_to_several_and_invalid_surfaces.nb_issues()
)
nb_issues+=result.unique_vertices_linked_to_a_surface_with_invalid_embbedings.nb_issues()
nb_issues +=result.surface_polygons_with_wrong_component_facets_around.nb_issues()
nb_issues += (
result.unique_vertices_linked_to_a_surface_with_invalid_embbedings.nb_issues()
)
nb_issues += result.surface_polygons_with_wrong_component_facets_around.nb_issues()
print("BRep Surfaces Topology check: ", nb_issues, " issues.")
if verbose:
print(result.string(), "\n")
Expand Down Expand Up @@ -228,7 +230,8 @@ def check_a1(verbose):
"[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)."
)

def inspect_model_A1(model_brep,verbose):

def inspect_model_A1(model_brep, verbose):
brep_inspector = inspector.BRepInspector(model_brep)
result = brep_inspector.inspect_brep()
if brep_inspector.brep_topology_is_valid():
Expand All @@ -248,13 +251,15 @@ def inspect_model_A1(model_brep,verbose):
"[Test] model model_A1_valid should have 13494 component meshes issues (pairs of component meshes triangles intersecting)."
)


def check_a1_valid(verbose):
test_dir = os.path.dirname(__file__)
data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data"))
model_brep = opengeode.load_brep(data_dir + "/model_A1_valid.og_brep")
inspect_model_A1(model_brep,verbose)
inspect_model_A1(model_brep, verbose)


def inspect_model_mss(model_brep,verbose):
def inspect_model_mss(model_brep, verbose):
brep_inspector = inspector.BRepInspector(model_brep)
result = brep_inspector.inspect_brep()
if brep_inspector.brep_topology_is_valid():
Expand All @@ -264,21 +269,24 @@ def inspect_model_mss(model_brep,verbose):
nb_model_issues = launch_topological_validity_checks(result.topology, verbose)
if nb_model_issues != 52:
raise ValueError(
"[Test] model mss.og_strm should have 37 topological problems, not " + str(nb_model_issues)
"[Test] model mss.og_strm should have 37 topological problems, not "
+ str(nb_model_issues)
)
nb_component_meshes_issues = launch_component_meshes_validity_checks(
result.meshes, verbose
)
if nb_component_meshes_issues != 0:
raise ValueError("[Test] model mss should have no component meshes issues.")


def check_model_mss(verbose):
test_dir = os.path.dirname(__file__)
data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data"))
model_brep = opengeode.load_brep(data_dir + "/mss.og_brep")
inspect_model_mss(model_brep,verbose)
inspect_model_mss(model_brep, verbose)


def inspect_model_D(model_brep,verbose):
def inspect_model_D(model_brep, verbose):
brep_inspector = inspector.BRepInspector(model_brep)
result = brep_inspector.inspect_brep()

Expand All @@ -296,16 +304,17 @@ def inspect_model_D(model_brep,verbose):
)
if nb_component_meshes_issues != 0:
raise ValueError("[Test] model_D should have no component meshes issues.")


def check_model_D(verbose):
test_dir = os.path.dirname(__file__)
data_dir = os.path.abspath(os.path.join(test_dir, "../../../tests/data"))
model_brep = opengeode.load_brep(data_dir + "/model_D.og_brep")
inspect_model_D(model_brep,verbose)
inspect_model_D(model_brep, verbose)


if __name__ == "__main__":
inspector.InspectorInspectorLibrary.initialize()
inspector.OpenGeodeInspectorInspectorLibrary.initialize()
verbose = False
check_a1(verbose)
check_a1_valid(verbose)
Expand Down
111 changes: 67 additions & 44 deletions bindings/python/tests/test-py-edgedcurve-colocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,110 +22,133 @@
import os
import sys
import platform

if sys.version_info >= (3, 8, 0) and platform.system() == "Windows":
for path in [x.strip() for x in os.environ['PATH'].split(';') if x]:
for path in [x.strip() for x in os.environ["PATH"].split(";") if x]:
os.add_dll_directory(path)

import opengeode as geode
import opengeode_inspector_py_inspector as inspector


def check_non_colocation2D():
curve = geode.EdgedCurve2D.create()
builder = geode.EdgedCurveBuilder2D.create(curve)
builder.create_vertices(4)
builder.set_point(0, geode.Point2D([0., 2.]))
builder.set_point(1, geode.Point2D([2., 0.]))
builder.set_point(2, geode.Point2D([1., 4.]))
builder.set_point(3, geode.Point2D([3., 3.]))
builder.set_point(0, geode.Point2D([0.0, 2.0]))
builder.set_point(1, geode.Point2D([2.0, 0.0]))
builder.set_point(2, geode.Point2D([1.0, 4.0]))
builder.set_point(3, geode.Point2D([3.0, 3.0]))

colocation_inspector = inspector.EdgedCurveColocation2D(curve)
if colocation_inspector.mesh_has_colocated_points():
raise ValueError(
"[Test] EdgedCurve has colocated points when it should have none.")
"[Test] EdgedCurve has colocated points when it should have none."
)
if not colocation_inspector.colocated_points_groups().nb_issues() == 0:
raise ValueError(
"[Test] EdgedCurve has more colocated points than it should.")
raise ValueError("[Test] EdgedCurve has more colocated points than it should.")


def check_colocation2D():
curve = geode.EdgedCurve2D.create()
builder = geode.EdgedCurveBuilder2D.create(curve)
builder.create_vertices(7)
builder.set_point(0, geode.Point2D([0., 2.]))
builder.set_point(1, geode.Point2D([0., 2.]))
builder.set_point(2, geode.Point2D([0., 0.]))
builder.set_point(3, geode.Point2D([2., 0.]))
builder.set_point(4, geode.Point2D([1., 4.]))
builder.set_point(5, geode.Point2D([2., geode.GLOBAL_EPSILON / 2]))
builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.]))
builder.set_point(0, geode.Point2D([0.0, 2.0]))
builder.set_point(1, geode.Point2D([0.0, 2.0]))
builder.set_point(2, geode.Point2D([0.0, 0.0]))
builder.set_point(3, geode.Point2D([2.0, 0.0]))
builder.set_point(4, geode.Point2D([1.0, 4.0]))
builder.set_point(5, geode.Point2D([2.0, geode.GLOBAL_EPSILON / 2]))
builder.set_point(6, geode.Point2D([geode.GLOBAL_EPSILON / 1.1, 2.0]))

colocation_inspector = inspector.EdgedCurveColocation2D(curve)
if not colocation_inspector.mesh_has_colocated_points():
raise ValueError(
"[Test] EdgedCurve doesn't have colocated points whereas it should have several.")
"[Test] EdgedCurve doesn't have colocated points whereas it should have several."
)
issues = colocation_inspector.colocated_points_groups()
if not issues.nb_issues() == 2:
raise ValueError(
"[Test] EdgedCurve has wrong number of colocated points groups.")
"[Test] EdgedCurve has wrong number of colocated points groups."
)
first_colocated_points_group = [0, 1, 6]
second_colocated_points_group = [3, 5]
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
raise ValueError(
"[Test] EdgedCurve has wrong first colocated points group.")
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
raise ValueError(
"[Test] EdgedCurve has wrong second colocated points group.")
if (
not issues.issues()[0] == first_colocated_points_group
and not issues.issues()[0] == second_colocated_points_group
):
raise ValueError("[Test] EdgedCurve has wrong first colocated points group.")
if (
not issues.issues()[1] == first_colocated_points_group
and not issues.issues()[1] == second_colocated_points_group
):
raise ValueError("[Test] EdgedCurve has wrong second colocated points group.")


def check_non_colocation3D():
curve = geode.EdgedCurve3D.create()
builder = geode.EdgedCurveBuilder3D.create(curve)
builder.create_vertices(4)
builder.set_point(0, geode.Point3D([0., 2., 0.]))
builder.set_point(1, geode.Point3D([2., 0., 0.5]))
builder.set_point(2, geode.Point3D([1., 4., 1.]))
builder.set_point(3, geode.Point3D([3., 3., 2.]))
builder.set_point(0, geode.Point3D([0.0, 2.0, 0.0]))
builder.set_point(1, geode.Point3D([2.0, 0.0, 0.5]))
builder.set_point(2, geode.Point3D([1.0, 4.0, 1.0]))
builder.set_point(3, geode.Point3D([3.0, 3.0, 2.0]))

colocation_inspector = inspector.EdgedCurveColocation3D(curve)
if colocation_inspector.mesh_has_colocated_points():
raise ValueError(
"[Test] (3D) EdgedCurve has colocated points when it should have none.")
"[Test] (3D) EdgedCurve has colocated points when it should have none."
)
if not colocation_inspector.colocated_points_groups().nb_issues() == 0:
raise ValueError(
"[Test] (3D) EdgedCurve has more colocated points than it should.")
"[Test] (3D) EdgedCurve has more colocated points than it should."
)


def check_colocation3D():
curve = geode.EdgedCurve3D.create()
builder = geode.EdgedCurveBuilder3D.create(curve)
builder.create_vertices(7)
builder.set_point(0, geode.Point3D([0., 2., 1.]))
builder.set_point(1, geode.Point3D([0., 2., 1.]))
builder.set_point(2, geode.Point3D([0., 0., 0.]))
builder.set_point(3, geode.Point3D([2., 0., 0.]))
builder.set_point(4, geode.Point3D([1., 4., 3.]))
builder.set_point(0, geode.Point3D([0.0, 2.0, 1.0]))
builder.set_point(1, geode.Point3D([0.0, 2.0, 1.0]))
builder.set_point(2, geode.Point3D([0.0, 0.0, 0.0]))
builder.set_point(3, geode.Point3D([2.0, 0.0, 0.0]))
builder.set_point(4, geode.Point3D([1.0, 4.0, 3.0]))
builder.set_point(
5, geode.Point3D([2., geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2]))
builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2., 1.]))
5, geode.Point3D([2.0, geode.GLOBAL_EPSILON / 2, geode.GLOBAL_EPSILON / 2])
)
builder.set_point(6, geode.Point3D([geode.GLOBAL_EPSILON / 1.1, 2.0, 1.0]))

colocation_inspector = inspector.EdgedCurveColocation3D(curve)
if not colocation_inspector.mesh_has_colocated_points():
raise ValueError(
"[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several.")
"[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several."
)
issues = colocation_inspector.colocated_points_groups()
if not issues.nb_issues() == 2:
raise ValueError(
"[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points.")
"[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points."
)
first_colocated_points_group = [0, 1, 6]
second_colocated_points_group = [3, 5]
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
if (
not issues.issues()[0] == first_colocated_points_group
and not issues.issues()[0] == second_colocated_points_group
):
raise ValueError(
"[Test] (3D) EdgedCurve has wrong first colocated points group.")
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
"[Test] (3D) EdgedCurve has wrong first colocated points group."
)
if (
not issues.issues()[1] == first_colocated_points_group
and not issues.issues()[1] == second_colocated_points_group
):
raise ValueError(
"[Test] (3D) EdgedCurve has wrong second colocated points group.")
"[Test] (3D) EdgedCurve has wrong second colocated points group."
)


if __name__ == '__main__':
inspector.InspectorInspectorLibrary.initialize()
if __name__ == "__main__":
inspector.OpenGeodeInspectorInspectorLibrary.initialize()
check_non_colocation2D()
check_colocation2D()
check_non_colocation3D()
Expand Down
Loading
Loading