Skip to content

Commit

Permalink
Merge pull request #154 from epernod/fix_adaptiveBeamMapping_init
Browse files Browse the repository at this point in the history
[src] Fix AdaptiveBeamMapping mapping at init with none deployed beam
  • Loading branch information
bakpaul authored Jul 26, 2024
2 parents 9e2dbec + 5ae17a9 commit 930781f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ void AdaptiveBeamMapping< TIn, TOut>::init()
{
simulation::MainTaskSchedulerFactory::createInRegistry()->init();
}

this->d_componentState.setValue(sofa::core::objectmodel::ComponentState::Valid);
}


Expand Down Expand Up @@ -273,6 +275,14 @@ void AdaptiveBeamMapping< TIn, TOut>::apply(const MechanicalParams* mparams, Dat

};


// HACK for init: In case the number of output points is bigger to the number of distribution, set all points to 0
for (int i = m_pointBeamDistribution.size(); i < d_points.getValue().size(); i++)
{
out[i] = Vec<3, InReal>(0.0, 0.0, 0.0);
}


const bool multithreading = d_parallelMapping.getValue();

const simulation::ForEachExecutionPolicy execution = multithreading ?
Expand Down

0 comments on commit 930781f

Please sign in to comment.