Skip to content

Commit cab9a72

Browse files
committed
Format
1 parent c03df40 commit cab9a72

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

python/src/potentials/barrier_potential.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void define_barrier_potential(py::module_& m)
5757
"hessian",
5858
py::overload_cast<
5959
const Collisions&, const CollisionMesh&, const Eigen::MatrixXd&,
60-
const ipc::PSDProjectionMethod>(&BarrierPotential::Potential::hessian, py::const_),
60+
const PSDProjectionMethod>(
61+
&BarrierPotential::Potential::hessian, py::const_),
6162
R"ipc_Qu8mg5v7(
6263
Compute the hessian of the barrier potential.
6364
@@ -71,7 +72,7 @@ void define_barrier_potential(py::module_& m)
7172
The hessian of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|x|vertices|.
7273
)ipc_Qu8mg5v7",
7374
py::arg("collisions"), py::arg("mesh"), py::arg("vertices"),
74-
py::arg("project_hessian_to_psd") = ipc::PSDProjectionMethod::NONE)
75+
py::arg("project_hessian_to_psd") = PSDProjectionMethod::NONE)
7576
.def(
7677
"shape_derivative",
7778
py::overload_cast<
@@ -125,7 +126,8 @@ void define_barrier_potential(py::module_& m)
125126
.def(
126127
"hessian",
127128
py::overload_cast<
128-
const Collision&, const VectorMax12d&, const PSDProjectionMethod>(
129+
const Collision&, const VectorMax12d&,
130+
const PSDProjectionMethod>(
129131
&BarrierPotential::hessian, py::const_),
130132
R"ipc_Qu8mg5v7(
131133
Compute the hessian of the potential for a single collision.
@@ -138,7 +140,7 @@ void define_barrier_potential(py::module_& m)
138140
The hessian of the potential.
139141
)ipc_Qu8mg5v7",
140142
py::arg("collision"), py::arg("x"),
141-
py::arg("project_hessian_to_psd") = ipc::PSDProjectionMethod::NONE)
143+
py::arg("project_hessian_to_psd") = PSDProjectionMethod::NONE)
142144
.def(
143145
"shape_derivative",
144146
[](const DistanceBasedPotential& self, const Collision& collision,

python/src/potentials/friction_potential.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ void define_friction_potential(py::module_& m)
179179
.def(
180180
"hessian",
181181
py::overload_cast<
182-
const FrictionCollision&, const VectorMax12d&, const PSDProjectionMethod>(
182+
const FrictionCollision&, const VectorMax12d&,
183+
const PSDProjectionMethod>(
183184
&FrictionPotential::hessian, py::const_),
184185
R"ipc_Qu8mg5v7(
185186
Compute the hessian of the potential for a single collision.

src/ipc/potentials/distance_based_potential.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class DistanceBasedPotential : public Potential<Collisions> {
5656
MatrixMax12d hessian(
5757
const Collision& collision,
5858
const VectorMax12d& positions,
59-
const PSDProjectionMethod project_hessian_to_psd = PSDProjectionMethod::NONE) const override;
59+
const PSDProjectionMethod project_hessian_to_psd =
60+
PSDProjectionMethod::NONE) const override;
6061

6162
/// @brief Compute the shape derivative of the potential for a single collision.
6263
/// @param[in] collision The collision.

src/ipc/potentials/friction_potential.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class FrictionPotential : public Potential<FrictionCollisions> {
109109
MatrixMax12d hessian(
110110
const FrictionCollision& collision,
111111
const VectorMax12d& velocities,
112-
const PSDProjectionMethod project_hessian_to_psd = PSDProjectionMethod::NONE) const override;
112+
const PSDProjectionMethod project_hessian_to_psd =
113+
PSDProjectionMethod::NONE) const override;
113114

114115
/// @brief Compute the friction force.
115116
/// @param collision The collision

src/ipc/potentials/potential.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ template <class TCollisions> class Potential {
4747
const TCollisions& collisions,
4848
const CollisionMesh& mesh,
4949
const Eigen::MatrixXd& X,
50-
const PSDProjectionMethod project_hessian_to_psd = PSDProjectionMethod::NONE) const;
50+
const PSDProjectionMethod project_hessian_to_psd =
51+
PSDProjectionMethod::NONE) const;
5152

5253
// -- Single collision methods ---------------------------------------------
5354

@@ -72,7 +73,8 @@ template <class TCollisions> class Potential {
7273
virtual MatrixMax12d hessian(
7374
const TCollision& collision,
7475
const VectorMax12d& x,
75-
const PSDProjectionMethod project_hessian_to_psd = PSDProjectionMethod::NONE) const = 0;
76+
const PSDProjectionMethod project_hessian_to_psd =
77+
PSDProjectionMethod::NONE) const = 0;
7678
};
7779

7880
} // namespace ipc

src/ipc/utils/eigen_ext.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ template <
152152
int _MaxCols>
153153
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
154154
project_to_psd(
155-
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>&
156-
A, PSDProjectionMethod type = PSDProjectionMethod::CLAMP);
155+
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& A,
156+
const PSDProjectionMethod method = PSDProjectionMethod::CLAMP);
157157

158158
inline Eigen::Vector3d to_3D(const VectorMax3d& v)
159159
{

src/ipc/utils/eigen_ext.tpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ template <
6363
int _MaxCols>
6464
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
6565
project_to_psd(
66-
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& A, PSDProjectionMethod type)
66+
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& A,
67+
const PSDProjectionMethod method)
6768
{
6869
assert(A.isApprox(A.transpose()) && "A must be symmetric");
6970

70-
if (type == PSDProjectionMethod::NONE)
71+
if (method == PSDProjectionMethod::NONE)
7172
return A;
7273

7374
// https://math.stackexchange.com/q/2776803
@@ -89,8 +90,7 @@ project_to_psd(
8990
// Save a little time and only project the negative values
9091
for (int i = 0; i < A.rows(); i++) {
9192
if (D.diagonal()[i] < 0.0) {
92-
switch (type)
93-
{
93+
switch (method) {
9494
case PSDProjectionMethod::CLAMP:
9595
D.diagonal()[i] = 0.0;
9696
break;

0 commit comments

Comments
 (0)