Skip to content

Commit e792543

Browse files
committed
Fix barrier docs
1 parent 2ea9bf7 commit e792543

File tree

6 files changed

+88
-16
lines changed

6 files changed

+88
-16
lines changed

cmake/recipes/eigen.cmake

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ if(EIGEN_WITH_MKL)
4444
EIGEN_USE_MKL_ALL
4545
EIGEN_USE_LAPACKE_STRICT
4646
)
47+
elseif(APPLE)
48+
target_link_libraries(Eigen3_Eigen INTERFACE
49+
"-framework Accelerate"
50+
"/opt/homebrew/opt/lapack/lib/liblapacke.dylib"
51+
)
52+
target_compile_definitions(Eigen3_Eigen INTERFACE
53+
EIGEN_USE_BLAS
54+
EIGEN_USE_LAPACKE_STRICT
55+
)
4756
endif()
4857

4958
# On Windows, enable natvis files to improve debugging experience

docs/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ pandoc
99
myst_parser==1.0.0
1010
sphinxcontrib-bibtex
1111
sphinxemoji
12-
sphinx-last-updated-by-git
12+
sphinx-last-updated-by-git
13+
sphinx-autobuild

docs/source/cpp-api/barrier.rst

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
Barrier
22
=======
33

4-
.. doxygenfunction:: barrier
5-
.. doxygenfunction:: barrier_gradient
6-
.. doxygenfunction:: barrier_hessian
4+
.. doxygenfunction:: ipc::barrier
5+
.. doxygenfunction:: ipc::barrier_first_derivative
6+
.. doxygenfunction:: ipc::barrier_second_derivative
77

88
Adaptive Barrier Stiffness
99
--------------------------
1010

11-
.. doxygenfunction:: initial_barrier_stiffness
12-
.. doxygenfunction:: update_barrier_stiffness
11+
.. doxygenfunction:: ipc::initial_barrier_stiffness
12+
.. doxygenfunction:: ipc::update_barrier_stiffness
13+
14+
Barrier Class
15+
-------------
16+
17+
.. doxygenclass:: ipc::Barrier
18+
19+
Clamped Log Barrier
20+
~~~~~~~~~~~~~~~~~~~
21+
22+
.. doxygenclass:: ipc::ClampedLogBarrier

docs/source/python-api/barrier.rst

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ Barrier
22
=======
33

44
.. autofunction:: ipctk.barrier
5-
.. autofunction:: ipctk.barrier_gradient
6-
.. autofunction:: ipctk.barrier_hessian
5+
.. autofunction:: ipctk.barrier_first_derivative
6+
.. autofunction:: ipctk.barrier_second_derivative
77

88
Adaptive Barrier Stiffness
99
--------------------------
1010

1111
.. autofunction:: ipctk.initial_barrier_stiffness
12-
.. autofunction:: ipctk.update_barrier_stiffness
12+
.. autofunction:: ipctk.update_barrier_stiffness
13+
14+
Barrier Class
15+
-------------
16+
17+
.. autoclass:: ipctk.Barrier
18+
19+
Clamped Log Barrier
20+
~~~~~~~~~~~~~~~~~~~
21+
22+
.. autoclass:: ipctk.ClampedLogBarrier

python/src/barrier/barrier.cpp

+47-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,59 @@ void define_barrier(py::module_& m)
2020
{
2121
py::class_<Barrier, PyBarrier, std::shared_ptr<Barrier>>(m, "Barrier")
2222
.def(py::init<>())
23-
.def("__call__", &Barrier::operator(), py::arg("d"), py::arg("dhat"))
23+
.def(
24+
"__call__", &Barrier::operator(), py::arg("d"), py::arg("dhat"),
25+
R"ipc_Qu8mg5v7(
26+
Evaluate the barrier function.
27+
28+
Parameters:
29+
d: The distance.
30+
dhat: Activation distance of the barrier.
31+
32+
Returns:
33+
The value of the barrier function at d.
34+
)ipc_Qu8mg5v7")
2435
.def(
2536
"first_derivative", &Barrier::first_derivative, py::arg("d"),
26-
py::arg("dhat"))
37+
py::arg("dhat"),
38+
R"ipc_Qu8mg5v7(
39+
Evaluate the first derivative of the barrier function wrt d.
40+
41+
Parameters:
42+
d: The distance.
43+
dhat: Activation distance of the barrier.
44+
45+
Returns:
46+
The value of the first derivative of the barrier function at d.
47+
)ipc_Qu8mg5v7")
2748
.def(
2849
"second_derivative", &Barrier::second_derivative, py::arg("d"),
29-
py::arg("dhat"))
30-
.def("units", &Barrier::units, py::arg("dhat"));
50+
py::arg("dhat"),
51+
R"ipc_Qu8mg5v7(
52+
Evaluate the second derivative of the barrier function wrt d.
53+
54+
Parameters:
55+
d: The distance.
56+
dhat: Activation distance of the barrier.
57+
58+
Returns:
59+
The value of the second derivative of the barrier function at d.
60+
)ipc_Qu8mg5v7")
61+
.def(
62+
"units", &Barrier::units, py::arg("dhat"),
63+
R"ipc_Qu8mg5v7(
64+
Get the units of the barrier function.
65+
66+
Parameters:
67+
dhat: Activation distance of the barrier.
68+
69+
Returns:
70+
The units of the barrier function.
71+
)ipc_Qu8mg5v7");
3172

3273
py::class_<ClampedLogBarrier, Barrier, std::shared_ptr<ClampedLogBarrier>>(
33-
m, "ClampedLogBarrier")
74+
m, "ClampedLogBarrier",
75+
"Smoothly clamped log barrier functions from [Li et al. 2020].")
3476
.def(py::init());
3577

3678
m.def(

src/ipc/barrier/barrier.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Barrier {
2121
/// @brief Evaluate the first derivative of the barrier function wrt d.
2222
/// @param d Distance.
2323
/// @param dhat Activation distance of the barrier.
24-
/// @retur The value of the first derivative of the barrier function at d.
24+
/// @return The value of the first derivative of the barrier function at d.
2525
virtual double
2626
first_derivative(const double d, const double dhat) const = 0;
2727

@@ -34,7 +34,7 @@ class Barrier {
3434

3535
/// @brief Get the units of the barrier function.
3636
/// @param dhat The activation distance of the barrier.
37-
/// @return The units of the barrier function.
37+
/// @return
3838
virtual double units(const double dhat) const = 0;
3939
};
4040

0 commit comments

Comments
 (0)