Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[All] Changed message for scene check #4324

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a50701b
Added projective and lagrangian suffix
bakpaul Nov 17, 2023
6502243
Reported changes to Cuda plugin
bakpaul Nov 21, 2023
5252432
Modify rest of the code to avoid warning from compatibility layer
bakpaul Nov 21, 2023
c315181
Add compatibility layer for deprecated header in CUDA
bakpaul Nov 21, 2023
39b00dd
add alias for compatibility layer in scene construction
bakpaul Nov 21, 2023
42fe9f6
Report name modification to all scenes
bakpaul Nov 21, 2023
b9d94ea
Revert Compat modification...
bakpaul Nov 21, 2023
d689871
[LinearAlgera, Core] Fix linking with LTO on MacOS/Clang (#4293)
fredroy Nov 22, 2023
32d6b98
[LinearSolver] Remove CSparse-based linear solvers (#4258)
alxbilger Nov 23, 2023
af57258
[GUI.Qt] Minor single-line cleaning (#4308)
alxbilger Nov 24, 2023
0e7ccbe
[Sofa.GUI.Qt] Add cmake module for QGLViewer (#4290)
olivier-roussel Nov 29, 2023
620bc51
[MultiThreading] Avoid Static Initialization Order Fiasco (#4307)
alxbilger Nov 29, 2023
7f4fdef
[Core] Minor clean of DefaultAnimationLoop (#4314)
bakpaul Nov 29, 2023
c2af338
[LinearSystem] Speedup computation of Jacobian matrices (#4317)
alxbilger Nov 29, 2023
7811db5
[SofaCUDA] FIX compilation SofaCUDA along with SparseGrid with Cuda12…
bakpaul Nov 29, 2023
13e9031
[Common] Add message to make the fetch mechanism less hidden (#4310)
bakpaul Nov 29, 2023
d696114
[Collections] Remove reference to non-existing SofaSimulation (#4320)
fredroy Nov 29, 2023
109e4ee
Remove repeating preffix from projective constraints
bakpaul Nov 29, 2023
e43420d
Moved alias to original header
bakpaul Nov 29, 2023
9a2a1d0
Changed deprecation date
bakpaul Nov 29, 2023
e9dc62a
add component change entry
bakpaul Nov 29, 2023
7bf84de
Changed the message display of sceneCheckUsingAlias when aliased comp…
bakpaul Nov 29, 2023
1384deb
Fix factory
bakpaul Nov 29, 2023
c6628b2
Merge branch 'master' into change_name_changed_message_for_scene_check
bakpaul Nov 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <sofa/core/collision/Contact.h>
#include <sofa/core/collision/Intersection.h>
#include <sofa/core/behavior/MechanicalState.h>
#include <sofa/component/constraint/lagrangian/model/UnilateralInteractionConstraint.h>
#include <sofa/component/constraint/lagrangian/model/UnilateralInteractionLagrangianConstraint.h>
#include <sofa/component/collision/response/mapper/BaseContactMapper.h>
#include <sofa/component/collision/response/contact/ContactIdentifier.h>

Expand Down Expand Up @@ -60,7 +60,7 @@ class FrictionContact : public core::collision::Contact, public ContactIdentifie
mapper::ContactMapper<CollisionModel1,DataTypes1> mapper1;
mapper::ContactMapper<CollisionModel2,DataTypes2> mapper2;

constraint::lagrangian::model::UnilateralInteractionConstraint<sofa::defaulttype::Vec3Types>::SPtr m_constraint;
constraint::lagrangian::model::UnilateralInteractionLagrangianConstraint<sofa::defaulttype::Vec3Types>::SPtr m_constraint;
core::objectmodel::BaseContext* parent;

Data<double> mu; ///< friction coefficient (0 for frictionless contacts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void FrictionContact<TCollisionModel1,TCollisionModel2,ResponseDataTypes>::activ
{
mmodel2 = mapper2.createMapping(getName().c_str());
}
m_constraint = sofa::core::objectmodel::New<constraint::lagrangian::model::UnilateralInteractionConstraint<defaulttype::Vec3Types> >(mmodel1, mmodel2);
m_constraint = sofa::core::objectmodel::New<constraint::lagrangian::model::UnilateralInteractionLagrangianConstraint<defaulttype::Vec3Types> >(mmodel1, mmodel2);
m_constraint->setName( getName() );
setInteractionTags(mmodel1, mmodel2);
m_constraint->setCustomTolerance( tol.getValue() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <sofa/core/collision/Contact.h>
#include <sofa/core/collision/Intersection.h>
#include <sofa/component/constraint/lagrangian/model/BilateralInteractionConstraint.h>
#include <sofa/component/constraint/lagrangian/model/BilateralInteractionLagrangianConstraint.h>
#include <sofa/helper/Factory.h>
#include <sofa/component/collision/response/mapper/BaseContactMapper.h>
#include <sofa/component/collision/response/contact/ContactIdentifier.h>
Expand Down Expand Up @@ -58,7 +58,7 @@ class StickContactConstraint : public core::collision::Contact, public ContactId
mapper::ContactMapper<CollisionModel1,DataTypes1> mapper1;
mapper::ContactMapper<CollisionModel2,DataTypes2> mapper2;

constraint::lagrangian::model::BilateralInteractionConstraint<sofa::defaulttype::Vec3Types>::SPtr m_constraint;
constraint::lagrangian::model::BilateralInteractionLagrangianConstraint<sofa::defaulttype::Vec3Types>::SPtr m_constraint;
core::objectmodel::BaseContext* parent;

std::vector< sofa::core::collision::DetectionOutput* > contacts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void StickContactConstraint<TCollisionModel1,TCollisionModel2>::activateMappers(
msg_info() << "Creating StickContactConstraint bilateral constraints";
MechanicalState1* mstate1 = mapper1.createMapping(mapper::GenerateStringID::generate().c_str());
MechanicalState2* mstate2 = mapper2.createMapping(mapper::GenerateStringID::generate().c_str());
m_constraint = sofa::core::objectmodel::New<constraint::lagrangian::model::BilateralInteractionConstraint<defaulttype::Vec3Types> >(mstate1, mstate2);
m_constraint = sofa::core::objectmodel::New<constraint::lagrangian::model::BilateralInteractionLagrangianConstraint<defaulttype::Vec3Types> >(mstate1, mstate2);
m_constraint->setName( getName() );
}

Expand Down
23 changes: 18 additions & 5 deletions Sofa/Component/Constraint/Lagrangian/Model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,30 @@ set(HEADER_FILES
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/StopperConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralConstraintResolution.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionConstraint.inl

${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/BilateralInteractionLagrangianConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/BilateralInteractionLagrangianConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/SlidingLagrangianConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/SlidingLagrangianConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/StopperLagrangianConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/StopperLagrangianConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformLagrangianConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformLagrangianConstraint.inl
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionLagrangianConstraint.h
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionLagrangianConstraint.inl
)

set(SOURCE_FILES
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/init.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/BilateralInteractionConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/SlidingConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/StopperConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/BilateralInteractionLagrangianConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/SlidingLagrangianConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/StopperLagrangianConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UniformLagrangianConstraint.cpp
${SOFACOMPONENTCONSTRAINTLAGRANGIANMODEL_SOURCE_DIR}/UnilateralInteractionLagrangianConstraint.cpp

)

sofa_find_package(Sofa.Simulation.Core REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,176 +20,13 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <sofa/component/constraint/lagrangian/model/config.h>

#include <sofa/core/topology/TopologySubsetIndices.h>
#include <sofa/core/behavior/PairInteractionConstraint.h>
#include <sofa/core/behavior/MechanicalState.h>
#include <sofa/component/constraint/lagrangian/model/BilateralInteractionLagrangianConstraint.h>

#include <sofa/type/Mat.h>
#include <sofa/defaulttype/RigidTypes.h>
#include <sofa/type/Vec.h>
#include <sofa/defaulttype/VecTypes.h>

#include <deque>

#include <sofa/component/constraint/lagrangian/model/BilateralConstraintResolution.h>
SOFA_DEPRECATED_HEADER("v24.06", "v25.06", "sofa/component/constraint/lagrangian/model/BilateralInteractionLagrangianConstraint.h")

namespace sofa::component::constraint::lagrangian::model
{

/// These 'using' are in a per-file namespace so they will not leak
/// and polluate the standard namespace.
using sofa::core::behavior::BaseConstraint ;
using sofa::core::behavior::ConstraintResolution ;
using sofa::core::behavior::PairInteractionConstraint ;
using sofa::core::objectmodel::Data ;
using sofa::core::ConstraintParams ;
using sofa::core::ConstVecCoordId;

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

using sofa::defaulttype::Rigid3Types ;
using sofa::defaulttype::Vec3Types ;


template<class T>
class BilateralInteractionConstraintSpecialization {};


template<class DataTypes>
class BilateralInteractionConstraint : public PairInteractionConstraint<DataTypes>
{
public:
SOFA_CLASS(SOFA_TEMPLATE(BilateralInteractionConstraint,DataTypes),
SOFA_TEMPLATE(PairInteractionConstraint,DataTypes));

/// That any templates variation of BilateralInteractionConstraintSpecialization are friend.
template<typename>
friend class BilateralInteractionConstraintSpecialization ;

typedef PairInteractionConstraint<DataTypes> Inherit;

typedef typename DataTypes::VecCoord VecCoord;
typedef typename DataTypes::VecDeriv VecDeriv;
typedef typename DataTypes::MatrixDeriv MatrixDeriv;
typedef typename DataTypes::Coord Coord;
typedef typename DataTypes::Deriv Deriv;
typedef typename Coord::value_type Real;
typedef typename DataTypes::MatrixDeriv::RowIterator MatrixDerivRowIterator;

typedef core::behavior::MechanicalState<DataTypes> MechanicalState;
typedef BaseConstraint::PersistentID PersistentID;

typedef Data<VecCoord> DataVecCoord;
typedef Data<VecDeriv> DataVecDeriv;
typedef Data<MatrixDeriv> DataMatrixDeriv;

using SubsetIndices = type::vector<Index>;
using DataSubsetIndices = sofa::core::topology::TopologySubsetIndices;

protected:
std::vector<Deriv> dfree;
Quat<SReal> q;

std::vector<unsigned int> cid;

DataSubsetIndices m1; ///< index of the constraint on the first model
DataSubsetIndices m2; ///< index of the constraint on the second model
Data<VecDeriv> restVector; ///< Relative position to maintain between attached points (optional)
VecCoord initialDifference;

Data<double> d_numericalTolerance; ///< a real value specifying the tolerance during the constraint solving. (default=0.0001
Data<bool> d_activate; ///< bool to control constraint activation
Data<bool> keepOrientDiff; ///< keep the initial difference in orientation (only for rigids)


SingleLink<BilateralInteractionConstraint<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<BilateralInteractionConstraint<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;

SOFA_ATTRIBUTE_DISABLED__BILATERALINTERACTIONCONSTRAINTDATA("Data 'activateAtIteration' has been removed, please use the Data d_activate instead and an engine or a script to change the behavior at the right step (see PR #3327).")
sofa::core::objectmodel::lifecycle::RemovedData activateAtIteration{this, "v22.12", "v23.06", "activateAtIteration", "use the boolean data 'activate' instead and an engine or a script to change the behavior at the right step (see PR #3327)."};

SOFA_ATTRIBUTE_DISABLED__BILATERALINTERACTIONCONSTRAINTDATA("Data 'merge' has been removed. Its behavior was unused, undocumented, untested, and unclear (see PR #3328).")
sofa::core::objectmodel::lifecycle::RemovedData merge{this, "v22.12", "v23.06", "merge", "Its behavior was unused, undocumented, untested, and unclear (see PR #3328), please report to sofa-dev if you want the feature back."};

SOFA_ATTRIBUTE_DISABLED__BILATERALINTERACTIONCONSTRAINTDATA("Data 'derivative' has been removed. Its behavior was unused, undocumented, untested, and unclear (see PR #3328).")
sofa::core::objectmodel::lifecycle::RemovedData derivative{this, "v22.12", "v23.06", "derivative", "Its behavior was unused, undocumented, untested, and unclear (see PR #3328), please report to sofa-dev if you want the feature back."};


BilateralInteractionConstraint(MechanicalState* object1, MechanicalState* object2) ;
BilateralInteractionConstraint(MechanicalState* object) ;
BilateralInteractionConstraint();

virtual ~BilateralInteractionConstraint(){}
public:
void init() override;

void bwdInit() override {}

void reinit() override;

void buildConstraintMatrix(const ConstraintParams* cParams,
DataMatrixDeriv &c1, DataMatrixDeriv &c2,
unsigned int &cIndex,
const DataVecCoord &x1, const DataVecCoord &x2) override;

void getConstraintViolation(const ConstraintParams* cParams,
BaseVector *v,
const DataVecCoord &x1, const DataVecCoord &x2,
const DataVecDeriv &v1, const DataVecDeriv &v2) override;

void getVelocityViolation(BaseVector *v,
const DataVecCoord &x1, const DataVecCoord &x2,
const DataVecDeriv &v1, const DataVecDeriv &v2);

void getConstraintResolution(const ConstraintParams* cParams,
std::vector<ConstraintResolution*>& resTab,
unsigned int& offset) override;

void handleEvent(sofa::core::objectmodel::Event *event) override;

void draw(const core::visual::VisualParams* vparams) override;

void clear(int reserve = 0) ;

virtual void addContact(Deriv norm, Coord P, Coord Q, Real contactDistance,
int m1, int m2, Coord Pfree, Coord Qfree,
long id=0, PersistentID localid=0);

void addContact(Deriv norm, Coord P, Coord Q, Real contactDistance,
int m1, int m2, long id=0, PersistentID localid=0) ;

void addContact(Deriv norm, Real contactDistance, int m1, int m2,
long id=0, PersistentID localid=0) ;

/// Method to remove a contact using point @param indices and id of buffer: @sa m1 (resp. @sa 2m) if @param objectId is equal to 0 (resp. to 1)
void removeContact(int objectId, SubsetIndices indices);

virtual type::vector<std::string> getBilateralInteractionIdentifiers() {return {};}

virtual type::vector<std::string> getPairInteractionIdentifiers() override final
{
type::vector<std::string> ids = getBilateralInteractionIdentifiers();
ids.push_back("Bilateral");
return ids;
}

private:
void unspecializedInit() ;

/// Method to get the index position of a @param point Id inside @sa m1 or @sa m2) depending of the value passed in @param cIndices. Return InvalidID if not found.
Index indexOfElemConstraint(const SubsetIndices& cIndices, Index Id);
};


#if !defined(SOFA_COMPONENT_CONSTRAINTSET_BILATERALINTERACTIONCONSTRAINT_CPP)
extern template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API BilateralInteractionConstraint< Vec3Types >;
extern template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API BilateralInteractionConstraint< Rigid3Types >;
#endif

} // namespace sofa::component::constraint::lagrangian::model
using BilateralInteractionConstraint SOFA_ATTRIBUTE_DEPRECATED("v24.06 ", "v25.06", "BilateralInteractionConstraint has been renamed to BilateralInteractionLagrangianConstraint") = BilateralInteractionLagrangianConstraint<T>;
}
Loading
Loading