Skip to content

Commit c4cf360

Browse files
authored
Fix float compilation (sofa-framework#229)
1 parent 1f5a6d8 commit c4cf360

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

BeamAdapter_test/BeamInterpolation_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@ struct BeamInterpolationTest : public sofa::testing::BaseSimulationTest,
103103
return root;
104104
}
105105

106-
void checkDataInitialization(const Data<type::vector<SReal>>& data,
107-
const SReal& defaultValue,
106+
template<class Real>
107+
void checkDataInitialization(const Data<type::vector<Real>>& data,
108+
const Real& defaultValue,
108109
const sofa::Size& nbBeam,
109-
const SReal& value)
110+
const Real& value)
110111
{
111112
const auto& vector = helper::getReadAccessor(data);
112113
ASSERT_EQ(vector.size(), nbBeam);

BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng
146146
this->deltaRange.first= 1;
147147
this->deltaRange.second= 1000;
148148

149-
MechanicalObject<defaulttype::Rigid3dTypes>* FromModel = nullptr;
149+
MechanicalObject<defaulttype::Rigid3Types>* FromModel = nullptr;
150150
this->root->getTreeObject(FromModel);
151151
this->inDofs = FromModel;
152152

@@ -215,7 +215,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng
215215
this->deltaRange.second= 100000;
216216

217217

218-
MechanicalObject<defaulttype::Rigid3dTypes>* FromModel = nullptr;
218+
MechanicalObject<defaulttype::Rigid3Types>* FromModel = nullptr;
219219
this->root->getTreeObject(FromModel);
220220
this->inDofs = FromModel;
221221

@@ -259,7 +259,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng
259259
// Define the list of types to instanciate. We do not necessarily need to test all combinations.
260260
using ::testing::Types;
261261
typedef Types<
262-
BeamLengthMapping<defaulttype::Rigid3dTypes,defaulttype::Vec1dTypes>
262+
BeamLengthMapping<defaulttype::Rigid3Types,defaulttype::Vec1Types>
263263
//,mapping::_beamlengthmapping_::BeamLengthMapping<defaulttype::Rigid3fTypes,defaulttype::Vec1fTypes>
264264
> DataTypes; // the types to instanciate.
265265

src/BeamAdapter/component/BaseBeamInterpolation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class BaseBeamInterpolation : public sofa::core::behavior::SingleStateAccessor<D
216216
Data< VecEdgeID > d_edgeList;
217217

218218
///2. Vector of length of each beam. Same size as @sa d_edgeList
219-
Data< type::vector< Real > > d_lengthList;
219+
Data< type::vector< SReal > > d_lengthList;
220220

221221
///3. (optional) apply a rigid Transform between the degree of Freedom and the first node of the beam. Indexation based on the num of Edge
222222
Data< type::vector< Transform > > d_DOF0TransformNode0;

src/BeamAdapter/component/BeamInterpolation.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ template <class DataTypes>
408408
typename BeamInterpolation<DataTypes>::Real BeamInterpolation<DataTypes>::getRestTotalLength()
409409
{
410410
Real le(0.0);
411-
const type::vector< double > &lengthList = this->d_lengthList.getValue();
411+
const type::vector< SReal > &lengthList = this->d_lengthList.getValue();
412412

413413
for (unsigned int i = 0; i < lengthList.size(); i++)
414414
le += lengthList[i];

0 commit comments

Comments
 (0)