From 2e2509e93281483aa83807512cc816de6782da64 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 18 May 2026 16:28:29 +0200 Subject: [PATCH] Fix float compilation --- BeamAdapter_test/BeamInterpolation_test.cpp | 7 ++++--- .../component/mapping/BeamLengthMappingTest.cpp | 6 +++--- src/BeamAdapter/component/BaseBeamInterpolation.h | 2 +- src/BeamAdapter/component/BeamInterpolation.inl | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BeamAdapter_test/BeamInterpolation_test.cpp b/BeamAdapter_test/BeamInterpolation_test.cpp index e2e009205..bb0b2ccd4 100644 --- a/BeamAdapter_test/BeamInterpolation_test.cpp +++ b/BeamAdapter_test/BeamInterpolation_test.cpp @@ -103,10 +103,11 @@ struct BeamInterpolationTest : public sofa::testing::BaseSimulationTest, return root; } - void checkDataInitialization(const Data>& data, - const SReal& defaultValue, + template + void checkDataInitialization(const Data>& data, + const Real& defaultValue, const sofa::Size& nbBeam, - const SReal& value) + const Real& value) { const auto& vector = helper::getReadAccessor(data); ASSERT_EQ(vector.size(), nbBeam); diff --git a/BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp b/BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp index 80cdc5051..d16be01f4 100644 --- a/BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp +++ b/BeamAdapter_test/component/mapping/BeamLengthMappingTest.cpp @@ -146,7 +146,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng this->deltaRange.first= 1; this->deltaRange.second= 1000; - MechanicalObject* FromModel = nullptr; + MechanicalObject* FromModel = nullptr; this->root->getTreeObject(FromModel); this->inDofs = FromModel; @@ -215,7 +215,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng this->deltaRange.second= 100000; - MechanicalObject* FromModel = nullptr; + MechanicalObject* FromModel = nullptr; this->root->getTreeObject(FromModel); this->inDofs = FromModel; @@ -259,7 +259,7 @@ struct BeamLengthMappingTest : public sofa::mapping_test::Mapping_test<_BeamLeng // Define the list of types to instanciate. We do not necessarily need to test all combinations. using ::testing::Types; typedef Types< -BeamLengthMapping +BeamLengthMapping //,mapping::_beamlengthmapping_::BeamLengthMapping > DataTypes; // the types to instanciate. diff --git a/src/BeamAdapter/component/BaseBeamInterpolation.h b/src/BeamAdapter/component/BaseBeamInterpolation.h index 7bd71e861..4d91ae1a1 100644 --- a/src/BeamAdapter/component/BaseBeamInterpolation.h +++ b/src/BeamAdapter/component/BaseBeamInterpolation.h @@ -216,7 +216,7 @@ class BaseBeamInterpolation : public sofa::core::behavior::SingleStateAccessor d_edgeList; ///2. Vector of length of each beam. Same size as @sa d_edgeList - Data< type::vector< Real > > d_lengthList; + Data< type::vector< SReal > > d_lengthList; ///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 Data< type::vector< Transform > > d_DOF0TransformNode0; diff --git a/src/BeamAdapter/component/BeamInterpolation.inl b/src/BeamAdapter/component/BeamInterpolation.inl index d17c1ce6d..cf17279c7 100644 --- a/src/BeamAdapter/component/BeamInterpolation.inl +++ b/src/BeamAdapter/component/BeamInterpolation.inl @@ -408,7 +408,7 @@ template typename BeamInterpolation::Real BeamInterpolation::getRestTotalLength() { Real le(0.0); - const type::vector< double > &lengthList = this->d_lengthList.getValue(); + const type::vector< SReal > &lengthList = this->d_lengthList.getValue(); for (unsigned int i = 0; i < lengthList.size(); i++) le += lengthList[i];