diff --git a/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/TypedMatrixLinearSystem.inl b/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/TypedMatrixLinearSystem.inl index 21e5cef1dfa..291532a7306 100644 --- a/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/TypedMatrixLinearSystem.inl +++ b/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/TypedMatrixLinearSystem.inl @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include @@ -111,8 +109,11 @@ void TypedMatrixLinearSystem::copyLocalVectorToGlobalVector(co globalVector->resize(m_mappingGraph.getTotalNbMainDofs()); } - AssembleGlobalVectorFromLocalVectorVisitor(core::execparams::defaultInstance(), m_mappingGraph, v, globalVector) - .execute(getSolveContext()); + for (auto& state : m_mappingGraph.getMainMechanicalStates()) + { + auto pos = m_mappingGraph.getPositionInGlobalMatrix(state); + state->copyToBaseVector(globalVector, v.getId(state), pos[0]); + } } } @@ -215,8 +216,11 @@ void TypedMatrixLinearSystem::dispatchSystemSolution(core::Mul { if (getSolutionVector()) { - DispatchFromGlobalVectorToLocalVectorVisitor(core::execparams::defaultInstance(), m_mappingGraph, v, getSolutionVector()) - .execute(getSolveContext()); + for (auto& state : m_mappingGraph.getMainMechanicalStates()) + { + auto pos = m_mappingGraph.getPositionInGlobalMatrix(state); + state->copyFromBaseVector(v.getId(state), getSolutionVector(), pos[0]); + } } } @@ -225,8 +229,11 @@ void TypedMatrixLinearSystem::dispatchSystemRHS(core::MultiVec { if (getRHSVector()) { - DispatchFromGlobalVectorToLocalVectorVisitor(core::execparams::defaultInstance(), m_mappingGraph, v, getRHSVector()) - .execute(getSolveContext()); + for (auto& state : m_mappingGraph.getMainMechanicalStates()) + { + auto pos = m_mappingGraph.getPositionInGlobalMatrix(state); + state->copyFromBaseVector(v.getId(state), getRHSVector(), pos[0]); + } } }