Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/BeamAdapter/component/mapping/BeamLengthMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ class BeamLengthMapping : public Mapping<TIn, TOut>
virtual void applyJ(const MechanicalParams *mparams, Data<VecDeriv>& out, const Data<InVecDeriv>& in) override;
virtual void applyJT(const MechanicalParams *mparams, Data<InVecDeriv>& out, const Data<VecDeriv>& in) override;
virtual void applyJT(const ConstraintParams *cparams, Data<InMatrixDeriv>& out, const Data<OutMatrixDeriv>& in) override;
virtual void applyDJT(const MechanicalParams* mparams, core::MultiVecDerivId parentDfId, core::ConstMultiVecDerivId childDfId) override;

// interface of baseMapping.h
virtual void updateK( const MechanicalParams* /*mparams*/, core::ConstMultiVecDerivId /*outForce*/ ) override;
const linearalgebra::BaseMatrix* getK() override;



Expand All @@ -179,6 +174,12 @@ class BeamLengthMapping : public Mapping<TIn, TOut>
/* Vec3 F0_buf, F1_buf, F2_buf, F3_buf; // Used for debug */
SparseKMatrixEigen K_geom;

virtual void doApplyDJT(const MechanicalParams* mparams, core::MultiVecDerivId parentDfId, core::ConstMultiVecDerivId childDfId) override;

// interface of baseMapping.h
virtual void doUpdateK( const MechanicalParams* /*mparams*/, core::ConstMultiVecDerivId /*outForce*/ ) override;
const linearalgebra::BaseMatrix* doGetK() override;

// used for applyJ on one beam
void computeJSpline(Real &dlength, const Vec3& P0, const Vec3& P1, const Vec3& P2, const Vec3& P3,
const Vec3& dP0, const Vec3& dP1, const Vec3& dP2, const Vec3& dP3);
Expand Down
6 changes: 3 additions & 3 deletions src/BeamAdapter/component/mapping/BeamLengthMapping.inl
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void BeamLengthMapping< TIn, TOut>::applyJT(const core::ConstraintParams* cparam
/// BeamLengthMapping::applyDJT(MultiVecDerivId parentDfId, const ConstMultiVecDerivId childDfId)
/// this function computes the additional stiffness force created on the parents by the force on the child (due to mapping non-linearity)
template <class TIn, class TOut>
void BeamLengthMapping< TIn, TOut>::applyDJT(const MechanicalParams* mparams, core::MultiVecDerivId parentDfId, core::ConstMultiVecDerivId childDfId)
void BeamLengthMapping< TIn, TOut>::doApplyDJT(const MechanicalParams* mparams, core::MultiVecDerivId parentDfId, core::ConstMultiVecDerivId childDfId)
{
const unsigned& geometricStiffness = d_geometricStiffness.getValue();
if( !geometricStiffness ) return;
Expand Down Expand Up @@ -579,7 +579,7 @@ void BeamLengthMapping< TIn, TOut>::applyDJT(const MechanicalParams* mparams, co
}

template <class TIn, class TOut>
void BeamLengthMapping<TIn, TOut>::updateK(const core::MechanicalParams* mparams, core::ConstMultiVecDerivId childForceId )
void BeamLengthMapping<TIn, TOut>::doUpdateK(const core::MechanicalParams* mparams, core::ConstMultiVecDerivId childForceId )
{
SOFA_UNUSED(mparams);
const unsigned& geometricStiffness = d_geometricStiffness.getValue();
Expand Down Expand Up @@ -761,7 +761,7 @@ void BeamLengthMapping<TIn, TOut>::updateK(const core::MechanicalParams* mparams


template <class TIn, class TOut>
const sofa::linearalgebra::BaseMatrix* BeamLengthMapping<TIn, TOut>::getK()
const sofa::linearalgebra::BaseMatrix* BeamLengthMapping<TIn, TOut>::doGetK()
{
return &K_geom;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,14 @@ class SOFA_BEAMADAPTER_API BeamProjectionDifferenceMultiMapping : public sofa::c
const sofa::type::vector< In2DataVecDeriv*>& dataVecOut2RootForce,
const sofa::type::vector<const OutDataVecDeriv*>& dataVecInForce) override;

void applyDJT(const sofa::core::MechanicalParams* mparams,
sofa::core::MultiVecDerivId inForce,
sofa::core::ConstMultiVecDerivId outForce) override;

virtual void applyJT(
const sofa::core::ConstraintParams* cparams , const sofa::type::vector< In1DataMatrixDeriv*>& dataMatOut1Const ,
const sofa::type::vector< In2DataMatrixDeriv*>& dataMatOut2Const ,
const sofa::type::vector<const OutDataMatrixDeriv*>& dataMatInConst) override;

virtual const sofa::type::vector<sofa::linearalgebra::BaseMatrix*>* getJs() override;

void computeProjection(const In1VecCoord &xFrom, const In2VecCoord &xTo, const bool &updateOrientation);

public:
sofa::Data<vector<unsigned int>> d_indices;
sofa::Data<sofa::type::vector<bool>> d_directions;
sofa::Data<bool> d_updateProjectionPosition;
Expand All @@ -171,6 +165,13 @@ class SOFA_BEAMADAPTER_API BeamProjectionDifferenceMultiMapping : public sofa::c
using sofa::core::Multi2Mapping<TIn1, TIn2, TOut>::d_componentState ;

protected:

void doApplyDJT(const sofa::core::MechanicalParams* mparams,
sofa::core::MultiVecDerivId inForce,
sofa::core::ConstMultiVecDerivId outForce) override;
virtual const sofa::type::vector<sofa::linearalgebra::BaseMatrix*>* doGetJs() override;


sofa::core::State<In1>* m_fromModel1;
sofa::core::State<In2>* m_fromModel2;
sofa::core::State<Out>* m_toModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::applyJT( const sofa
}

template <class TIn1, class TIn2, class TOut>
void BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::applyDJT(const sofa::core::MechanicalParams* mparams,
void BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::doApplyDJT(const sofa::core::MechanicalParams* mparams,
sofa::core::MultiVecDerivId inForce,
sofa::core::ConstMultiVecDerivId outForce)
{
Expand All @@ -453,7 +453,7 @@ void BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::applyDJT(const sofa
}

template <class TIn1, class TIn2, class TOut>
const sofa::type::vector<sofa::linearalgebra::BaseMatrix*>* BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::getJs()
const sofa::type::vector<sofa::linearalgebra::BaseMatrix*>* BeamProjectionDifferenceMultiMapping<TIn1, TIn2, TOut>::doGetJs()
{
const OutVecCoord& out = m_toModel->read(sofa::core::vec_id::read_access::position)->getValue();
const In1VecCoord& in1 = m_fromModel1->read(sofa::core::vec_id::read_access::position)->getValue();
Expand Down
Loading