Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Merged
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
20 changes: 10 additions & 10 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: PyPi Release

on:
workflow_dispatch:
release:
types: [published]
push:
branches:
- pypi
- main
- python
pull_request:
branches:
- main
# release:
# types: [published]
# push:
# branches:
# - pypi
# - main
# - python
# pull_request:
# branches:
# - main

jobs:
build_wheels:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Added
Changed
^^^^^^^

* Changed CMake target name to :cmake:`ipc::toolkit`
* Changed CMake target name to ``ipc::toolkit``

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

* Updated the CMake system to use modern :cpp:`FetchContent` to download externals
* Updated the CMake system to use modern ``FetchContent`` to download externals

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

* :cpp:`ignore_codimensional_vertices` to :cpp:`false` by default
* CMake option :cmake:`TIGHT_INCLUSION_WITH_NO_ZERO_TOI=ON` as default
* CMake option ``TIGHT_INCLUSION_WITH_NO_ZERO_TOI=ON`` as default

2021-06-18 (`aa59aeb <https://github.com/ipc-sim/ipc-toolkit/commit/aa59aeb0634af981a8f1cfbb6d2ff2b76a04d610>`__)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 4 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
# -- Project information -----------------------------------------------------

from datetime import datetime
import ipctk

import sys
sys.path.append(str(pathlib.Path(__file__).parents[2] / "python"))
from _find_ipctk import ipctk # noqa

project = "IPC Toolkit"
copyright = f'2020-{datetime.now().year}, IPC-Sim Organization; MIT License'
Expand Down
8 changes: 4 additions & 4 deletions docs/source/cpp-api/barrier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Adaptive Barrier Stiffness
Semi-Implicit Stiffness
~~~~~~~~~~~~~~~~~~~~~~~

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

Barrier Class
-------------
Expand All @@ -34,10 +34,10 @@ Clamped Log Barrier
.. doxygenclass:: ipc::ClampedLogBarrier
:allow-dot-graphs:

Normalized Clamped Log Barrier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Normalized Barrier
~~~~~~~~~~~~~~~~~~

.. doxygenclass:: ipc::NormalizedClampedLogBarrier
.. doxygenclass:: ipc::NormalizedBarrier
:allow-dot-graphs:

Clamped Log Squared Barrier
Expand Down
18 changes: 9 additions & 9 deletions docs/source/cpp-api/distance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Edge-Edge Mollifier
.. doxygenfunction:: edge_edge_cross_squarednorm
.. doxygenfunction:: ipc::edge_edge_cross_squarednorm_gradient
.. doxygenfunction:: ipc::edge_edge_cross_squarednorm_hessian
.. 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)
.. 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)
.. doxygenfunction:: edge_edge_mollifier(const double x, const double eps_x)
.. 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)
.. 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)
.. doxygenfunction:: edge_edge_mollifier_gradient(const double x, const double eps_x)
.. 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)
.. 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)
.. doxygenfunction:: edge_edge_mollifier_hessian(const double x, const double eps_x)

Edge-Edge
Expand Down Expand Up @@ -57,12 +57,12 @@ Point-Line
Point-Plane
-----------

.. 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)
.. 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)
.. 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)
.. 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)
.. 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)
.. 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)
.. doxygenfunction:: point_plane_distance(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
.. doxygenfunction:: point_plane_distance(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> t0, Eigen::ConstRef<Eigen::Vector3d> t1, Eigen::ConstRef<Eigen::Vector3d> t2)
.. doxygenfunction:: point_plane_distance_gradient(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
.. 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)
.. doxygenfunction:: point_plane_distance_hessian(Eigen::ConstRef<Eigen::Vector3d> p, Eigen::ConstRef<Eigen::Vector3d> origin, Eigen::ConstRef<Eigen::Vector3d> normal)
.. 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)

Point-Point
-----------
Expand Down
6 changes: 3 additions & 3 deletions docs/source/cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ C++
:end-before: <!--- BEGIN C++ README 2 --->

.. tip::
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`.
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``.

.. include:: ../../README.md
:parser: myst_parser.sphinx_
Expand All @@ -34,7 +34,7 @@ C++
.. _filib_dependency_note:

.. warning::
``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:
``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:

.. code-block:: cmake
Expand All @@ -47,7 +47,7 @@ C++
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>`_!

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.
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.

.. include:: ../../README.md
:parser: myst_parser.sphinx_
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Frequently Asked Questions
How do I include IPC Toolkit in my project?
-------------------------------------------

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.
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.

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

Expand Down
12 changes: 8 additions & 4 deletions docs/source/tutorial/nonlinear_ccd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ Let's dive deeper by breaking down the implementation of ``Rigid2DTrajectory``.

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


.. md-tab-item:: Python

.. literalinclude:: ../../../python/tests/test_ccd.py
:language: python
:lines: 90-94
:start-after: # BEGIN_RIGID_2D_CALL
:end-before: # END_RIGID_2D_CALL
:dedent: 8

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:
Expand All @@ -87,14 +89,16 @@ The second function we need to implement is ``max_distance_from_linear``.

.. literalinclude:: ../../../tests/src/tests/ccd/test_nonlinear_ccd.cpp
:language: c++
:lines: 136-147
:start-after: // BEGIN_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
:end-before: // END_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
:dedent: 4

.. md-tab-item:: Python

.. literalinclude:: ../../../python/tests/test_ccd.py
:language: python
:lines: 96-102
:start-after: # BEGIN_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
:end-before: # END_RIGID_2D_MAX_DISTANCE_FROM_LINEAR
:dedent: 8

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
Expand Down
24 changes: 4 additions & 20 deletions notebooks/find_ipctk.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
try:
import ipctk # Try to import the built module
except ImportError:
import sys
import pathlib
repo_root = pathlib.Path(__file__).parents[1]
possible_paths = [
pathlib.Path("python").resolve(),
repo_root / "build" / "python",
repo_root / "build" / "release" / "python",
repo_root / "build" / "debug" / "python",
]
for path in possible_paths:
if path.exists() and len(list(path.glob("ipctk.*"))) > 0:
sys.path.append(str(path))
break
else:
raise ImportError("Could not find the ipctk module")
print(f"Using found ipctk module at {path}")
import ipctk # Try again
import sys
import pathlib
sys.path.append(str(pathlib.Path(__file__).parents[1] / "python"))
from _find_ipctk import ipctk # noqa
20 changes: 20 additions & 0 deletions python/_find_ipctk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
try:
import ipctk # Try to import the built module
except ImportError:
import sys
import pathlib
repo_root = pathlib.Path(__file__).parents[1]
possible_paths = [
pathlib.Path("python").resolve(),
repo_root / "build" / "python",
repo_root / "build" / "release" / "python",
repo_root / "build" / "debug" / "python",
]
for path in possible_paths:
if path.exists() and len(list(path.glob("ipctk.*"))) > 0:
sys.path.append(str(path))
break
else:
raise ImportError("Could not find the ipctk module")
print(f"Using found ipctk module at {path}")
import ipctk # Try again
19 changes: 9 additions & 10 deletions python/src/adhesion/adhesion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <ipc/adhesion/adhesion.hpp>

namespace py = pybind11;
using namespace ipc;

void define_adhesion(py::module_& m)
Expand All @@ -21,7 +20,7 @@ void define_adhesion(py::module_& m)
Returns:
The normal adhesion potential.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);

m.def(
"normal_adhesion_potential_first_derivative",
Expand All @@ -38,7 +37,7 @@ void define_adhesion(py::module_& m)
Returns:
The first derivative of the normal adhesion potential wrt d.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);

m.def(
"normal_adhesion_potential_second_derivative",
Expand All @@ -55,7 +54,7 @@ void define_adhesion(py::module_& m)
Returns:
The second derivative of the normal adhesion potential wrt d.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
"d"_a, "dhat_p"_a, "dhat_a"_a, "a2"_a);

m.def(
"max_normal_adhesion_force_magnitude",
Expand All @@ -71,7 +70,7 @@ void define_adhesion(py::module_& m)
Returns:
The maximum normal adhesion force magnitude.
)ipc_Qu8mg5v7",
py::arg("dhat_p"), py::arg("dhat_a"), py::arg("a2"));
"dhat_p"_a, "dhat_a"_a, "a2"_a);

m.def(
"tangential_adhesion_f0", &tangential_adhesion_f0,
Expand All @@ -85,7 +84,7 @@ void define_adhesion(py::module_& m)
Returns:
The tangential adhesion mollifier function at y.
)ipc_Qu8mg5v7",
py::arg("y"), py::arg("eps_a"));
"y"_a, "eps_a"_a);

m.def(
"tangential_adhesion_f1", &tangential_adhesion_f1,
Expand All @@ -99,7 +98,7 @@ void define_adhesion(py::module_& m)
Returns:
The first derivative of the tangential adhesion mollifier function at y.
)ipc_Qu8mg5v7",
py::arg("y"), py::arg("eps_a"));
"y"_a, "eps_a"_a);

m.def(
"tangential_adhesion_f2", &tangential_adhesion_f2,
Expand All @@ -113,7 +112,7 @@ void define_adhesion(py::module_& m)
Returns:
The second derivative of the tangential adhesion mollifier function at y.
)ipc_Qu8mg5v7",
py::arg("y"), py::arg("eps_a"));
"y"_a, "eps_a"_a);

m.def(
"tangential_adhesion_f1_over_x", &tangential_adhesion_f1_over_x,
Expand All @@ -127,7 +126,7 @@ void define_adhesion(py::module_& m)
Returns:
The first derivative of the tangential adhesion mollifier function divided by y.
)ipc_Qu8mg5v7",
py::arg("y"), py::arg("eps_a"));
"y"_a, "eps_a"_a);

m.def(
"tangential_adhesion_f2_x_minus_f1_over_x3",
Expand All @@ -142,5 +141,5 @@ void define_adhesion(py::module_& m)
Returns:
The second derivative of the tangential adhesion mollifier function times y minus the first derivative all divided by y cubed.
)ipc_Qu8mg5v7",
py::arg("y"), py::arg("eps_a"));
"y"_a, "eps_a"_a);
}
2 changes: 0 additions & 2 deletions python/src/adhesion/bindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

#include <pybind11/pybind11.h>

namespace py = pybind11;

void define_adhesion(py::module_& m);
Loading