@@ -302,23 +302,13 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
302302
303303 auto out = sofa::helper::getWriteOnlyAccessor (dOut);
304304 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);
305+
306+ const Data<InVecCoord>& dataInX = *this ->getFromModel ()->read (sofa::core::vec_id::read_access ::position);
307+ const InVecCoord& x = dataInX. getValue ( );
308308
309309 if (d_useCurvAbs.getValue () && !d_contactDuplicate.getValue ())
310310 computeDistribution ();
311311
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-
322312 // should not be necessary if apply() was called first
323313 if (!m_isSubMapping)
324314 {
@@ -348,7 +338,7 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
348338
349339 Deriv vResult (sofa::type::NOINIT);
350340
351- applyJonPoint (elementID, vDOF0, vDOF1, vResult, x. ref () );
341+ applyJonPoint (elementID, vDOF0, vDOF1, vResult, x);
352342
353343 if (m_isSubMapping)
354344 {
@@ -370,12 +360,6 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
370360 assert (taskScheduler);
371361
372362 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- }
379363}
380364
381365
0 commit comments