Skip to content

Commit

Permalink
[All] Fix compilation with FLOATING_POINT_TYPE=float (sofa-framework#…
Browse files Browse the repository at this point in the history
…5269)

fix compilation with FLOATING_POINT_TYPE=float
  • Loading branch information
fredroy authored Feb 19, 2025
1 parent ef7ff21 commit 4ee24f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ AugmentedLagrangianResponse<TCollisionModel1,TCollisionModel2,ResponseDataTypes>
template < class TCollisionModel1, class TCollisionModel2, class ResponseDataTypes >
AugmentedLagrangianResponse<TCollisionModel1,TCollisionModel2,ResponseDataTypes>::AugmentedLagrangianResponse(CollisionModel1* model1, CollisionModel2* model2, Intersection* intersectionMethod)
: BaseUnilateralContactResponse<TCollisionModel1, TCollisionModel2, constraint::lagrangian::model::AugmentedLagrangianContactParameters, ResponseDataTypes>(model1,model2,intersectionMethod)
, d_mu (initData(&d_mu, 0.0, "mu", "Friction coefficient (0 for frictionless contacts)"))
, d_epsilon (initData(&d_epsilon, 0.0, "epsilon", "Penalty parameter. It can be think of as a proportional controller, the Lagrange multiplier is augmented by the violation multiplied by this factor at each solving iteration."))
, d_mu (initData(&d_mu, 0.0_sreal, "mu", "Friction coefficient (0 for frictionless contacts)"))
, d_epsilon (initData(&d_epsilon, 0.0_sreal, "epsilon", "Penalty parameter. It can be thought of as a proportional controller, the Lagrange multiplier is augmented by the violation multiplied by this factor at each solving iteration."))
{

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BilateralConstraintResolution3Dof : public ConstraintResolution
{
public:

BilateralConstraintResolution3Dof(sofa::type::Vec3d* vec = nullptr)
BilateralConstraintResolution3Dof(sofa::type::Vec3* vec = nullptr)
: ConstraintResolution(3)
, _f(vec)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ class BilateralConstraintResolution3Dof : public ConstraintResolution

protected:
sofa::type::Mat<3,3,SReal> invW;
sofa::type::Vec3d* _f;
sofa::type::Vec3* _f;
};

class BilateralConstraintResolutionNDof : public ConstraintResolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ using sofa::core::ConstraintParams ;
using sofa::core::ConstVecCoordId;

using sofa::linearalgebra::BaseVector ;
using sofa::type::Vec3d;
using sofa::type::Vec3;
using sofa::type::Quat ;

using sofa::defaulttype::Rigid3Types ;
Expand Down Expand Up @@ -123,7 +123,7 @@ class BilateralLagrangianConstraint : public PairInteractionConstraint<DataTypes
SingleLink<BilateralLagrangianConstraint<DataTypes>, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_topology1; ///< Link to be set to the first topology container in order to support topological changes
SingleLink<BilateralLagrangianConstraint<DataTypes>, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_topology2; ///< Link to be set to the second topology container in order to support topological changes

std::vector<Vec3d> prevForces;
std::vector<Vec3> prevForces;

BilateralLagrangianConstraint(MechanicalState* object1, MechanicalState* object2) ;
BilateralLagrangianConstraint(MechanicalState* object) ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/******************************************************************************
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
Expand Down Expand Up @@ -125,7 +125,7 @@ class StableNeoHookean : public HyperelasticMaterial<DataTypes>
MatrixSym Firstmatrix;
MatrixSym::Mat2Sym(inverse_C * (inputTensor * inverse_C), Firstmatrix);

outputTensor = 0.5 * (lambda + mu) * (Firstmatrix * (-2 * J * (J - alpha))
outputTensor = 0.5_sreal * (lambda + mu) * (Firstmatrix * (-2 * J * (J - alpha))
+ inverse_C * (J * (2 * J - alpha) * trHC));
}

Expand Down

0 comments on commit 4ee24f6

Please sign in to comment.