diff options
author | over0219 <over0219@umn.edu> | 2020-06-22 22:26:23 +0300 |
---|---|---|
committer | over0219 <over0219@umn.edu> | 2020-06-22 22:26:23 +0300 |
commit | c214acce20b6066dd8b0f70dfa16a597059358a6 (patch) | |
tree | 34a48d8e1ad91a9be0b80e0b80f2c263528ac4c3 /extern/softbody/src/admmpd_solver.cpp | |
parent | 688643c9fdf19802fe7c3bb4e6b53754fa9e7cca (diff) |
fixed issue with rand causing mem error
Diffstat (limited to 'extern/softbody/src/admmpd_solver.cpp')
-rw-r--r-- | extern/softbody/src/admmpd_solver.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/extern/softbody/src/admmpd_solver.cpp b/extern/softbody/src/admmpd_solver.cpp index 706eb9dce11..03680425427 100644 --- a/extern/softbody/src/admmpd_solver.cpp +++ b/extern/softbody/src/admmpd_solver.cpp @@ -11,6 +11,7 @@ #include <stdio.h> #include <iostream> +#include <unordered_map> #include "BLI_task.h" // threading #include "BLI_assert.h" @@ -163,12 +164,12 @@ void Solver::update_constraints( std::vector<Eigen::Triplet<double> > trips_z; // TODO collision detection - FloorCollider().jacobian( - &data->x, - &trips_x, - &trips_y, - &trips_z, - &l_coeffs); +// FloorCollider().jacobian( +// &data->x, +// &trips_x, +// &trips_y, +// &trips_z, +// &l_coeffs); // Check number of constraints. // If no constraints, clear Jacobian. @@ -418,6 +419,16 @@ void Solver::compute_masses( data->m[tet[2]] += tet_mass / 4.f; data->m[tet[3]] += tet_mass / 4.f; } + // Verify masses + int nx = data->m.rows(); + for (int i=0; i<nx; ++i) + { + if (data->m[i] <= 0.0) + { + printf("**Solver::compute_masses Error: unreferenced vertex\n"); + data->m[i]=1; + } + } } // end compute masses void Solver::append_energies( |