Skip to content

Commit 3283818

Browse files
authored
Merge pull request #218 from fredroy/mapping_remove_buffer
AdaptiveBeamMapping: remove unused buffer mechanism
2 parents e475bc8 + d2ddd52 commit 3283818

3 files changed

Lines changed: 4 additions & 30 deletions

File tree

src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ SOFA_BEAMADAPTER_API void AdaptiveBeamMapping<Rigid3Types, Rigid3Types >::apply(
5353
auto out = sofa::helper::getWriteOnlyAccessor(dOut);
5454
const InVecCoord& in= dIn.getValue();
5555

56-
m_isXBufferUsed=false;
57-
5856
// When using an adaptatif controller, one need to redistribute the points at each time step
5957
if (d_useCurvAbs.getValue() && !d_contactDuplicate.getValue())
6058
computeDistribution();

src/BeamAdapter/component/mapping/AdaptiveBeamMapping.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ class AdaptiveBeamMapping : public Mapping<TIn, TOut>
191191

192192
TopologyContainer* m_topology;
193193

194-
bool m_isXBufferUsed;
195-
typename In::VecCoord m_xBuffer;
196-
197194
type::vector< PosPointDefinition > m_pointBeamDistribution;
198195

199196
/// for continuous_friction_contact:

src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)