Skip to content

Commit

Permalink
Follow SOFA Lifecycle v24.06
Browse files Browse the repository at this point in the history
  • Loading branch information
hugtalbot committed Feb 26, 2024
1 parent c651f67 commit 2f3be30
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "plugins")

# Config files and install rules for pythons scripts
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "examples/python3")

sofa_add_subdirectory(plugin extensions/CUDA BeamAdapter.CUDA)

Expand Down
4 changes: 2 additions & 2 deletions src/BeamAdapter/component/BeamInterpolation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,14 @@ template <class DataTypes>
void BeamInterpolation<DataTypes>::getYoungModulusAtX(int beamId, Real& /*x_curv*/, Real& youngModulus, Real& cPoisson)
{
const auto& defaultYoungModuli = d_defaultYoungModulus.getValue();
if (beamId < defaultYoungModuli.size()) {
if (beamId < (int)defaultYoungModuli.size()) {
youngModulus = defaultYoungModuli[beamId];
} else {
youngModulus = m_defaultYoungModulus;
}

const auto& poissonRatios = d_poissonRatio.getValue();
if (beamId < poissonRatios.size()) {
if (beamId < (int)poissonRatios.size()) {
cPoisson = poissonRatios[beamId];
} else {
cPoisson = m_defaultPoissonRatio;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ public:
AdaptiveBeamLengthConstraintResolution(SReal* initF=nullptr, bool* active=nullptr) : ConstraintResolution(1) ,m_initF(initF), m_active(active)
{
}
void init(int line, SReal** w, SReal* force) override;
void resolution(int line, SReal** w, SReal* d, SReal* force);
void store(int line, SReal* force, bool convergence) override;
virtual void init(int line, SReal** w, SReal* force) override;
virtual void store(int line, SReal* force, bool convergence) override;

using sofa::core::behavior::ConstraintResolution::resolution;
void resolution(int line, SReal** w, SReal* d, SReal* force);

protected:
SReal* m_initF;
bool* m_active;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void AdaptiveBeamSlidingConstraint<DataTypes>::draw(const VisualParams* vparams)
points.reserve(x.size());
colors.reserve(x.size());

for (auto i = 0; i < x.size(); i++)
for (sofa::Size i = 0; i < x.size(); i++)
{
point = DataTypes::getCPos(x[i]);
points.push_back(point);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void ImplicitSurfaceAdaptiveConstraint<DataTypes>::draw(const core::visual::Visu
const auto stateLifeCycle = vparams->drawTool()->makeStateLifeCycle();
vparams->drawTool()->disableLighting();

std::vector<sofa::type::Vector3> pointsToDraw;
std::vector<sofa::type::Vec3> pointsToDraw;
std::vector<type::RGBAColor> colors;

typename sofa::type::vector<potentialContact>::iterator it = m_vecPotentialContact.begin();
Expand All @@ -664,7 +664,7 @@ void ImplicitSurfaceAdaptiveConstraint<DataTypes>::draw(const core::visual::Visu
vparams->drawTool()->drawPoints(pointsToDraw, 2, colors);

colors.clear();
std::vector<sofa::type::Vector3> linesToDraw;
std::vector<sofa::type::Vec3> linesToDraw;

for (unsigned int i=0; i<m_vecPotentialContact.size(); i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void BeamAdapterActionController<DataTypes>::onBeginAnimationStep(const double /
else
{
const type::vector<Real>& times = d_timeSteps.getValue();
if (!times.empty() && m_readStep < times.size())
if (!times.empty() && m_readStep < (int)times.size())
{
const Real& time = times[m_readStep];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ void InterventionalRadiologyController<DataTypes>::onBeginAnimationStep(const do
template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::applyAction(sofa::beamadapter::BeamAdapterAction action)
{
int id = d_controlledInstrument.getValue();
if (id >= m_instrumentsList.size())
int id = d_controlledInstrument.getValue();
if (id >= (int)m_instrumentsList.size())
{
msg_warning() << "Controlled Instument num " << id << " does not exist (size =" << m_instrumentsList.size() << ").";
msg_warning() << "Controlled Instrument num " << id << " does not exist (size =" << m_instrumentsList.size() << ").";
return;
}

Expand Down Expand Up @@ -403,7 +403,7 @@ void InterventionalRadiologyController<DataTypes>::applyAction(sofa::beamadapter
}
case BeamAdapterAction::SWITCH_NEXT_TOOL:
{
if (id + 1 >= m_instrumentsList.size())
if (id + 1 >= (int)m_instrumentsList.size())
msg_warning() << "Switching to next tool is not possible, no more instrument in list.";
else
d_controlledInstrument.setValue(id + 1);
Expand Down Expand Up @@ -455,7 +455,7 @@ void InterventionalRadiologyController<DataTypes>::computeInstrumentsCurvAbs(typ
// Step 2 => add the beams given the sampling parameters
double maxAbsLength=0.0;
Real xSampling = 0.0;
for (auto i=0; i<m_instrumentsList.size(); i++)
for (sofa::Size i=0; i<m_instrumentsList.size(); i++)
{
type::vector<Real> xP_noticeable_I;
type::vector< int > density_I;
Expand Down
4 changes: 2 additions & 2 deletions src/BeamAdapter/component/engine/WireRestShape.inl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void WireRestShape<DataTypes>::getRestTransformOnX(Transform &global_H_local, co
}

const type::vector<Real>& keyPts = d_keyPoints.getValue();
for (auto i = 1; i < keyPts.size(); ++i)
for (sofa::Size i = 1; i < keyPts.size(); ++i)
{
if (x_used <= keyPts[i])
{
Expand Down Expand Up @@ -306,7 +306,7 @@ template <class DataTypes>
void WireRestShape<DataTypes>::getNumberOfCollisionSegment(Real &dx, unsigned int &numLines)
{
numLines = 0;
for (auto i = 0; i < l_sectionMaterials.size(); ++i)
for (sofa::Size i = 0; i < l_sectionMaterials.size(); ++i)
{
numLines += l_sectionMaterials.get(i)->getNbCollisionEdges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::BeamProjectionDifference
, m_updateJ(false)
{
auto directions = sofa::helper::getWriteAccessor(d_directions);
directions.resize(OutDeriv::total_size, true);
directions.resize(OutDeriv::total_size);
}


Expand Down

0 comments on commit 2f3be30

Please sign in to comment.