Skip to content
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
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);
26 changes: 11 additions & 15 deletions python/src/barrier/adaptive_stiffness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <ipc/candidates/candidates.hpp>
#include <ipc/collisions/normal/normal_collisions.hpp>

namespace py = pybind11;
using namespace ipc;

void define_adaptive_stiffness(py::module_& m)
Expand Down Expand Up @@ -42,10 +41,9 @@ void define_adaptive_stiffness(py::module_& m)
The initial barrier stiffness.
Maximum stiffness of the barrier.
)ipc_Qu8mg5v7",
py::arg("bbox_diagonal"), py::arg("barrier"), py::arg("dhat"),
py::arg("average_mass"), py::arg("grad_energy"),
py::arg("grad_barrier"), py::arg("min_barrier_stiffness_scale") = 1e11,
py::arg("dmin") = 0);
"bbox_diagonal"_a, "barrier"_a, "dhat"_a, "average_mass"_a,
"grad_energy"_a, "grad_barrier"_a,
"min_barrier_stiffness_scale"_a = 1e11, "dmin"_a = 0);

m.def(
"update_barrier_stiffness", &update_barrier_stiffness,
Expand All @@ -64,10 +62,9 @@ void define_adaptive_stiffness(py::module_& m)
Returns:
The updated barrier stiffness.
)ipc_Qu8mg5v7",
py::arg("prev_min_distance"), py::arg("min_distance"),
py::arg("max_barrier_stiffness"), py::arg("barrier_stiffness"),
py::arg("bbox_diagonal"), py::arg("dhat_epsilon_scale") = 1e-9,
py::arg("dmin") = 0);
"prev_min_distance"_a, "min_distance"_a, "max_barrier_stiffness"_a,
"barrier_stiffness"_a, "bbox_diagonal"_a, "dhat_epsilon_scale"_a = 1e-9,
"dmin"_a = 0);

m.def(
"semi_implicit_stiffness",
Expand All @@ -91,8 +88,7 @@ void define_adaptive_stiffness(py::module_& m)
Returns:
The semi-implicit stiffness.
)ipc_Qu8mg5v7",
py::arg("stencil"), py::arg("vertices"), py::arg("mass"),
py::arg("local_hess"), py::arg("dmin"));
"stencil"_a, "vertices"_a, "mass"_a, "local_hess"_a, "dmin"_a);

m.def(
"semi_implicit_stiffness",
Expand All @@ -117,8 +113,8 @@ void define_adaptive_stiffness(py::module_& m)
Returns:
The semi-implicit stiffness's.
)ipc_Qu8mg5v7",
py::arg("mesh"), py::arg("vertices"), py::arg("collisions"),
py::arg("vertex_masses"), py::arg("hess"), py::arg("dmin"));
"mesh"_a, "vertices"_a, "collisions"_a, "vertex_masses"_a, "hess"_a,
"dmin"_a);

m.def(
"semi_implicit_stiffness",
Expand All @@ -143,6 +139,6 @@ void define_adaptive_stiffness(py::module_& m)
Returns:
The semi-implicit stiffness's.
)ipc_Qu8mg5v7",
py::arg("mesh"), py::arg("vertices"), py::arg("collisions"),
py::arg("vertex_masses"), py::arg("hess"), py::arg("dmin"));
"mesh"_a, "vertices"_a, "collisions"_a, "vertex_masses"_a, "hess"_a,
"dmin"_a);
}
28 changes: 12 additions & 16 deletions python/src/barrier/barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <ipc/barrier/barrier.hpp>

namespace py = pybind11;
using namespace ipc;

class PyBarrier : public Barrier {
Expand All @@ -21,7 +20,7 @@ void define_barrier(py::module_& m)
py::class_<Barrier, PyBarrier, std::shared_ptr<Barrier>>(m, "Barrier")
.def(py::init<>())
.def(
"__call__", &Barrier::operator(), py::arg("d"), py::arg("dhat"),
"__call__", &Barrier::operator(), "d"_a, "dhat"_a,
R"ipc_Qu8mg5v7(
Evaluate the barrier function.

Expand All @@ -33,8 +32,7 @@ void define_barrier(py::module_& m)
The value of the barrier function at d.
)ipc_Qu8mg5v7")
.def(
"first_derivative", &Barrier::first_derivative, py::arg("d"),
py::arg("dhat"),
"first_derivative", &Barrier::first_derivative, "d"_a, "dhat"_a,
R"ipc_Qu8mg5v7(
Evaluate the first derivative of the barrier function wrt d.

Expand All @@ -46,8 +44,7 @@ void define_barrier(py::module_& m)
The value of the first derivative of the barrier function at d.
)ipc_Qu8mg5v7")
.def(
"second_derivative", &Barrier::second_derivative, py::arg("d"),
py::arg("dhat"),
"second_derivative", &Barrier::second_derivative, "d"_a, "dhat"_a,
R"ipc_Qu8mg5v7(
Evaluate the second derivative of the barrier function wrt d.

Expand All @@ -59,7 +56,7 @@ void define_barrier(py::module_& m)
The value of the second derivative of the barrier function at d.
)ipc_Qu8mg5v7")
.def(
"units", &Barrier::units, py::arg("dhat"),
"units", &Barrier::units, "dhat"_a,
R"ipc_Qu8mg5v7(
Get the units of the barrier function.

Expand Down Expand Up @@ -121,7 +118,8 @@ void define_barrier(py::module_& m)
.def(py::init());

m.def(
"barrier", &barrier,
"barrier", &barrier, "d"_a,
"dhat"_a
R"ipc_Qu8mg5v7(
Function that grows to infinity as d approaches 0 from the right.

Expand All @@ -135,11 +133,10 @@ void define_barrier(py::module_& m)

Returns:
The value of the barrier function at d.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat"));
)ipc_Qu8mg5v7");

m.def(
"barrier_first_derivative", &barrier_first_derivative,
"barrier_first_derivative", &barrier_first_derivative, "d"_a, "dhat"_a,
R"ipc_Qu8mg5v7(
Derivative of the barrier function.

Expand All @@ -154,11 +151,11 @@ void define_barrier(py::module_& m)

Returns:
The derivative of the barrier wrt d.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat"));
)ipc_Qu8mg5v7");

m.def(
"barrier_second_derivative", &barrier_second_derivative,
"barrier_second_derivative", &barrier_second_derivative, "d"_a,
"dhat"_a,
R"ipc_Qu8mg5v7(
Second derivative of the barrier function.

Expand All @@ -173,6 +170,5 @@ void define_barrier(py::module_& m)

Returns:
The second derivative of the barrier wrt d.
)ipc_Qu8mg5v7",
py::arg("d"), py::arg("dhat"));
)ipc_Qu8mg5v7");
}
10 changes: 4 additions & 6 deletions python/src/barrier/barrier_force_magnitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <ipc/barrier/barrier_force_magnitude.hpp>

namespace py = pybind11;
using namespace ipc;

void define_barrier_force_magnitude(py::module_& m)
Expand All @@ -22,8 +21,8 @@ void define_barrier_force_magnitude(py::module_& m)
Returns:
The magnitude of the force.
)ipc_Qu8mg5v7",
py::arg("distance_squared"), py::arg("barrier"), py::arg("dhat"),
py::arg("barrier_stiffness"), py::arg("dmin") = 0);
"distance_squared"_a, "barrier"_a, "dhat"_a, "barrier_stiffness"_a,
"dmin"_a = 0);

m.def(
"barrier_force_magnitude_gradient", &barrier_force_magnitude_gradient,
Expand All @@ -41,7 +40,6 @@ void define_barrier_force_magnitude(py::module_& m)
Returns:
The gradient of the force.
)ipc_Qu8mg5v7",
py::arg("distance_squared"), py::arg("distance_squared_gradient"),
py::arg("barrier"), py::arg("dhat"), py::arg("barrier_stiffness"),
py::arg("dmin") = 0);
"distance_squared"_a, "distance_squared_gradient"_a, "barrier"_a,
"dhat"_a, "barrier_stiffness"_a, "dmin"_a = 0);
}
2 changes: 0 additions & 2 deletions python/src/barrier/bindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <pybind11/pybind11.h>

namespace py = pybind11;

void define_adaptive_stiffness(py::module_& m);
void define_barrier_force_magnitude(py::module_& m);
void define_barrier(py::module_& m);
2 changes: 0 additions & 2 deletions python/src/bindings.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <common.hpp>
#include <bindings.hpp>

namespace py = pybind11;

PYBIND11_MODULE(ipctk, m)
{
// py::options options;
Expand Down
2 changes: 0 additions & 2 deletions python/src/bindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@

#include <pybind11/pybind11.h>

namespace py = pybind11;

void define_collision_mesh(py::module_& m);
void define_ipc(py::module_& m);
Loading