[Bf-blender-cvs] [95a9646c00a] master: Cleanup: comments (long lines) in physics
Campbell Barton
noreply at git.blender.org
Tue Apr 30 06:53:32 CEST 2019
Commit: 95a9646c00a1cbf727f24c506c4aeffe99016352
Author: Campbell Barton
Date: Tue Apr 30 14:41:33 2019 +1000
Branches: master
https://developer.blender.org/rB95a9646c00a1cbf727f24c506c4aeffe99016352
Cleanup: comments (long lines) in physics
===================================================================
M source/blender/physics/intern/BPH_mass_spring.cpp
M source/blender/physics/intern/ConstrainedConjugateGradient.h
M source/blender/physics/intern/eigen_utils.h
M source/blender/physics/intern/hair_volume.cpp
M source/blender/physics/intern/implicit_blender.c
M source/blender/physics/intern/implicit_eigen.cpp
===================================================================
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 8eb22bd57ad..f7a9cadc9cf 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -232,7 +232,7 @@ static void cloth_setup_constraints(ClothModifierData *clmd,
ColliderContacts *ct = &contacts[i];
for (j = 0; j < ct->totcollisions; ++j) {
CollPair *collpair = &ct->collisions[j];
- // float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - ct->ob->pd->pdef_sbdamp);
+ // float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - ct->ob->pd->pdef_sbdamp);
float restitution = 0.0f;
int v = collpair->face1;
float impulse[3];
@@ -334,7 +334,7 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob),
sub_v3_v3v3(vec, cos[i], cv->tx);
mul_v3_fl(vec, cv->mass * dt * 20.0f);
add_v3_v3(cv->tv, vec);
- //copy_v3_v3(cv->tx, cos[i]);
+ // copy_v3_v3(cv->tx, cos[i]);
}
MEM_freeN(cos);
@@ -382,8 +382,9 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
k_tension = scaling_tension / (parms->avg_spring_len + FLT_EPSILON);
if (s->type & CLOTH_SPRING_TYPE_SEWING) {
- // TODO: verify, half verified (couldn't see error)
- // sewing springs usually have a large distance at first so clamp the force so we don't get tunnelling through colission objects
+ /* TODO: verify, half verified (couldn't see error)
+ * sewing springs usually have a large distance at first so clamp the force so we don't get
+ * tunnelling through colission objects */
BPH_mass_spring_force_spring_linear(data,
s->ij,
s->kl,
@@ -459,9 +460,9 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
- /* XXX WARNING: angular bending springs for hair apply stiffness factor as an overall factor, unlike cloth springs!
- * this is crap, but needed due to cloth/hair mixing ...
- * max_bend factor is not even used for hair, so ...
+ /* XXX WARNING: angular bending springs for hair apply stiffness factor as an overall factor,
+ * unlike cloth springs! this is crap, but needed due to cloth/hair mixing ... max_bend factor
+ * is not even used for hair, so ...
*/
scaling = s->lin_stiffness * parms->bending;
kb = scaling / (20.0f * (parms->avg_spring_len + FLT_EPSILON));
@@ -469,7 +470,8 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
// Fix for [#45084] for cloth stiffness must have cb proportional to kb
cb = kb * parms->bending_damping;
- /* XXX assuming same restlen for ij and jk segments here, this can be done correctly for hair later */
+ /* XXX assuming same restlen for ij and jk segments here,
+ * this can be done correctly for hair later. */
BPH_mass_spring_force_spring_bending_hair(data, s->ij, s->kl, s->mn, s->target, kb, cb);
# if 0
@@ -487,8 +489,8 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s)
BKE_sim_debug_data_add_vector(
clmd->debug_data, x_kl, d, 0.8, 0.8, 0.2, "target", 7982, s->kl);
- // copy_v3_v3(d, s->target_ij);
- // BKE_sim_debug_data_add_vector(clmd->debug_data, x, d, 1, 0.4, 0.4, "target", 7983, s->kl);
+ // copy_v3_v3(d, s->target_ij);
+ // BKE_sim_debug_data_add_vector(clmd->debug_data, x, d, 1, 0.4, 0.4, "target", 7983, s->kl);
}
# endif
#endif
@@ -861,12 +863,18 @@ static void cloth_continuum_step(ClothModifierData *clmd, float dt)
BPH_hair_volume_grid_interpolate(grid, x, &gdensity, gvel, gvel_smooth, NULL, NULL);
- // BKE_sim_debug_data_add_circle(clmd->debug_data, x, gdensity, 0.7, 0.3, 1, "grid density", i, j, 3111);
+ // BKE_sim_debug_data_add_circle(
+ // clmd->debug_data, x, gdensity, 0.7, 0.3, 1,
+ // "grid density", i, j, 3111);
if (!is_zero_v3(gvel) || !is_zero_v3(gvel_smooth)) {
float dvel[3];
sub_v3_v3v3(dvel, gvel_smooth, gvel);
- // BKE_sim_debug_data_add_vector(clmd->debug_data, x, gvel, 0.4, 0, 1, "grid velocity", i, j, 3112);
- // BKE_sim_debug_data_add_vector(clmd->debug_data, x, gvel_smooth, 0.6, 1, 1, "grid velocity", i, j, 3113);
+ // BKE_sim_debug_data_add_vector(
+ // clmd->debug_data, x, gvel, 0.4, 0, 1,
+ // "grid velocity", i, j, 3112);
+ // BKE_sim_debug_data_add_vector(
+ // clmd->debug_data, x, gvel_smooth, 0.6, 1, 1,
+ // "grid velocity", i, j, 3113);
BKE_sim_debug_data_add_vector(
clmd->debug_data, x, dvel, 0.4, 1, 0.7, "grid velocity", i, j, 3114);
# if 0
@@ -875,10 +883,16 @@ static void cloth_continuum_step(ClothModifierData *clmd, float dt)
float col1[3] = {0.0, 1.0, 0.0};
float col[3];
- interp_v3_v3v3(col, col0, col1, CLAMPIS(gdensity * clmd->sim_parms->density_strength, 0.0, 1.0));
-// BKE_sim_debug_data_add_circle(clmd->debug_data, x, gdensity * clmd->sim_parms->density_strength, 0, 1, 0.4, "grid velocity", i, j, 3115);
-// BKE_sim_debug_data_add_dot(clmd->debug_data, x, col[0], col[1], col[2], "grid velocity", i, j, 3115);
- BKE_sim_debug_data_add_circle(clmd->debug_data, x, 0.01f, col[0], col[1], col[2], "grid velocity", i, j, 3115);
+ interp_v3_v3v3(col, col0, col1,
+ CLAMPIS(gdensity * clmd->sim_parms->density_strength, 0.0, 1.0));
+ // BKE_sim_debug_data_add_circle(
+ // clmd->debug_data, x, gdensity * clmd->sim_parms->density_strength, 0, 1, 0.4,
+ // "grid velocity", i, j, 3115);
+ // BKE_sim_debug_data_add_dot(
+ // clmd->debug_data, x, col[0], col[1], col[2],
+ // "grid velocity", i, j, 3115);
+ BKE_sim_debug_data_add_circle(
+ clmd->debug_data, x, 0.01f, col[0], col[1], col[2], "grid velocity", i, j, 3115);
}
# endif
}
@@ -1118,7 +1132,8 @@ int BPH_cloth_solve(
if (clmd->sim_parms->vgroup_mass > 0) {
if (verts[i].flags & CLOTH_VERT_FLAG_PINNED) {
float x[3];
- /* divide by time_scale to prevent pinned vertices' delta locations from being multiplied */
+ /* divide by time_scale to prevent pinned vertices'
+ * delta locations from being multiplied */
interp_v3_v3v3(
x, verts[i].xold, verts[i].xconst, (step + dt) / clmd->sim_parms->time_scale);
BPH_mass_spring_set_position(id, i, x);
diff --git a/source/blender/physics/intern/ConstrainedConjugateGradient.h b/source/blender/physics/intern/ConstrainedConjugateGradient.h
index 8d375d00056..4a0a6ab298c 100644
--- a/source/blender/physics/intern/ConstrainedConjugateGradient.h
+++ b/source/blender/physics/intern/ConstrainedConjugateGradient.h
@@ -31,9 +31,11 @@ namespace internal {
* \param rhs: The right hand side vector b
* \param x: On input and initial solution, on output the computed solution.
* \param precond: A preconditioner being able to efficiently solve for an
- * approximation of Ax=b (regardless of b)
- * \param iters: On input the max number of iteration, on output the number of performed iterations.
- * \param tol_error: On input the tolerance error, on output an estimation of the relative error.
+ * approximation of Ax=b (regardless of b)
+ * \param iters: On input the max number of iteration,
+ * on output the number of performed iterations.
+ * \param tol_error: On input the tolerance error,
+ * on output an estimation of the relative error.
*/
template<typename MatrixType,
typename Rhs,
@@ -59,7 +61,7 @@ EIGEN_DONT_INLINE void constrained_conjugate_gradient(const MatrixType &mat,
int n = mat.cols();
- VectorType residual = filter * (rhs - mat * x); //initial residual
+ VectorType residual = filter * (rhs - mat * x); // initial residual
RealScalar rhsNorm2 = (filter * rhs).squaredNorm();
if (rhsNorm2 == 0) {
@@ -78,7 +80,7 @@ EIGEN_DONT_INLINE void constrained_conjugate_gradient(const MatrixType &mat,
}
VectorType p(n);
- p = filter * precond.solve(residual); //initial search direction
+ p = filter * precond.solve(residual); // initial search direction
VectorType z(n), tmp(n);
RealScalar absNew = numext::real(
@@ -157,17 +159,18 @@ struct traits<
/** \ingroup IterativeLinearSolvers_Module
* \brief A conjugate gradient solver for sparse self-adjoint problems with additional constraints
*
- * This class allows to solve for A.x = b sparse linear problems using a conjugate gradient algorithm.
- * The sparse matrix A must be selfadjoint. The vectors x and b can be either dense or sparse.
+ * This class allows to solve for A.x = b sparse linear problems using a conjugate gradient
+ * algorithm. The sparse matrix A must be selfadjoint. The vectors x and b can be either dense or
+ * sparse.
*
* \tparam _MatrixType the type of the sparse matrix A, can be a dense or a sparse matrix.
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
* or Upper. Default is Lower.
* \tparam _Preconditioner the type of the preconditioner. Default is DiagonalPreconditioner
*
- * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations()
- * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations
- * and NumTraits<Scalar>::epsilon() for the tolerance.
+ * The maximal number of iterations and tolerance value can be controlled via the
+ * setMaxIterations() and setTolerance() methods. The defaults are the size of the problem for the
+ * maximal number of iterations and NumTr
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list