@@ -76,21 +76,23 @@ void define_barrier_potential(py::module_& m)
7676 .def (
7777 " shape_derivative" ,
7878 py::overload_cast<
79- const CollisionsBase &, const CollisionMesh&,
79+ const Collisions &, const CollisionMesh&,
8080 const Eigen::MatrixXd&>(
8181 &BarrierPotential::shape_derivative, py::const_),
8282 R"ipc_Qu8mg5v7(
8383 Compute the shape derivative of the potential.
8484
85- std::runtime_error If the collision collisions were not built with shape derivatives enabled.
85+ std::runtime_error If the collision collisions were not built
86+ with shape derivatives enabled.
8687
8788 Parameters:
8889 collisions: The set of collisions.
8990 mesh: The collision mesh.
9091 vertices: Vertices of the collision mesh.
9192
9293 Returns:
93- The derivative of the force with respect to X, the rest vertices.
94+ The derivative of the force with respect to X, the rest
95+ vertices.
9496 )ipc_Qu8mg5v7" ,
9597 py::arg (" collisions" ), py::arg (" mesh" ), py::arg (" vertices" ))
9698 .def (
@@ -142,7 +144,8 @@ void define_barrier_potential(py::module_& m)
142144 py::arg (" project_hessian_to_psd" ) = false )
143145 .def (
144146 " shape_derivative" ,
145- [](const DistanceBasedPotential& self, const Collision<4 >& collision,
147+ [](const DistanceBasedPotential& self,
148+ const Collision<4 >& collision,
146149 const std::array<long , 4 >& vertex_ids,
147150 const VectorMax12d& rest_positions,
148151 const VectorMax12d& positions) {
@@ -180,33 +183,39 @@ void define_smooth_potential(py::module_& m)
180183{
181184 py::class_<ParameterType>(m, " ParameterType" )
182185 .def (
183- py::init<const double &,const double &,const double &,const double &,const double &,
184- const int &>(),
186+ py::init<
187+ const double &, const double &, const double &, const double &,
188+ const double &, const int &, const int &>(),
185189 R"ipc_Qu8mg5v7(
186190 Construct parameter set for smooth contact.
187191
188192 Parameters:
189193 dhat, alpha_t, beta_t, alpha_n, beta_n, r
190194 )ipc_Qu8mg5v7" ,
191- py::arg (" dhat" ), py::arg (" alpha_t" ), py::arg (" beta_t" ), py::arg (" alpha_n" ),
192- py::arg (" beta_n" ), py::arg (" r" ))
195+ py::arg (" dhat" ), py::arg (" alpha_t" ), py::arg (" beta_t" ),
196+ py::arg (" alpha_n" ), py::arg (" beta_n" ), py::arg (" r" ),
197+ py::arg (" n_quadrature_samples" ))
193198 .def (
194- py::init<const double &,const double &,const double &,const int &>(),
199+ py::init<const double &, const double &, const double &, const int &>(),
195200 R"ipc_Qu8mg5v7(
196201 Construct parameter set for smooth contact.
197202
198203 Parameters:
199204 dhat, alpha_t, beta_t, r
200205 )ipc_Qu8mg5v7" ,
201- py::arg (" dhat" ), py::arg (" alpha_t" ), py::arg (" beta_t" ), py::arg (" r" ))
206+ py::arg (" dhat" ), py::arg (" alpha_t" ), py::arg (" beta_t" ),
207+ py::arg (" r" ))
202208 .def_readonly (" dhat" , &ParameterType::dhat)
203209 .def_readonly (" alpha_t" , &ParameterType::alpha_t )
204210 .def_readonly (" beta_t" , &ParameterType::beta_t )
205211 .def_readonly (" alpha_n" , &ParameterType::alpha_n)
206212 .def_readonly (" beta_n" , &ParameterType::beta_n)
207- .def_readonly (" r" , &ParameterType::r);
213+ .def_readonly (" r" , &ParameterType::r)
214+ .def_readonly (
215+ " n_quadrature_samples" , &ParameterType::n_quadrature_samples);
208216
209- py::class_<SmoothContactPotential<SmoothCollisions<2 >>>(m, " SmoothPotential" )
217+ py::class_<SmoothContactPotential<SmoothCollisions<2 >>>(
218+ m, " SmoothPotential" )
210219 .def (
211220 py::init<const ParameterType&>(),
212221 R"ipc_Qu8mg5v7(
@@ -221,7 +230,9 @@ void define_smooth_potential(py::module_& m)
221230 py::overload_cast<
222231 const SmoothCollisions<2 >&, const CollisionMesh&,
223232 const Eigen::MatrixXd&>(
224- &SmoothContactPotential<SmoothCollisions<2 >>::Potential::operator (), py::const_),
233+ &SmoothContactPotential<
234+ SmoothCollisions<2 >>::Potential::operator (),
235+ py::const_),
225236 R"ipc_Qu8mg5v7(
226237 Compute the barrier potential for a set of collisions.
227238
@@ -239,7 +250,9 @@ void define_smooth_potential(py::module_& m)
239250 py::overload_cast<
240251 const SmoothCollisions<2 >&, const CollisionMesh&,
241252 const Eigen::MatrixXd&>(
242- &SmoothContactPotential<SmoothCollisions<2 >>::Potential::gradient, py::const_),
253+ &SmoothContactPotential<
254+ SmoothCollisions<2 >>::Potential::gradient,
255+ py::const_),
243256 R"ipc_Qu8mg5v7(
244257 Compute the gradient of the barrier potential.
245258
@@ -255,8 +268,11 @@ void define_smooth_potential(py::module_& m)
255268 .def (
256269 " hessian" ,
257270 py::overload_cast<
258- const SmoothCollisions<2 >&, const CollisionMesh&, const Eigen::MatrixXd&,
259- const bool >(&SmoothContactPotential<SmoothCollisions<2 >>::Potential::hessian, py::const_),
271+ const SmoothCollisions<2 >&, const CollisionMesh&,
272+ const Eigen::MatrixXd&, const bool >(
273+ &SmoothContactPotential<
274+ SmoothCollisions<2 >>::Potential::hessian,
275+ py::const_),
260276 R"ipc_Qu8mg5v7(
261277 Compute the hessian of the barrier potential.
262278
@@ -273,8 +289,10 @@ void define_smooth_potential(py::module_& m)
273289 py::arg (" project_hessian_to_psd" ) = false )
274290 .def (
275291 " __call__" ,
276- py::overload_cast<const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&>(
277- &SmoothContactPotential<SmoothCollisions<2 >>::operator (), py::const_),
292+ py::overload_cast<
293+ const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&>(
294+ &SmoothContactPotential<SmoothCollisions<2 >>::operator (),
295+ py::const_),
278296 R"ipc_Qu8mg5v7(
279297 Compute the potential for a single collision.
280298
@@ -288,8 +306,10 @@ void define_smooth_potential(py::module_& m)
288306 py::arg (" collision" ), py::arg (" x" ))
289307 .def (
290308 " gradient" ,
291- py::overload_cast<const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&>(
292- &SmoothContactPotential<SmoothCollisions<2 >>::gradient, py::const_),
309+ py::overload_cast<
310+ const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&>(
311+ &SmoothContactPotential<SmoothCollisions<2 >>::gradient,
312+ py::const_),
293313 R"ipc_Qu8mg5v7(
294314 Compute the gradient of the potential for a single collision.
295315
@@ -304,8 +324,10 @@ void define_smooth_potential(py::module_& m)
304324 .def (
305325 " hessian" ,
306326 py::overload_cast<
307- const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&, const bool >(
308- &SmoothContactPotential<SmoothCollisions<2 >>::hessian, py::const_),
327+ const SmoothCollision<6 >&, const Vector<double , -1 , 18 >&,
328+ const bool >(
329+ &SmoothContactPotential<SmoothCollisions<2 >>::hessian,
330+ py::const_),
309331 R"ipc_Qu8mg5v7(
310332 Compute the hessian of the potential for a single collision.
311333
0 commit comments