Skip to content

Commit 2e7e9ec

Browse files
committed
same with shape
1 parent 50b5c39 commit 2e7e9ec

9 files changed

Lines changed: 22 additions & 48 deletions

File tree

src/BeamAdapter/component/engine/WireRestShape.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ class WireRestShape : public core::objectmodel::BaseObject
8383
/////////////////////////// Methods of WireRestShape //////////////////////////////////////////
8484

8585
/// This function is called by the force field to evaluate the rest position of each beam
86-
void getRestTransformOnX(Transform &global_H_local, const Real &x);
86+
void getRestTransformOnX(Transform &global_H_local, const Real x);
8787

8888
/// Returns the BeamSection @sa m_beamSection corresponding to the given curvilinear abscissa, will call @sa BaseRodSectionMaterial::getBeamSection
89-
[[nodiscard]] const BeamSection& getBeamSectionAtX(const Real& x_curv) const;
89+
[[nodiscard]] const BeamSection& getBeamSectionAtX(const Real x_curv) const;
9090

9191
/// Returns the BeamSection data depending on the beam position at the given curvilinear abscissa, will call @sa BaseRodSectionMaterial::getInterpolationParameters
92-
void getInterpolationParametersAtX(const Real& x_curv, Real &_A, Real &_Iy , Real &_Iz, Real &_Asy, Real &_Asz, Real &_J) const;
92+
void getInterpolationParametersAtX(const Real x_curv, Real &_A, Real &_Iy , Real &_Iz, Real &_Asy, Real &_Asz, Real &_J) const;
9393

9494
/// Returns the Young modulus, Poisson's ratio and massDensity coefficient of the section at the given curvilinear abscissa, will call @sa BaseRodSectionMaterial::getMechanicalParameters
95-
void getMechanicalParametersAtX(const Real& x_curv, Real& youngModulus, Real& cPoisson, Real& massDensity) const;
95+
void getMechanicalParametersAtX(const Real x_curv, Real& youngModulus, Real& cPoisson, Real& massDensity) const;
9696

9797

9898
/**
@@ -107,8 +107,8 @@ class WireRestShape : public core::objectmodel::BaseObject
107107

108108

109109
Real getLength() ;
110-
void getCollisionSampling(Real &dx, const Real &x_curv);
111-
void getNumberOfCollisionSegment(Real &dx, unsigned int &numLines) ;
110+
void getCollisionSampling(Real &dx, const Real x_curv);
111+
void getNumberOfCollisionSegment(Real &dx, sofa::Size& numLines) ;
112112

113113

114114

src/BeamAdapter/component/engine/WireRestShape.inl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void WireRestShape<DataTypes>::getSamplingParameters(type::vector<Real>& xP_noti
182182

183183

184184
template <class DataTypes>
185-
void WireRestShape<DataTypes>::getCollisionSampling(Real &dx, const Real &x_curv)
185+
void WireRestShape<DataTypes>::getCollisionSampling(Real &dx, const Real x_curv)
186186
{
187187
unsigned int numLines;
188188
Real x_used = x_curv - EPSILON;
@@ -229,7 +229,7 @@ void WireRestShape<DataTypes>::getCollisionSampling(Real &dx, const Real &x_curv
229229

230230

231231
template <class DataTypes>
232-
void WireRestShape<DataTypes>::getRestTransformOnX(Transform &global_H_local, const Real &x)
232+
void WireRestShape<DataTypes>::getRestTransformOnX(Transform &global_H_local, const Real x)
233233
{
234234
Real x_used = x - EPSILON;
235235

@@ -255,7 +255,7 @@ void WireRestShape<DataTypes>::getRestTransformOnX(Transform &global_H_local, co
255255

256256

257257
template <class DataTypes>
258-
const BeamSection& WireRestShape<DataTypes>::getBeamSectionAtX(const Real& x_curv) const
258+
const BeamSection& WireRestShape<DataTypes>::getBeamSectionAtX(const Real x_curv) const
259259
{
260260
const Real x_used = x_curv - Real(EPSILON);
261261
const type::vector<Real>& keyPts = d_keyPoints.getValue();
@@ -276,7 +276,7 @@ const BeamSection& WireRestShape<DataTypes>::getBeamSectionAtX(const Real& x_cur
276276

277277

278278
template <class DataTypes>
279-
void WireRestShape<DataTypes>::getInterpolationParametersAtX(const Real& x_curv, Real &_A, Real &_Iy , Real &_Iz, Real &_Asy, Real &_Asz, Real &_J) const
279+
void WireRestShape<DataTypes>::getInterpolationParametersAtX(const Real x_curv, Real &_A, Real &_Iy , Real &_Iz, Real &_Asy, Real &_Asz, Real &_J) const
280280
{
281281
const Real x_used = x_curv - Real(EPSILON);
282282
const type::vector<Real>& keyPts = d_keyPoints.getValue();
@@ -295,7 +295,7 @@ void WireRestShape<DataTypes>::getInterpolationParametersAtX(const Real& x_curv,
295295

296296

297297
template <class DataTypes>
298-
void WireRestShape<DataTypes>::getMechanicalParametersAtX(const Real& x_curv, Real& youngModulus, Real& cPoisson, Real& massDensity) const
298+
void WireRestShape<DataTypes>::getMechanicalParametersAtX(const Real x_curv, Real& youngModulus, Real& cPoisson, Real& massDensity) const
299299
{
300300
const Real x_used = x_curv - Real(EPSILON);
301301
const type::vector<Real>& keyPts = d_keyPoints.getValue();
@@ -321,7 +321,7 @@ typename WireRestShape<DataTypes>::Real WireRestShape<DataTypes>::getLength()
321321

322322

323323
template <class DataTypes>
324-
void WireRestShape<DataTypes>::getNumberOfCollisionSegment(Real &dx, unsigned int &numLines)
324+
void WireRestShape<DataTypes>::getNumberOfCollisionSegment(Real &dx, sofa::Size& numLines)
325325
{
326326
numLines = 0;
327327
for (sofa::Size i = 0; i < l_sectionMaterials.size(); ++i)

src/BeamAdapter/component/model/BaseRodSectionMaterial.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ class BaseRodSectionMaterial : public core::objectmodel::BaseObject
7272
/////////////////////////// Geometry and physics Getter //////////////////////////////////////////
7373

7474
/// Returns the number of visual edges of this section. To be set or computed by child.
75-
[[nodiscard]] int getNbVisualEdges() const { return d_nbEdgesVisu.getValue(); }
75+
[[nodiscard]] auto getNbVisualEdges() const { return d_nbEdgesVisu.getValue(); }
7676

7777
/// Returns the number of collision edges of this section. To be set or computed by child.
78-
[[nodiscard]] int getNbCollisionEdges() const { return d_nbEdgesCollis.getValue(); }
78+
[[nodiscard]] auto getNbCollisionEdges() const { return d_nbEdgesCollis.getValue(); }
7979

8080
/// Returns the total length of this section. To be set or computed by child.
81-
[[nodiscard]] Real getLength() const { return d_length.getValue(); }
81+
[[nodiscard]] auto getLength() const { return d_length.getValue(); }
8282

8383

8484
/// Returns the BeamSection @sa m_beamSection corresponding to this section
@@ -91,7 +91,7 @@ class BaseRodSectionMaterial : public core::objectmodel::BaseObject
9191
void getMechanicalParameters(Real& youngModulus, Real& cPoisson, Real& massDensity) const;
9292

9393
/// This function is called to get the rest position of the beam depending on the current curved abscisse given in parameter
94-
virtual void getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start)
94+
virtual void getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start)
9595
{
9696
SOFA_UNUSED(global_H_local);
9797
SOFA_UNUSED(x_used);

src/BeamAdapter/component/model/RodMeshSection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class RodMeshSection : public BaseRodSectionMaterial<DataTypes>
5454
RodMeshSection();
5555

5656
/// Override method to get the rest position of the beam. In this implementation, it will interpolate along the loaded mesh geometry
57-
void getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start) override;
57+
void getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start) override;
5858

5959
protected:
6060
/// Internal method to init the section. Called by @sa BaseRodSectionMaterial::init() method

src/BeamAdapter/component/model/RodMeshSection.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bool RodMeshSection<DataTypes>::initSection()
6262

6363

6464
template <class DataTypes>
65-
void RodMeshSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start)
65+
void RodMeshSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start)
6666
{
6767
Real abs_curr = x_used - x_start;
6868
abs_curr = abs_curr /(this->d_length.getValue()) * m_absOfGeometry;

src/BeamAdapter/component/model/RodSpireSection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class RodSpireSection : public BaseRodSectionMaterial<DataTypes>
5151
RodSpireSection();
5252

5353
/// Override method to get the rest position of the beam. In this implementation, it will compute the current position given the spire parameters
54-
void getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start) override;
54+
void getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start) override;
5555

5656
protected:
5757
/// Internal method to init the section. Called by @sa BaseRodSectionMaterial::init() method

src/BeamAdapter/component/model/RodSpireSection.inl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,12 @@ bool RodSpireSection<DataTypes>::initSection()
4848
return false;
4949
}
5050

51-
if (int nbrEdgesVisu = this->d_nbEdgesVisu.getValue() <= 0)
52-
{
53-
msg_warning() << "Number of visual edges has been set to an invalid value: " << nbrEdgesVisu << ". Value should be a positive integer. Setting to default value: 10";
54-
this->d_nbEdgesVisu.setValue(10);
55-
}
56-
57-
58-
if (int nbEdgesCollis = this->d_nbEdgesCollis.getValue() <= 0)
59-
{
60-
msg_warning() << "Number of collision edges has been set to an invalid value: " << nbEdgesCollis << ". Value should be a positive integer. Setting to default value: 20";
61-
this->d_nbEdgesCollis.setValue(10);
62-
}
63-
6451
return true;
6552
}
6653

6754

6855
template <class DataTypes>
69-
void RodSpireSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start)
56+
void RodSpireSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start)
7057
{
7158
Real projetedLength = d_spireDiameter.getValue() * M_PI;
7259
Real lengthSpire = sqrt(d_spireHeight.getValue() * d_spireHeight.getValue() + projetedLength * projetedLength);

src/BeamAdapter/component/model/RodStraightSection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class RodStraightSection : public BaseRodSectionMaterial<DataTypes>
4848
RodStraightSection();
4949

5050
/// Override method to get the rest position of the beam. In this implementation, it will basically returns Vec3(x_start + x_used, 0 0)
51-
void getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start) override;
51+
void getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start) override;
5252

5353
protected:
5454
/// Internal method to init the section. Called by @sa BaseRodSectionMaterial::init() method

src/BeamAdapter/component/model/RodStraightSection.inl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,12 @@ bool RodStraightSection<DataTypes>::initSection()
4646
return false;
4747
}
4848

49-
if (int nbrEdgesVisu = this->d_nbEdgesVisu.getValue() <= 0)
50-
{
51-
msg_warning() << "Number of visual edges has been set to an invalid value: " << nbrEdgesVisu << ". Value should be a positive integer. Setting to default value: 10";
52-
this->d_nbEdgesVisu.setValue(10);
53-
}
54-
55-
56-
if (int nbEdgesCollis = this->d_nbEdgesCollis.getValue() <= 0)
57-
{
58-
msg_warning() << "Number of collision edges has been set to an invalid value: " << nbEdgesCollis << ". Value should be a positive integer. Setting to default value: 20";
59-
this->d_nbEdgesCollis.setValue(10);
60-
}
61-
6249
return true;
6350
}
6451

6552

6653
template <class DataTypes>
67-
void RodStraightSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real& x_used, const Real& x_start)
54+
void RodStraightSection<DataTypes>::getRestTransformOnX(Transform& global_H_local, const Real x_used, const Real x_start)
6855
{
6956
global_H_local.set(type::Vec3(x_start + x_used, 0.0, 0.0), Quat());
7057
}

0 commit comments

Comments
 (0)