Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 3b19523

Browse files
committed
Merge branch 'main' of https://github.com/ipc-sim/ipc-toolkit into dynamic
2 parents 80dda64 + c272e76 commit 3b19523

File tree

115 files changed

+650
-833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+650
-833
lines changed

docs/source/changelog.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Added
307307
Changed
308308
^^^^^^^
309309

310-
* Changed CMake target name to :cmake:`ipc::toolkit`
310+
* Changed CMake target name to ``ipc::toolkit``
311311

312312
2021-07-26 (`1479aae <https://github.com/ipc-sim/ipc-toolkit/commit/1479aaea958daaa4e963529493e4169dc7757913>`__)
313313
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -317,7 +317,7 @@ Changed
317317
Changed
318318
^^^^^^^
319319

320-
* Updated the CMake system to use modern :cpp:`FetchContent` to download externals
320+
* Updated the CMake system to use modern ``FetchContent`` to download externals
321321

322322
2021-07-22 (`e24c76d <https://github.com/ipc-sim/ipc-toolkit/commit/e24c76ddc818fb9efc4d522ef72a581a15abf751>`__)
323323
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -414,7 +414,7 @@ Changed
414414
^^^^^^^
415415

416416
* :cpp:`ignore_codimensional_vertices` to :cpp:`false` by default
417-
* CMake option :cmake:`TIGHT_INCLUSION_WITH_NO_ZERO_TOI=ON` as default
417+
* CMake option ``TIGHT_INCLUSION_WITH_NO_ZERO_TOI=ON`` as default
418418

419419
2021-06-18 (`aa59aeb <https://github.com/ipc-sim/ipc-toolkit/commit/aa59aeb0634af981a8f1cfbb6d2ff2b76a04d610>`__)
420420
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/source/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
# -- Project information -----------------------------------------------------
2222

2323
from datetime import datetime
24-
import ipctk
24+
25+
import sys
26+
sys.path.append(str(pathlib.Path(__file__).parents[2] / "python"))
27+
from _find_ipctk import ipctk # noqa
2528

2629
project = "IPC Toolkit"
2730
copyright = f'2020-{datetime.now().year}, IPC-Sim Organization; MIT License'

docs/source/cpp-api/barrier.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Adaptive Barrier Stiffness
2020
Semi-Implicit Stiffness
2121
~~~~~~~~~~~~~~~~~~~~~~~
2222

23-
.. doxygenfunction:: ipc::semi_implicit_stiffness(const CollisionMesh&, const Eigen::MatrixXd&, const StencilsT&, const Eigen::VectorXd&, const Eigen::SparseMatrix<double>&, const double)
23+
.. doxygenfunction:: ipc::semi_implicit_stiffness(const CollisionMesh&, Eigen::ConstRef<Eigen::MatrixXd>, const StencilsT&, Eigen::ConstRef<Eigen::VectorXd>, const Eigen::SparseMatrix<double>&, const double)
2424

2525
Barrier Class
2626
-------------
@@ -34,10 +34,10 @@ Clamped Log Barrier
3434
.. doxygenclass:: ipc::ClampedLogBarrier
3535
:allow-dot-graphs:
3636

37-
Normalized Clamped Log Barrier
38-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
Normalized Barrier
38+
~~~~~~~~~~~~~~~~~~
3939

40-
.. doxygenclass:: ipc::NormalizedClampedLogBarrier
40+
.. doxygenclass:: ipc::NormalizedBarrier
4141
:allow-dot-graphs:
4242

4343
Clamped Log Squared Barrier

docs/source/cpp-api/distance.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ Edge-Edge Mollifier
1919
.. doxygenfunction:: edge_edge_cross_squarednorm
2020
.. doxygenfunction:: ipc::edge_edge_cross_squarednorm_gradient
2121
.. doxygenfunction:: ipc::edge_edge_cross_squarednorm_hessian
22-
.. doxygenfunction:: edge_edge_mollifier(const Eigen::Ref<const Eigen::Vector3d>& ea0, const Eigen::Ref<const Eigen::Vector3d>& ea1, const Eigen::Ref<const Eigen::Vector3d>& eb0, const Eigen::Ref<const Eigen::Vector3d>& eb1, const double eps_x)
22+
.. doxygenfunction:: edge_edge_mollifier(Eigen::ConstRef<Eigen::Vector3d> ea0, Eigen::ConstRef<Eigen::Vector3d> ea1, Eigen::ConstRef<Eigen::Vector3d> eb0, Eigen::ConstRef<Eigen::Vector3d> eb1, const double eps_x)
2323
.. doxygenfunction:: edge_edge_mollifier(const double x, const double eps_x)
24-
.. doxygenfunction:: edge_edge_mollifier_gradient(const Eigen::Ref<const Eigen::Vector3d>& ea0, const Eigen::Ref<const Eigen::Vector3d>& ea1, const Eigen::Ref<const Eigen::Vector3d>& eb0, const Eigen::Ref<const Eigen::Vector3d>& eb1, const double eps_x)
24+
.. doxygenfunction:: edge_edge_mollifier_gradient(Eigen::ConstRef<Eigen::Vector3d> ea0, Eigen::ConstRef<Eigen::Vector3d> ea1, Eigen::ConstRef<Eigen::Vector3d> eb0, Eigen::ConstRef<Eigen::Vector3d> eb1, const double eps_x)
2525
.. doxygenfunction:: edge_edge_mollifier_gradient(const double x, const double eps_x)
26-
.. doxygenfunction:: edge_edge_mollifier_hessian(const Eigen::Ref<const Eigen::Vector3d>& ea0, const Eigen::Ref<const Eigen::Vector3d>& ea1, const Eigen::Ref<const Eigen::Vector3d>& eb0, const Eigen::Ref<const Eigen::Vector3d>& eb1, const double eps_x)
26+
.. doxygenfunction:: edge_edge_mollifier_hessian(Eigen::ConstRef<Eigen::Vector3d> ea0, Eigen::ConstRef<Eigen::Vector3d> ea1, Eigen::ConstRef<Eigen::Vector3d> eb0, Eigen::ConstRef<Eigen::Vector3d> eb1, const double eps_x)
2727
.. doxygenfunction:: edge_edge_mollifier_hessian(const double x, const double eps_x)
2828

2929
Edge-Edge
@@ -57,12 +57,12 @@ Point-Line
5757
Point-Plane
5858
-----------
5959

60-
.. doxygenfunction:: point_plane_distance(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& origin, const Eigen::Ref<const Eigen::Vector3d>& normal)
61-
.. doxygenfunction:: point_plane_distance(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& t0, const Eigen::Ref<const Eigen::Vector3d>& t1, const Eigen::Ref<const Eigen::Vector3d>& t2)
62-
.. doxygenfunction:: point_plane_distance_gradient(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& origin, const Eigen::Ref<const Eigen::Vector3d>& normal)
63-
.. doxygenfunction:: point_plane_distance_gradient(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& t0, const Eigen::Ref<const Eigen::Vector3d>& t1, const Eigen::Ref<const Eigen::Vector3d>& t2)
64-
.. doxygenfunction:: point_plane_distance_hessian(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& origin, const Eigen::Ref<const Eigen::Vector3d>& normal)
65-
.. doxygenfunction:: point_plane_distance_hessian(const Eigen::Ref<const Eigen::Vector3d>& p, const Eigen::Ref<const Eigen::Vector3d>& t0, const Eigen::Ref<const Eigen::Vector3d>& t1, const Eigen::Ref<const Eigen::Vector3d>& t2)
60+
.. doxygenfunction:: point_plane_distance(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
61+
.. doxygenfunction:: point_plane_distance(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> t0, Eigen::ConstRef<Eigen::Vector3d> t1, Eigen::ConstRef<Eigen::Vector3d> t2)
62+
.. doxygenfunction:: point_plane_distance_gradient(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
63+
.. doxygenfunction:: point_plane_distance_gradient(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> t0, Eigen::ConstRef<Eigen::Vector3d> t1, Eigen::ConstRef<Eigen::Vector3d> t2)
64+
.. doxygenfunction:: point_plane_distance_hessian(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
65+
.. doxygenfunction:: point_plane_distance_hessian(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> t0, Eigen::ConstRef<Eigen::Vector3d> t1, Eigen::ConstRef<Eigen::Vector3d> t2)
6666

6767
Point-Point
6868
-----------

docs/source/cpp.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ C++
2424
:end-before: <!--- BEGIN C++ README 2 --->
2525

2626
.. tip::
27-
If your :cmake:`IPC_TOOLKIT_GIT_TAG` is a tag (e.g. ``v1.3.1``), then you can use the :cmake:`FetchContent_Declare` argument :cmake:`GIT_SHALLOW TRUE` to download only a single commit. Otherwise, you should use the default :cmake:`GIT_SHALLOW FALSE`.
27+
If your ``IPC_TOOLKIT_GIT_TAG`` is a tag (e.g. ``v1.3.1``), then you can use the ``FetchContent_Declare`` argument ``GIT_SHALLOW TRUE`` to download only a single commit. Otherwise, you should use the default ``GIT_SHALLOW FALSE``.
2828

2929
.. include:: ../../README.md
3030
:parser: myst_parser.sphinx_
@@ -34,7 +34,7 @@ C++
3434
.. _filib_dependency_note:
3535

3636
.. warning::
37-
``filib`` is licensed under `LGPL-2.1 <https://github.com/zfergus/filib/blob/main/LICENSE>`_ and as such it is required to be dynamically linked. Doing so automatically is a challenge, so by default we use static linkage. Enabling dynaic linkage requires copying the ``.so``/``.dylib``/``.dll`` file to the binary directory or system path. To enable this, set the CMake option :cmake:`FILIB_BUILD_SHARED_LIBS` to :cmake:`ON` and add this CMake code to copy the shared libaray object to the binary directory:
37+
``filib`` is licensed under `LGPL-2.1 <https://github.com/zfergus/filib/blob/main/LICENSE>`_ and as such it is required to be dynamically linked. Doing so automatically is a challenge, so by default we use static linkage. Enabling dynaic linkage requires copying the ``.so``/``.dylib``/``.dll`` file to the binary directory or system path. To enable this, set the CMake option ``FILIB_BUILD_SHARED_LIBS`` to ``ON`` and add this CMake code to copy the shared libaray object to the binary directory:
3838

3939
.. code-block:: cmake
4040
@@ -47,7 +47,7 @@ C++
4747
4848
where ``${MY_EXE_TARGET}`` is the name of your executable target. If you know a better way to handle this, please `let us know <https://github.com/ipc-sim/ipc-toolkit/discussions>`_!
4949

50-
If you would rather avoid LGPL code entirely, you can disable filib by setting :cmake:`IPC_TOOLKIT_WITH_FILIB` to :cmake:`OFF`. With this option disabled, CMake will not download or use any of filib's code.
50+
If you would rather avoid LGPL code entirely, you can disable filib by setting ``IPC_TOOLKIT_WITH_FILIB`` to ``OFF``. With this option disabled, CMake will not download or use any of filib's code.
5151

5252
.. include:: ../../README.md
5353
:parser: myst_parser.sphinx_

docs/source/tutorial/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Frequently Asked Questions
1313
How do I include IPC Toolkit in my project?
1414
-------------------------------------------
1515

16-
If you are using CMake, the public include directory is added to the :cmake:`ipc::toolkit` cmake target which means that any lib/bin that includes :cmake:`ipc::toolkit` as a dependency also adds those include directories too.
16+
If you are using CMake, the public include directory is added to the `ipc::toolkit` cmake target which means that any lib/bin that includes `ipc::toolkit` as a dependency also adds those include directories too.
1717

1818
If you are not using CMake, the include path is ``src``.
1919

docs/source/tutorial/nonlinear_ccd.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ Let's dive deeper by breaking down the implementation of ``Rigid2DTrajectory``.
5757

5858
.. literalinclude:: ../../../tests/src/tests/ccd/test_nonlinear_ccd.cpp
5959
:language: c++
60-
:lines: 127-134
60+
:start-after: // BEGIN_RIGID_2D_CALL
61+
:end-before: // END_RIGID_2D_CALL
6162
:dedent: 4
6263

6364

6465
.. md-tab-item:: Python
6566

6667
.. literalinclude:: ../../../python/tests/test_ccd.py
6768
:language: python
68-
:lines: 90-94
69+
:start-after: # BEGIN_RIGID_2D_CALL
70+
:end-before: # END_RIGID_2D_CALL
6971
:dedent: 8
7072

7173
This function computes the position of the point at a time :math:`t \in [0, 1]`. This defines the trajectory of the point. In this case, we have a rigid body with a center of mass (COM) at the origin. The trajectory of the point is given by:
@@ -87,14 +89,16 @@ The second function we need to implement is ``max_distance_from_linear``.
8789

8890
.. literalinclude:: ../../../tests/src/tests/ccd/test_nonlinear_ccd.cpp
8991
:language: c++
90-
:lines: 136-147
92+
:start-after: // BEGIN_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
93+
:end-before: // END_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
9194
:dedent: 4
9295

9396
.. md-tab-item:: Python
9497

9598
.. literalinclude:: ../../../python/tests/test_ccd.py
9699
:language: python
97-
:lines: 96-102
100+
:start-after: # BEGIN_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
101+
:end-before: # END_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
98102
:dedent: 8
99103

100104
This function computes the maximum distance over a time interval :math:`[t_0, t_1]` between the nonlinear trajectory and a line segment from :math:`x(t_0)` to :math:`x(t_1)`. Mathematically this function computes

notebooks/find_ipctk.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
try:
2-
import ipctk # Try to import the built module
3-
except ImportError:
4-
import sys
5-
import pathlib
6-
repo_root = pathlib.Path(__file__).parents[1]
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() and len(list(path.glob("ipctk.*"))) > 0:
15-
sys.path.append(str(path))
16-
break
17-
else:
18-
raise ImportError("Could not find the ipctk module")
19-
print(f"Using found ipctk module at {path}")
20-
import ipctk # Try again
1+
import sys
2+
import pathlib
3+
sys.path.append(str(pathlib.Path(__file__).parents[1] / "python"))
4+
from _find_ipctk import ipctk # noqa

python/_find_ipctk.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
try:
2+
import ipctk # Try to import the built module
3+
except ImportError:
4+
import sys
5+
import pathlib
6+
repo_root = pathlib.Path(__file__).parents[1]
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() and len(list(path.glob("ipctk.*"))) > 0:
15+
sys.path.append(str(path))
16+
break
17+
else:
18+
raise ImportError("Could not find the ipctk module")
19+
print(f"Using found ipctk module at {path}")
20+
import ipctk # Try again

python/src/adhesion/adhesion.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <ipc/adhesion/adhesion.hpp>
44

5-
namespace py = pybind11;
65
using namespace ipc;
76

87
void define_adhesion(py::module_& m)
@@ -21,7 +20,7 @@ void define_adhesion(py::module_& m)
2120
Returns:
2221
The normal adhesion potential.
2322
)ipc_Qu8mg5v7",
24-
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
23+
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);
2524

2625
m.def(
2726
"normal_adhesion_potential_first_derivative",
@@ -38,7 +37,7 @@ void define_adhesion(py::module_& m)
3837
Returns:
3938
The first derivative of the normal adhesion potential wrt d.
4039
)ipc_Qu8mg5v7",
41-
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
40+
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);
4241

4342
m.def(
4443
"normal_adhesion_potential_second_derivative",
@@ -55,7 +54,7 @@ void define_adhesion(py::module_& m)
5554
Returns:
5655
The second derivative of the normal adhesion potential wrt d.
5756
)ipc_Qu8mg5v7",
58-
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
57+
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);
5958

6059
m.def(
6160
"max_normal_adhesion_force_magnitude",
@@ -71,7 +70,7 @@ void define_adhesion(py::module_& m)
7170
Returns:
7271
The maximum normal adhesion force magnitude.
7372
)ipc_Qu8mg5v7",
74-
py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
73+
"dhat_p"_a, "dhat_a"_a, "a2"_a);
7574

7675
m.def(
7776
"tangential_adhesion_f0", &tangential_adhesion_f0,
@@ -85,7 +84,7 @@ void define_adhesion(py::module_& m)
8584
Returns:
8685
The tangential adhesion mollifier function at y.
8786
)ipc_Qu8mg5v7",
88-
py::arg("y"), py::arg("eps_a"));
87+
"y"_a, "eps_a"_a);
8988

9089
m.def(
9190
"tangential_adhesion_f1", &tangential_adhesion_f1,
@@ -99,7 +98,7 @@ void define_adhesion(py::module_& m)
9998
Returns:
10099
The first derivative of the tangential adhesion mollifier function at y.
101100
)ipc_Qu8mg5v7",
102-
py::arg("y"), py::arg("eps_a"));
101+
"y"_a, "eps_a"_a);
103102

104103
m.def(
105104
"tangential_adhesion_f2", &tangential_adhesion_f2,
@@ -113,7 +112,7 @@ void define_adhesion(py::module_& m)
113112
Returns:
114113
The second derivative of the tangential adhesion mollifier function at y.
115114
)ipc_Qu8mg5v7",
116-
py::arg("y"), py::arg("eps_a"));
115+
"y"_a, "eps_a"_a);
117116

118117
m.def(
119118
"tangential_adhesion_f1_over_x", &tangential_adhesion_f1_over_x,
@@ -127,7 +126,7 @@ void define_adhesion(py::module_& m)
127126
Returns:
128127
The first derivative of the tangential adhesion mollifier function divided by y.
129128
)ipc_Qu8mg5v7",
130-
py::arg("y"), py::arg("eps_a"));
129+
"y"_a, "eps_a"_a);
131130

132131
m.def(
133132
"tangential_adhesion_f2_x_minus_f1_over_x3",
@@ -142,5 +141,5 @@ void define_adhesion(py::module_& m)
142141
Returns:
143142
The second derivative of the tangential adhesion mollifier function times y minus the first derivative all divided by y cubed.
144143
)ipc_Qu8mg5v7",
145-
py::arg("y"), py::arg("eps_a"));
144+
"y"_a, "eps_a"_a);
146145
}

0 commit comments

Comments
 (0)