-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Constraint] Make name of constraints more explicit (#4302)
* Added projective and lagrangian suffix * Reported changes to Cuda plugin * Modify rest of the code to avoid warning from compatibility layer * Add compatibility layer for deprecated header in CUDA * add alias for compatibility layer in scene construction * Report name modification to all scenes * Revert Compat modification... * [LinearAlgera, Core] Fix linking with LTO on MacOS/Clang (#4293) Fix linking with LTO on macos * [LinearSolver] Remove CSparse-based linear solvers (#4258) * [LinearSolver.Direct] Remove CSparse based solvers * Remove csparse extlib * Fetchable CSparseSolvers plugin * Remove references of SparseLUSolver * Remove references to SparseCholeskySolver * Remove csparse * Try to fix on Linux * Update the compat * [LinearSolver.Direct] Remove CSparse based solvers * Fix direct solver * [GUI.Qt] Minor single-line cleaning (#4308) Co-authored-by: erik pernod <[email protected]> * [Sofa.GUI.Qt] Add cmake module for QGLViewer (#4290) * Add cmake module for QGLViewer * Support library name for apt packages * Fix qglviewer cmake finder module to first seach for a config cmake file. * Update cmake/Modules/FindQGLViewer.cmake Co-authored-by: Hugo <[email protected]> --------- Co-authored-by: Frederick Roy <[email protected]> Co-authored-by: Hugo <[email protected]> * [MultiThreading] Avoid Static Initialization Order Fiasco (#4307) * [Core] Minor clean of DefaultAnimationLoop (#4314) * Remove unlogical use of visitor * Delete unused methods * [LinearSystem] Speedup computation of Jacobian matrices (#4317) * [LinearSystem] Speedup computation of Jacobian matrices in case both mstates are the same * minor reformat to align calls to computeJacobiansFrom * [SofaCUDA] FIX compilation SofaCUDA along with SparseGrid with Cuda12 (#4319) * FIX compilation SofaCUDA along with SparseGrid with Cuda12 * Use a multiplication instead * [Common] Add message to make the fetch mechanism less hidden (#4310) * Add message to make it more clear * slight modifications to be even more clear and add an error the dependency cannot be met * [Collections] Remove reference to non-existing SofaSimulation (#4320) remove ref to non-existent sofasimu Co-authored-by: Paul Baksic <[email protected]> * Remove repeating preffix from projective constraints * Moved alias to original header * Changed deprecation date * add component change entry * Change name following discussion with Hugo * Change remaining scene with FixedConstraint * remove last occurences in py files * Changed the message display of sceneCheckUsingAlias when aliased component is in component change * Fix factory * Add alias creation when object in componentRenamed in factory * Remove precedently added aliases --------- Co-authored-by: Frederick Roy <[email protected]> Co-authored-by: Alex Bilger <[email protected]> Co-authored-by: erik pernod <[email protected]> Co-authored-by: Olivier Roussel <[email protected]> Co-authored-by: Hugo <[email protected]>
- Loading branch information
1 parent
b1c49a7
commit 026a501
Showing
564 changed files
with
15,086 additions
and
13,387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,176 +20,13 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#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/BilateralLagrangianConstraint.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/BilateralLagrangianConstraint.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 BilateralLagrangianConstraint") = BilateralLagrangianConstraint<T>; | ||
} |
Oops, something went wrong.