From b107f7c33fec13f665e3cec46690f9af3450faf5 Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Mon, 12 May 2025 22:00:02 +0200 Subject: [PATCH 1/2] [Mass] Apply template method design pattern to BaseMass --- .../component/forcefield/AdaptiveBeamForceFieldAndMass.h | 2 +- .../component/forcefield/AdaptiveBeamForceFieldAndMass.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h index a46193c4e..bb8cc89b7 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h @@ -124,7 +124,7 @@ class AdaptiveBeamForceFieldAndMass : public core::behavior::Mass void addMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) override; void addMBKToMatrix(const MechanicalParams* mparams, const MultiMatrixAccessor* matrix) override; - void buildMassMatrix(sofa::core::behavior::MassMatrixAccumulator* matrices) override; + void doBuildMassMatrix(sofa::core::behavior::MassMatrixAccumulator* matrices) override; void buildStiffnessMatrix(core::behavior::StiffnessMatrix* matrix) override; void buildDampingMatrix(core::behavior::DampingMatrix* matrices) override; diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl index b72f54b73..6392ba2c6 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl @@ -382,7 +382,7 @@ void AdaptiveBeamForceFieldAndMass::addMToMatrix(const MechanicalPara } template -void AdaptiveBeamForceFieldAndMass::buildMassMatrix(sofa::core::behavior::MassMatrixAccumulator* matrices) +void AdaptiveBeamForceFieldAndMass::doBuildMassMatrix(sofa::core::behavior::MassMatrixAccumulator* matrices) { const unsigned int numBeams = l_interpolation->getNumBeams(); From a11d0c4370113bc851822b0f4015e9b2110379ba Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Mon, 12 May 2025 22:55:41 +0200 Subject: [PATCH 2/2] forgotten doAddMToMatrix --- .../component/forcefield/AdaptiveBeamForceFieldAndMass.h | 2 +- .../component/forcefield/AdaptiveBeamForceFieldAndMass.inl | 2 +- .../component/forcefield/AdaptiveInflatableBeamForceField.h | 2 +- .../component/forcefield/AdaptiveInflatableBeamForceField.inl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h index bb8cc89b7..5a65d99fa 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.h @@ -121,7 +121,7 @@ class AdaptiveBeamForceFieldAndMass : public core::behavior::Mass /// Mass Interface ///////////////////////////////////// void addMDx(const MechanicalParams* mparams, DataVecDeriv& f, const DataVecDeriv& dx, SReal factor) override; - void addMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) override; + void doAddMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) override; void addMBKToMatrix(const MechanicalParams* mparams, const MultiMatrixAccessor* matrix) override; void doBuildMassMatrix(sofa::core::behavior::MassMatrixAccumulator* matrices) override; diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl index 6392ba2c6..7ca224b03 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl @@ -341,7 +341,7 @@ void AdaptiveBeamForceFieldAndMass::addMDx(const MechanicalParams* mp template -void AdaptiveBeamForceFieldAndMass::addMToMatrix(const MechanicalParams *mparams, +void AdaptiveBeamForceFieldAndMass::doAddMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) { MultiMatrixAccessor::MatrixRef r = matrix->getMatrix(mstate); diff --git a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.h b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.h index fb35a2f4c..37ca271ce 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.h +++ b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.h @@ -154,7 +154,7 @@ class AdaptiveInflatableBeamForceField : public Mass /// Mass Interface ///////////////////////////////////// virtual void addMDx(const MechanicalParams* mparams, DataVecDeriv& f, const DataVecDeriv& dx, SReal factor) override; - virtual void addMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) override; + virtual void doAddMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) override; virtual void addMBKToMatrix(const MechanicalParams* mparams, const MultiMatrixAccessor* matrix) override; //TODO(dmarchal 2017-05-17) So what do we do ? For who is this message intended for ? How can we make this code "more" manageable. diff --git a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.inl b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.inl index 9566c6019..97ff00aff 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.inl +++ b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.inl @@ -370,7 +370,7 @@ void AdaptiveInflatableBeamForceField::addMDx(const MechanicalParams* template -void AdaptiveInflatableBeamForceField::addMToMatrix(const MechanicalParams *mparams, +void AdaptiveInflatableBeamForceField::doAddMToMatrix(const MechanicalParams *mparams, const MultiMatrixAccessor* matrix) { MultiMatrixAccessor::MatrixRef r = matrix->getMatrix(this->mstate);