Skip to content

Commit

Permalink
forgot the condition on diagonal masses
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger committed Dec 9, 2024
1 parent 68402c1 commit 6e336a4
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <sofa/simulation/MechanicalOperations.h>
#include <sofa/simulation/VectorOperations.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/core/behavior/BaseMass.h>
#include <sofa/core/behavior/LinearSolver.h>
#include <sofa/helper/AdvancedTimer.h>
#include <sofa/helper/ScopedAdvancedTimer.h>
Expand Down Expand Up @@ -87,10 +88,16 @@ void EulerExplicitSolver::solve(const core::ExecParams* params,
sofa::Size nbNonDiagonalMasses = 0;
this->getContext()->accept(
sofa::core::objectmodel::topDownVisitor
| [&nbNonDiagonalMasses](sofa::core::behavior::BaseMass* mass){nbNonDiagonalMasses++;});
| [&nbNonDiagonalMasses](sofa::core::behavior::BaseMass* mass)
{
if (mass && !mass->isDiagonal())
{
nbNonDiagonalMasses++;
}
});

// Mass matrix is diagonal, solution can thus be found by computing acc = f/m
if(nbNonDiagonalMasses == 0.)
if(nbNonDiagonalMasses == 0)
{
// acc = M^-1 * f
computeAcceleration(&mop, acc, f);
Expand Down

0 comments on commit 6e336a4

Please sign in to comment.