Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ SOFA_BEAMADAPTER_API void AdaptiveBeamMapping<Rigid3Types, Rigid3Types >::apply(
auto out = sofa::helper::getWriteOnlyAccessor(dOut);
const InVecCoord& in= dIn.getValue();

m_isXBufferUsed=false;

// When using an adaptatif controller, one need to redistribute the points at each time step
if (d_useCurvAbs.getValue() && !d_contactDuplicate.getValue())
computeDistribution();
Expand Down
3 changes: 0 additions & 3 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ class AdaptiveBeamMapping : public Mapping<TIn, TOut>

TopologyContainer* m_topology;

bool m_isXBufferUsed;
typename In::VecCoord m_xBuffer;

type::vector< PosPointDefinition > m_pointBeamDistribution;

/// for continuous_friction_contact:
Expand Down
29 changes: 4 additions & 25 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ void AdaptiveBeamMapping< TIn, TOut>::apply(const MechanicalParams* mparams, Dat
auto out = sofa::helper::getWriteOnlyAccessor(dOut);
const InVecCoord& in = dIn.getValue();

m_isXBufferUsed=false;

// When using an adaptatif controller, one need to redistribute the points at each time step
{
SCOPED_TIMER("computeDistribution");
Expand Down Expand Up @@ -302,23 +300,13 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara

auto out = sofa::helper::getWriteOnlyAccessor(dOut);
const InVecDeriv& in= dIn.getValue();
Data<InVecCoord>& dataInX = *this->getFromModel()->write(sofa::core::vec_id::write_access::position);
auto x = sofa::helper::getWriteOnlyAccessor(dataInX);

const Data<InVecCoord>& dataInX = *this->getFromModel()->read(sofa::core::vec_id::read_access::position);
const InVecCoord& x = dataInX.getValue();

if (d_useCurvAbs.getValue() && !d_contactDuplicate.getValue())
computeDistribution();

// TODO: check if m_isXBufferUsed is set somewhere else
// As far as I could see, m_isXBufferUsed is never set to true
InVecCoord xBuf2{};
if (m_isXBufferUsed)
{
// TODO : solve this problem during constraint motion propagation !!
xBuf2 = x.ref();
x.wref() = m_xBuffer;
}

// should not be necessary if apply() was called first
if (!m_isSubMapping)
{
Expand Down Expand Up @@ -348,7 +336,7 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara

Deriv vResult(sofa::type::NOINIT);

applyJonPoint(elementID, vDOF0, vDOF1, vResult, x.ref());
applyJonPoint(elementID, vDOF0, vDOF1, vResult, x);

if (m_isSubMapping)
{
Expand All @@ -370,12 +358,6 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
assert(taskScheduler);

simulation::forEachRange(execution, *taskScheduler, m_pointBeamDistribution.begin(), m_pointBeamDistribution.end(), applyJ_impl);

if(m_isXBufferUsed)
{
x.wref() = xBuf2;
m_isXBufferUsed = false;
}
}


Expand Down Expand Up @@ -433,9 +415,6 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJT(const core::ConstraintParams* cpar
const Data<InVecCoord>& dataInX = *this->getFromModel()->read(sofa::core::vec_id::read_access::position);
const InVecCoord& x = dataInX.getValue();

m_isXBufferUsed = false;
m_xBuffer = x ;

//////////// What's for ?? it seems not useful//////////
bool proximity_lever = false;
if (d_proximity.getValue() > 0.0)
Expand Down
Loading