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

Commit 7a1627e

Browse files
committed
format files
1 parent 3b19523 commit 7a1627e

File tree

3 files changed

+37
-28
lines changed

3 files changed

+37
-28
lines changed

python/src/collision_mesh.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ void define_collision_mesh(py::module_& m)
151151
"displacement_map"_a = Eigen::SparseMatrix<double>())
152152
.def(
153153
py::init<
154-
const std::vector<bool>&, const std::vector<bool>&, Eigen::ConstRef<Eigen::MatrixXd>,
154+
const std::vector<bool>&, const std::vector<bool>&,
155+
Eigen::ConstRef<Eigen::MatrixXd>,
155156
Eigen::ConstRef<Eigen::MatrixXi>,
156157
Eigen::ConstRef<Eigen::MatrixXi>,
157158
const Eigen::SparseMatrix<double>&>(),

python/src/collisions/normal/normal_collisions.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ template <typename collision_type, typename parent_type>
99
void define_SmoothCollisionTemplate(py::module_& m, std::string name)
1010
{
1111
py::class_<collision_type, parent_type>(m, name.c_str())
12-
.def("name", &collision_type::name, "Get the type name of collision")
13-
.def("num_vertices", &collision_type::num_vertices, "Get the number of vertices");
12+
.def("name", &collision_type::name, "Get the type name of collision")
13+
.def(
14+
"num_vertices", &collision_type::num_vertices,
15+
"Get the number of vertices");
1416
}
1517

1618
void define_SmoothCollisions(py::module_& m, std::string name)
@@ -20,7 +22,9 @@ void define_SmoothCollisions(py::module_& m, std::string name)
2022
.def(
2123
"build",
2224
py::overload_cast<
23-
const CollisionMesh&, Eigen::ConstRef<Eigen::MatrixXd>, const ParameterType, const bool, std::shared_ptr<BroadPhase>>(&SmoothCollisions::build),
25+
const CollisionMesh&, Eigen::ConstRef<Eigen::MatrixXd>,
26+
const ParameterType, const bool, std::shared_ptr<BroadPhase>>(
27+
&SmoothCollisions::build),
2428
R"ipc_Qu8mg5v7(
2529
Initialize the set of collisions used to compute the barrier potential.
2630
@@ -32,9 +36,11 @@ void define_SmoothCollisions(py::module_& m, std::string name)
3236
broad_phase: Broad phase method.
3337
)ipc_Qu8mg5v7",
3438
py::arg("mesh"), py::arg("vertices"), py::arg("param"),
35-
py::arg("use_adaptive_dhat") = false, py::arg("broad_phase") = make_default_broad_phase())
39+
py::arg("use_adaptive_dhat") = false,
40+
py::arg("broad_phase") = make_default_broad_phase())
3641
.def(
37-
"compute_minimum_distance", &SmoothCollisions::compute_minimum_distance,
42+
"compute_minimum_distance",
43+
&SmoothCollisions::compute_minimum_distance,
3844
R"ipc_Qu8mg5v7(
3945
Computes the minimum distance between any non-adjacent elements.
4046
@@ -46,12 +52,16 @@ void define_SmoothCollisions(py::module_& m, std::string name)
4652
The minimum distance between any non-adjacent elements.
4753
)ipc_Qu8mg5v7",
4854
py::arg("mesh"), py::arg("vertices"))
49-
.def("__len__", &SmoothCollisions::size, "Get the number of collisions.")
50-
.def("empty", &SmoothCollisions::empty, "Get if the collision set is empty.")
55+
.def(
56+
"__len__", &SmoothCollisions::size, "Get the number of collisions.")
57+
.def(
58+
"empty", &SmoothCollisions::empty,
59+
"Get if the collision set is empty.")
5160
.def("clear", &SmoothCollisions::clear, "Clear the collision set.")
5261
.def(
5362
"__getitem__",
54-
[](SmoothCollisions& self, size_t i) -> typename SmoothCollisions::value_type& { return self[i]; },
63+
[](SmoothCollisions& self, size_t i) ->
64+
typename SmoothCollisions::value_type& { return self[i]; },
5565
py::return_value_policy::reference,
5666
R"ipc_Qu8mg5v7(
5767
Get a reference to collision at index i.
@@ -66,7 +76,9 @@ void define_SmoothCollisions(py::module_& m, std::string name)
6676
.def(
6777
"to_string", &SmoothCollisions::to_string, py::arg("mesh"),
6878
py::arg("vertices"), py::arg("param"))
69-
.def("n_candidates", &SmoothCollisions::n_candidates, "Get the number of candidates.");
79+
.def(
80+
"n_candidates", &SmoothCollisions::n_candidates,
81+
"Get the number of candidates.");
7082
}
7183

7284
void define_normal_collisions(py::module_& m)
@@ -228,8 +240,7 @@ void define_normal_collisions(py::module_& m)
228240
py::class_<SmoothCollision>(m, "SmoothCollision2")
229241
.def("n_dofs", &SmoothCollision::n_dofs, "Get the degree of freedom")
230242
.def(
231-
"__call__",
232-
&SmoothCollision::operator(),
243+
"__call__", &SmoothCollision::operator(),
233244
R"ipc_Qu8mg5v7(
234245
Compute the potential.
235246
@@ -255,8 +266,12 @@ void define_normal_collisions(py::module_& m)
255266
)ipc_Qu8mg5v7",
256267
py::arg("i"));
257268

258-
define_SmoothCollisionTemplate<SmoothCollisionTemplate<Edge2, Point2>, SmoothCollision>(m, "Edge2Point2Collision");
259-
define_SmoothCollisionTemplate<SmoothCollisionTemplate<Point2, Point2>, SmoothCollision>(m, "Point2Point2Collision");
269+
define_SmoothCollisionTemplate<
270+
SmoothCollisionTemplate<Edge2, Point2>, SmoothCollision>(
271+
m, "Edge2Point2Collision");
272+
define_SmoothCollisionTemplate<
273+
SmoothCollisionTemplate<Point2, Point2>, SmoothCollision>(
274+
m, "Point2Point2Collision");
260275

261276
define_SmoothCollisions(m, "SmoothCollisions");
262277
}

python/src/potentials/barrier_potential.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ void define_smooth_potential(py::module_& m)
7171
.def_readonly("beta_n", &ParameterType::beta_n)
7272
.def_readonly("r", &ParameterType::r);
7373

74-
py::class_<SmoothContactPotential>(
75-
m, "SmoothPotential")
74+
py::class_<SmoothContactPotential>(m, "SmoothPotential")
7675
.def(
7776
py::init<const ParameterType&>(),
7877
R"ipc_Qu8mg5v7(
@@ -87,8 +86,7 @@ void define_smooth_potential(py::module_& m)
8786
py::overload_cast<
8887
const SmoothCollisions&, const CollisionMesh&,
8988
Eigen::ConstRef<Eigen::MatrixXd>>(
90-
&ipc::SmoothContactPotential::operator(),
91-
py::const_),
89+
&ipc::SmoothContactPotential::operator(), py::const_),
9290
R"ipc_Qu8mg5v7(
9391
Compute the barrier potential for a set of collisions.
9492
@@ -106,8 +104,7 @@ void define_smooth_potential(py::module_& m)
106104
py::overload_cast<
107105
const SmoothCollisions&, const CollisionMesh&,
108106
Eigen::ConstRef<Eigen::MatrixXd>>(
109-
&ipc::SmoothContactPotential::gradient,
110-
py::const_),
107+
&ipc::SmoothContactPotential::gradient, py::const_),
111108
R"ipc_Qu8mg5v7(
112109
Compute the gradient of the barrier potential.
113110
@@ -125,8 +122,7 @@ void define_smooth_potential(py::module_& m)
125122
py::overload_cast<
126123
const SmoothCollisions&, const CollisionMesh&,
127124
Eigen::ConstRef<Eigen::MatrixXd>, const PSDProjectionMethod>(
128-
&ipc::SmoothContactPotential::hessian,
129-
py::const_),
125+
&ipc::SmoothContactPotential::hessian, py::const_),
130126
R"ipc_Qu8mg5v7(
131127
Compute the hessian of the barrier potential.
132128
@@ -145,8 +141,7 @@ void define_smooth_potential(py::module_& m)
145141
"__call__",
146142
py::overload_cast<
147143
const SmoothCollision&, Eigen::ConstRef<Eigen::VectorXd>>(
148-
&ipc::SmoothContactPotential::operator(),
149-
py::const_),
144+
&ipc::SmoothContactPotential::operator(), py::const_),
150145
R"ipc_Qu8mg5v7(
151146
Compute the potential for a single collision.
152147
@@ -162,8 +157,7 @@ void define_smooth_potential(py::module_& m)
162157
"gradient",
163158
py::overload_cast<
164159
const SmoothCollision&, Eigen::ConstRef<Eigen::VectorXd>>(
165-
&SmoothContactPotential::gradient,
166-
py::const_),
160+
&SmoothContactPotential::gradient, py::const_),
167161
R"ipc_Qu8mg5v7(
168162
Compute the gradient of the potential for a single collision.
169163
@@ -180,8 +174,7 @@ void define_smooth_potential(py::module_& m)
180174
py::overload_cast<
181175
const SmoothCollision&, Eigen::ConstRef<Eigen::VectorXd>,
182176
const PSDProjectionMethod>(
183-
&SmoothContactPotential::hessian,
184-
py::const_),
177+
&SmoothContactPotential::hessian, py::const_),
185178
R"ipc_Qu8mg5v7(
186179
Compute the hessian of the potential for a single collision.
187180

0 commit comments

Comments
 (0)