diff --git a/.gitignore b/.gitignore index afbdfcdc7..338ed6b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -672,3 +672,4 @@ python/update_bindings.py tests/data notebooks/*.png CMakeGraphVizOptions.cmake +.zed/* \ No newline at end of file diff --git a/docs/source/tutorials/getting_started.rst b/docs/source/tutorials/getting_started.rst index e4af4538f..82f858810 100644 --- a/docs/source/tutorials/getting_started.rst +++ b/docs/source/tutorials/getting_started.rst @@ -519,7 +519,7 @@ The ``Candidates`` class represents the culled set of candidate pairs and is bui #include ipc::Candidates candidates; - ipc::HashGrid broad_phase; + ipc::LBVH broad_phase; candidates.build( mesh, vertices_t0, vertices_t1, /*inflation_radius=*/0.0, broad_phase); @@ -529,9 +529,9 @@ The ``Candidates`` class represents the culled set of candidate pairs and is bui candidates = ipctk.Candidates() candidates.build( - mesh, vertices_t0, vertices_t1, broad_phase=ipctk.HashGrid()) + mesh, vertices_t0, vertices_t1, broad_phase=ipctk.LBVH()) -Possible values for ``broad_phase`` are: ``BruteForce`` (parallel brute force culling), ``HashGrid`` (default), ``SpatialHash`` (implementation from the original IPC codebase), ``LBVH`` (CPU implementation of :cite:t:`Karras2012HPG` using TBB), ``SweepAndPrune`` (a.k.a. Sort-and-Sweep from :cite:t:`Baraff1992PhD`), or ``SweepAndTiniestQueue`` (method of :cite:t:`Belgrod2023Time`; requires CUDA). +Possible values for ``broad_phase`` are: ``BruteForce`` (parallel brute force culling), ``HashGrid``, ``SpatialHash`` (implementation from the original IPC codebase), ``LBVH`` (CPU implementation of :cite:t:`Karras2012HPG` using TBB), ``SweepAndPrune`` (a.k.a. Sort-and-Sweep from :cite:t:`Baraff1992PhD`), or ``SweepAndTiniestQueue`` (method of :cite:t:`Belgrod2023Time`; requires CUDA). The default is ``LBVH``. Narrow-Phase ^^^^^^^^^^^^ diff --git a/src/ipc/broad_phase/default_broad_phase.hpp b/src/ipc/broad_phase/default_broad_phase.hpp index 723a84c1c..cba6aa116 100644 --- a/src/ipc/broad_phase/default_broad_phase.hpp +++ b/src/ipc/broad_phase/default_broad_phase.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include @@ -8,7 +8,7 @@ namespace ipc { inline std::unique_ptr make_default_broad_phase() { - return std::make_unique(); + return std::make_unique(); } } // namespace ipc \ No newline at end of file diff --git a/src/ipc/broad_phase/lbvh.cpp b/src/ipc/broad_phase/lbvh.cpp index 7f3f5d311..ce6179cb5 100644 --- a/src/ipc/broad_phase/lbvh.cpp +++ b/src/ipc/broad_phase/lbvh.cpp @@ -662,7 +662,7 @@ void LBVH::detect_candidates( void LBVH::detect_vertex_vertex_candidates( std::vector& candidates) const { - if (!has_vertices()) { + if (vertex_bvh.size() <= 1) { // Need at least 2 vertices for a collision return; } @@ -690,7 +690,7 @@ void LBVH::detect_edge_vertex_candidates( void LBVH::detect_edge_edge_candidates( std::vector& candidates) const { - if (!has_edges()) { + if (edge_bvh.size() <= 1) { // Need at least 2 edges for a collision return; } @@ -734,7 +734,7 @@ void LBVH::detect_edge_face_candidates( void LBVH::detect_face_face_candidates( std::vector& candidates) const { - if (!has_faces()) { + if (face_bvh.size() <= 1) { // Need at least 2 faces for a collision return; } diff --git a/tests/src/tests/broad_phase/brute_force_comparison.cpp b/tests/src/tests/broad_phase/brute_force_comparison.cpp index b71fb281a..42d93cf63 100644 --- a/tests/src/tests/broad_phase/brute_force_comparison.cpp +++ b/tests/src/tests/broad_phase/brute_force_comparison.cpp @@ -89,8 +89,9 @@ void save_candidates( bool load_candidates(const std::string& filename, ipc::Candidates& candidates) { std::ifstream f(filename); - if (!f) + if (!f) { return false; + } nlohmann::json in; f >> in; diff --git a/tests/src/tests/potential/test_barrier_potential.cpp b/tests/src/tests/potential/test_barrier_potential.cpp index 56842e808..df361f379 100644 --- a/tests/src/tests/potential/test_barrier_potential.cpp +++ b/tests/src/tests/potential/test_barrier_potential.cpp @@ -36,7 +36,6 @@ TEST_CASE( double dhat = -1; std::string mesh_name; - bool all_vertices_on_surface = true; SECTION("cube") { dhat = sqrt(2.0); @@ -210,6 +209,8 @@ TEST_CASE( < dhat * dhat); } + REQUIRE(vertices.size() > 0); + const CollisionMesh mesh(vertices, edges, faces); NormalCollisions collisions;