Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Fix C style casts
  • Loading branch information
hugtalbot authored Feb 28, 2024
1 parent c3cfa4f commit 2f54e06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/BeamAdapter/component/BeamInterpolation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,16 @@ template <class DataTypes>
void BeamInterpolation<DataTypes>::getYoungModulusAtX(int beamId, Real& /*x_curv*/, Real& youngModulus, Real& cPoisson)
{
const auto& defaultYoungModuli = d_defaultYoungModulus.getValue();
if (beamId < (int)defaultYoungModuli.size()) {
if (beamId < int(defaultYoungModuli.size())) {

youngModulus = defaultYoungModuli[beamId];
} else {
youngModulus = m_defaultYoungModulus;
}

const auto& poissonRatios = d_poissonRatio.getValue();
if (beamId < (int)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 @@ -140,7 +140,7 @@ void BeamAdapterActionController<DataTypes>::onBeginAnimationStep(const double /
else
{
const type::vector<Real>& times = d_timeSteps.getValue();
if (!times.empty() && m_readStep < (int)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 @@ -367,7 +367,7 @@ template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::applyAction(sofa::beamadapter::BeamAdapterAction action)
{
int id = d_controlledInstrument.getValue();
if (id >= (int)m_instrumentsList.size())
if (id >= int(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 >= (int)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

0 comments on commit 2f54e06

Please sign in to comment.