Skip to content

Commit 924952c

Browse files
committed
compute force using mapping graph
1 parent 2038c92 commit 924952c

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

Sofa/Component/ODESolver/Backward/src/sofa/component/odesolver/backward/EulerImplicitSolver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ void EulerImplicitSolver::cleanup()
8282

8383
void EulerImplicitSolver::solve(const core::ExecParams* params, SReal dt, sofa::core::MultiVecCoordId xResult, sofa::core::MultiVecDerivId vResult)
8484
{
85+
m_mappingGraph.build(this->getContext());
86+
8587
#ifdef SOFA_DUMP_VISITOR_INFO
8688
sofa::simulation::Visitor::printNode("SolverVectorAllocation");
8789
#endif
@@ -126,7 +128,7 @@ void EulerImplicitSolver::solve(const core::ExecParams* params, SReal dt, sofa::
126128
SCOPED_TIMER("ComputeForce");
127129
mop->setImplicit(true); // this solver is implicit
128130
// compute the net forces at the beginning of the time step
129-
mop.computeForce(f); //f = Kx + Bv
131+
mop.computeForce(m_mappingGraph, f, true, true, nullptr);
130132

131133
msg_info() << "initial f = " << f;
132134
}

Sofa/Component/ODESolver/Backward/src/sofa/component/odesolver/backward/EulerImplicitSolver.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#pragma once
2323
#include <sofa/component/odesolver/backward/config.h>
2424
#include <sofa/core/behavior/LinearSolverAccessor.h>
25-
2625
#include <sofa/core/behavior/OdeSolver.h>
26+
#include <sofa/simulation/MappingGraph.h>
2727

2828
namespace sofa::simulation::common
2929
{
@@ -178,6 +178,8 @@ class SOFA_COMPONENT_ODESOLVER_BACKWARD_API EulerImplicitSolver :
178178
void reallocSolutionVector(sofa::simulation::common::VectorOperations* vop);
179179
void reallocRightHandSideVector(sofa::simulation::common::VectorOperations* vop);
180180
void reallocResidualVector(sofa::simulation::common::VectorOperations* vop);
181+
182+
sofa::simulation::MappingGraph m_mappingGraph;
181183
};
182184

183185
} // namespace sofa::component::odesolver::backward

Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void MechanicalOperations::computeForce(const MappingGraph& mappingGraph,
291291

292292
/**
293293
* Compute f += f(x) on all force fields in the mapping graph. This operation can be performed
294-
* in any order on all states in the graph, and can be parallelized among groups.
294+
* in any order on all states in the graph, and can be parallelized among component groups.
295295
*/
296296
mappingGraph.algorithms.traverseComponentGroups_([&](core::behavior::BaseForceField& forceField)
297297
{

0 commit comments

Comments
 (0)