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: 8 additions & 3 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ namespace sofapython3
PythonFactory::toPython(&out), PythonFactory::toPython(&in));
}

template<class In, class Out>
void Mapping_Trampoline<In, Out>::applyJ( const MechanicalParams* mparams, OutDataVecDeriv& out, const InDataVecDeriv& in){
template <class In, class Out>
void Mapping_Trampoline<In, Out>::doApplyJacobianVectorProduct(
const MechanicalParams *mparams, OutDataVecDeriv &tangentOut,
const InDataVecDeriv &tangentIn, const InDataVecCoord &positionIn) {

SOFA_UNUSED(positionIn);

PythonEnvironment::gil acquire;

// pass bFactor, kFactor, energy
Expand All @@ -109,7 +114,7 @@ namespace sofapython3
"energy"_a=mparams->energy());

PYBIND11_OVERLOAD_PURE(void, Inherit1, applyJ, mp,
PythonFactory::toPython(&out), PythonFactory::toPython(&in));
PythonFactory::toPython(&tangentOut), PythonFactory::toPython(&tangentIn));
}

template<class In, class Out>
Expand Down
6 changes: 5 additions & 1 deletion bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class Mapping_Trampoline : public sofa::core::Mapping<In, Out> {
std::string getClassName() const override;

void apply( const MechanicalParams* mparams, OutDataVecCoord& out, const InDataVecCoord& in) override;
void applyJ( const MechanicalParams* mparams, OutDataVecDeriv& out, const InDataVecDeriv& in) override;
void doApplyJacobianVectorProduct(
const MechanicalParams* mparams,
OutDataVecDeriv& tangentOut,
const InDataVecDeriv& tangentIn,
const InDataVecCoord& positionIn) override;
void applyJT( const MechanicalParams* mparams, InDataVecDeriv& out, const OutDataVecDeriv& in) override;
void applyJT( const ConstraintParams* mparams, InDataMatrixDeriv& out, const OutDataMatrixDeriv& in) override;

Expand Down
Loading