Skip to content

Commit c03df40

Browse files
committed
Fix pybind defintion order
1 parent 21547b0 commit c03df40

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

python/src/bindings.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ PYBIND11_MODULE(ipctk, m)
1010

1111
m.doc() = "IPC Toolkit";
1212

13+
// define these early because they are used in other definitions
14+
define_eigen_ext(m);
15+
1316
// barrier
1417
define_barrier(m);
1518
define_adaptive_stiffness(m);
@@ -91,7 +94,7 @@ PYBIND11_MODULE(ipctk, m)
9194

9295
// utils
9396
define_area_gradient(m);
94-
define_eigen_ext(m);
97+
// define_eigen_ext(m);
9598
define_interval(m);
9699
define_intersection(m);
97100
define_logger(m);

python/src/utils/eigen_ext.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ void define_eigen_ext(py::module_& m)
2727
m, "PSDProjectionMethod",
2828
"Enumeration of implemented PSD projection methods.")
2929
.value("NONE", PSDProjectionMethod::NONE, "No PSD projection")
30-
.value("CLAMP", PSDProjectionMethod::CLAMP, "Clamp negative eigenvalues")
30+
.value(
31+
"CLAMP", PSDProjectionMethod::CLAMP, "Clamp negative eigenvalues")
3132
.value("ABS", PSDProjectionMethod::ABS, "Flip negative eigenvalues")
3233
.export_values();
3334

python/tests/find_ipctk.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
except ImportError:
44
import sys
55
import pathlib
6-
sys.path.append(
7-
str(pathlib.Path(__file__).parents[2] / "build" / "release" / "python"))
6+
repo_root = pathlib.Path(__file__).parents[2]
7+
possible_paths = [
8+
pathlib.Path("python").resolve(),
9+
repo_root / "build" / "python",
10+
repo_root / "build" / "release" / "python",
11+
repo_root / "build" / "debug" / "python",
12+
]
13+
for path in possible_paths:
14+
if path.exists():
15+
sys.path.append(str(path))
16+
break
17+
else:
18+
raise ImportError("Could not find the ipctk module")
819
import ipctk # Try again

src/ipc/potentials/distance_based_potential.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ void DistanceBasedPotential::shape_derivative(
181181
MatrixMax12d local_hess;
182182
if (!collision.is_mollified()) {
183183
// w ∇ₓ∇ᵤf = w ∇ᵤ²f
184-
local_hess =
185-
hessian(collision, positions, /*project_hessian_to_psd=*/PSDProjectionMethod::NONE);
184+
local_hess = hessian(collision, positions, PSDProjectionMethod::NONE);
186185
} else {
187186
// d(x̄+u)
188187
const double d = collision.compute_distance(positions);

0 commit comments

Comments
 (0)