@@ -205,8 +205,6 @@ void AdaptiveBeamMapping< TIn, TOut>::apply(const MechanicalParams* mparams, Dat
205205 auto out = sofa::helper::getWriteOnlyAccessor (dOut);
206206 const InVecCoord& in = dIn.getValue ();
207207
208- m_isXBufferUsed=false ;
209-
210208 // When using an adaptatif controller, one need to redistribute the points at each time step
211209 {
212210 SCOPED_TIMER (" computeDistribution" );
@@ -302,23 +300,13 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
302300
303301 auto out = sofa::helper::getWriteOnlyAccessor (dOut);
304302 const InVecDeriv& in= dIn.getValue ();
305-
306- Data<InVecCoord>& dataInX = *this ->getFromModel ()->write (sofa::core::vec_id::write_access ::position);
307- auto x = sofa::helper::getWriteOnlyAccessor ( dataInX);
303+
304+ const Data<InVecCoord>& dataInX = *this ->getFromModel ()->read (sofa::core::vec_id::read_access ::position);
305+ const InVecCoord& x = dataInX. getValue ( );
308306
309307 if (d_useCurvAbs.getValue () && !d_contactDuplicate.getValue ())
310308 computeDistribution ();
311309
312- // TODO: check if m_isXBufferUsed is set somewhere else
313- // As far as I could see, m_isXBufferUsed is never set to true
314- InVecCoord xBuf2{};
315- if (m_isXBufferUsed)
316- {
317- // TODO : solve this problem during constraint motion propagation !!
318- xBuf2 = x.ref ();
319- x.wref () = m_xBuffer;
320- }
321-
322310 // should not be necessary if apply() was called first
323311 if (!m_isSubMapping)
324312 {
@@ -348,7 +336,7 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
348336
349337 Deriv vResult (sofa::type::NOINIT);
350338
351- applyJonPoint (elementID, vDOF0, vDOF1, vResult, x. ref () );
339+ applyJonPoint (elementID, vDOF0, vDOF1, vResult, x);
352340
353341 if (m_isSubMapping)
354342 {
@@ -370,12 +358,6 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
370358 assert (taskScheduler);
371359
372360 simulation::forEachRange (execution, *taskScheduler, m_pointBeamDistribution.begin (), m_pointBeamDistribution.end (), applyJ_impl);
373-
374- if (m_isXBufferUsed)
375- {
376- x.wref () = xBuf2;
377- m_isXBufferUsed = false ;
378- }
379361}
380362
381363
@@ -433,9 +415,6 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJT(const core::ConstraintParams* cpar
433415 const Data<InVecCoord>& dataInX = *this ->getFromModel ()->read (sofa::core::vec_id::read_access::position);
434416 const InVecCoord& x = dataInX.getValue ();
435417
436- m_isXBufferUsed = false ;
437- m_xBuffer = x ;
438-
439418 // ////////// What's for ?? it seems not useful//////////
440419 bool proximity_lever = false ;
441420 if (d_proximity.getValue () > 0.0 )
0 commit comments