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
3 changes: 1 addition & 2 deletions Sofa/Component/AnimationLoop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ set(SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR "src/sofa/component/animationloop")

set(HEADER_FILES
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/config.h.in
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/FreeMotionAnimationLoop.h
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/ConstraintAnimationLoop.h
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/FreeMotionAnimationLoop.h
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/MultiStepAnimationLoop.h
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/MultiTagAnimationLoop.h
)

set(SOURCE_FILES
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/init.cpp
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/FreeMotionAnimationLoop.cpp
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/ConstraintAnimationLoop.cpp
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/MultiStepAnimationLoop.cpp
${SOFACOMPONENTANIMATIONLOOP_SOURCE_DIR}/MultiTagAnimationLoop.cpp
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,148 +22,4 @@
#pragma once
#include <sofa/component/animationloop/config.h>

SOFA_HEADER_DEPRECATED_NOT_REPLACED("v26.06", "v26.12")


#include <sofa/helper/map.h>
#include <sofa/linearalgebra/FullMatrix.h>
#include <sofa/core/MultiVecId.h>
#include <sofa/core/VecId.h>
#include <sofa/core/behavior/BaseConstraintCorrection.h>
#include <sofa/core/behavior/OdeSolver.h>
#include <sofa/core/ConstraintParams.h>
#include <sofa/core/fwd.h>

#include <sofa/simulation/CollisionAnimationLoop.h>
#include <sofa/simulation/MechanicalVisitor.h>
#include <sofa/simulation/fwd.h>

#include <vector>

namespace sofa::simulation::mechanicalvisitor
{
class MechanicalAccumulateMatrixDeriv;
class MechanicalBuildConstraintMatrix;
}

namespace sofa::component::constraint::lagrangian::solver
{
class MechanicalGetConstraintResolutionVisitor;
}

namespace sofa::component::animationloop
{

class SOFA_COMPONENT_ANIMATIONLOOP_API ConstraintProblem
{
protected:
sofa::linearalgebra::LPtrFullMatrix<SReal> _W;
sofa::linearalgebra::FullVector<SReal> _dFree, _force, _d, _df;// cf. These Duriez + _df for scheme correction
std::vector<core::behavior::ConstraintResolution*> _constraintsResolutions;
SReal _tol;
int _dim;
sofa::helper::system::thread::CTime *_timer;

public:
ConstraintProblem(bool printLog=false);
virtual ~ConstraintProblem();
virtual void clear(int dim, const SReal &tol);

inline int getSize(void) {return _dim;}
inline sofa::linearalgebra::LPtrFullMatrix<SReal>* getW(void) {return &_W;}
inline sofa::linearalgebra::FullVector<SReal>* getDfree(void) {return &_dFree;}
inline sofa::linearalgebra::FullVector<SReal>* getD(void) {return &_d;}
inline sofa::linearalgebra::FullVector<SReal>* getF(void) {return &_force;}
inline sofa::linearalgebra::FullVector<SReal>* getdF(void) {return &_df;}
inline std::vector<core::behavior::ConstraintResolution*>& getConstraintResolutions(void) {return _constraintsResolutions;}
inline SReal *getTolerance(void) {return &_tol;}

void gaussSeidelConstraintTimed(SReal &timeout, int numItMax);
};




class SOFA_COMPONENT_ANIMATIONLOOP_API ConstraintAnimationLoop : public sofa::simulation::CollisionAnimationLoop
{
public:
typedef sofa::simulation::CollisionAnimationLoop Inherit;

SOFA_CLASS(ConstraintAnimationLoop, sofa::simulation::CollisionAnimationLoop);
protected:
ConstraintAnimationLoop();
~ConstraintAnimationLoop() override;
public:

void step(const core::ExecParams* params, SReal dt) override;
void init() override;

Data<bool> d_displayTime; ///< Display time for each important step of ConstraintAnimationLoop.
Data<SReal> d_tol; ///< Tolerance of the Gauss-Seidel
Data<int> d_maxIt; ///< Maximum number of iterations of the Gauss-Seidel
Data<bool> d_doCollisionsFirst; ///< Compute the collisions first (to support penality-based contacts)
Data<bool> d_doubleBuffer; ///< Double the buffer dedicated to the constraint problem to make it accessible to another thread
Data<bool> d_scaleTolerance; ///< Scale the error tolerance with the number of constraints
Data<bool> d_allVerified; ///< All constraints must be verified (each constraint's error < tolerance)
Data<SReal> d_sor; ///< Successive Over Relaxation parameter (0-2)
Data<bool> d_schemeCorrection; ///< Apply new scheme where compliance is progressively corrected
Data<bool> d_realTimeCompensation; ///< If the total computational time T < dt, sleep(dt-T)

Data<bool> d_activateSubGraph;

Data<std::map < std::string, sofa::type::vector<SReal> > > d_graphErrors; ///< Sum of the constraints' errors at each iteration
Data<std::map < std::string, sofa::type::vector<SReal> > > d_graphConstraints; ///< Graph of each constraint's error at the end of the resolution
Data<std::map < std::string, sofa::type::vector<SReal> > > d_graphForces; ///< Graph of each constraint's force at each step of the resolution

ConstraintProblem *getConstraintProblem() {return bufCP1 ? &CP1 : &CP2;}

protected:
void launchCollisionDetection(const core::ExecParams* params);
void freeMotion(const core::ExecParams* params, simulation::Node *context, SReal &dt);
void setConstraintEquations(const core::ExecParams* params, simulation::Node *context);
void correctiveMotion(const core::ExecParams* params, simulation::Node *context);
void debugWithContact(int numConstraints);

/// Specific procedures that are called for setting the constraints:

/// 1.calling resetConstraint & setConstraint & accumulateConstraint visitors
/// and resize the constraint problem that will be solved
void writeAndAccumulateAndCountConstraintDirections(const core::ExecParams* params, simulation::Node *context, unsigned int &numConstraints);

/// 2.calling GetConstraintViolationVisitor: each constraint provides its present violation
/// for a given state (by default: free_position TODO: add VecId to make this method more generic)
void getIndividualConstraintViolations(const core::ExecParams* params, simulation::Node *context);

/// 3.calling getConstraintResolution: each constraint provides a method that is used to solve it during GS iterations
void getIndividualConstraintSolvingProcess(const core::ExecParams* params, simulation::Node *context);

/// 4.calling addComplianceInConstraintSpace projected in the contact space => getDelassusOperator(_W) = H*C*Ht
virtual void computeComplianceInConstraintSpace();


/// method for predictive scheme:
void computePredictiveForce(int dim, SReal* force, std::vector<core::behavior::ConstraintResolution*>& res);



void gaussSeidelConstraint(int dim, SReal* dfree, SReal** w, SReal* force, SReal* d, std::vector<core::behavior::ConstraintResolution*>& res, SReal* df);

std::vector<core::behavior::BaseConstraintCorrection*> constraintCorrections;


virtual ConstraintProblem* getCP();

sofa::helper::system::thread::CTime *timer;
SReal timeScale, time ;


unsigned int numConstraints;

bool bufCP1;
SReal compTime, iterationTime;

private:
ConstraintProblem CP1, CP2;
};

} //namespace sofa::component::animationloop
SOFA_HEADER_DISABLED_NOT_REPLACED("v26.06", "v26.12")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
namespace sofa::component::animationloop
{

extern void registerConstraintAnimationLoop(sofa::core::ObjectFactory* factory);
extern void registerFreeMotionAnimationLoop(sofa::core::ObjectFactory* factory);
extern void registerMultiStepAnimationLoop(sofa::core::ObjectFactory* factory);
extern void registerMultiTagAnimationLoop(sofa::core::ObjectFactory* factory);
Expand Down Expand Up @@ -55,7 +54,6 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerConstraintAnimationLoop(factory);
registerFreeMotionAnimationLoop(factory);
registerMultiStepAnimationLoop(factory);
registerMultiTagAnimationLoop(factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ void PenalityContactForceField<DataTypes>::grabPoint(
{
if (contactsRef[i].m1 == index[j])
{
result.push_back(std::make_pair(static_cast< core::objectmodel::BaseComponent *>(this),mstate2Pos[contactsRef[i].m2]));
const auto& p2 = mstate2Pos[contactsRef[i].m2];
result.push_back(std::make_pair(static_cast< core::objectmodel::BaseComponent *>(this), type::Vec3f(p2[0], p2[1], p2[2])));
triangle.push_back(contactsRef[i].index2);
index_point.push_back(index[j]);
}
Expand All @@ -371,7 +372,8 @@ void PenalityContactForceField<DataTypes>::grabPoint(
{
if (contactsRef[i].m2 == index[j])
{
result.push_back(std::make_pair(static_cast< core::objectmodel::BaseComponent *>(this), mstate1Pos[contactsRef[i].m1]));
const auto& p1 = mstate1Pos[contactsRef[i].m1];
result.push_back(std::make_pair(static_cast< core::objectmodel::BaseComponent *>(this), type::Vec3f(p1[0], p1[1], p1[2])));
triangle.push_back(contactsRef[i].index1);
index_point.push_back(index[j]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class BilateralLagrangianConstraint : public PairInteractionConstraint<DataTypes
Data<VecDeriv> d_restVector; ///< Relative position to maintain between attached points (optional)
VecCoord initialDifference;

SOFA_ATTRIBUTE_DISABLED__BILATERALREMOVEUNUSEDTOLERANCE() DeprecatedAndRemoved d_numericalTolerance; ///< a real value specifying the tolerance during the constraint solving. (default=0.0001

Data<bool> d_activate; ///< control constraint activation (true by default)
Data<bool> d_keepOrientDiff; ///< keep the initial difference in orientation (only for rigids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma once
#include <sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.h>

#include <sofa/core/behavior/Constraint.inl>
#include <sofa/core/behavior/LagrangianConstraint.inl>
#include <sofa/core/objectmodel/Data.h>
#include <sofa/component/constraint/lagrangian/model/BilateralConstraintResolution.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,3 @@ namespace sofa::component::constraint::lagrangian::model
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace sofa::component::constraint::lagrangian::model


#ifdef SOFA_BUILD_SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL
#define SOFA_ATTRIBUTE_DISABLED__BILATERALREMOVEUNUSEDTOLERANCE()
#else
#define SOFA_ATTRIBUTE_DISABLED__BILATERALREMOVEUNUSEDTOLERANCE() \
SOFA_ATTRIBUTE_DISABLED( \
"v25.06", "v25.12", \
"Data \'d_numericalTolerance\' has been removed since it was actually not taken into account")
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API LCPConstraintSolver : publ
Data<SReal> d_mu; ///< Friction coefficient
Data<SReal> d_minW; ///< If not zero, constraints whose self-compliance (i.e. the corresponding value on the diagonal of W) is smaller than this threshold will be ignored
Data<SReal> d_maxF; ///< If not zero, constraints whose response force becomes larger than this threshold will be ignored
DeprecatedAndRemoved d_multi_grid; ///< activate multi_grid resolution (NOT STABLE YET)
DeprecatedAndRemoved d_multi_grid_levels; ///< if multi_grid is active: how many levels to create (>=2)
DeprecatedAndRemoved d_merge_method; ///< if multi_grid is active: which method to use to merge constraints (0 = compliance-based, 1 = spatial coordinates)
DeprecatedAndRemoved d_merge_spatial_step; ///< if merge_method is 1: grid size reduction between multigrid levels
DeprecatedAndRemoved d_merge_local_levels; ///< if merge_method is 1: up to the specified level of the multigrid, constraints are grouped locally, i.e. separately within each contact pairs, while on upper levels they are grouped globally independently of contact pairs.
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_multi_grid; ///< activate multi_grid resolution (NOT STABLE YET)
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_multi_grid_levels; ///< if multi_grid is active: how many levels to create (>=2)
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_merge_method; ///< if multi_grid is active: which method to use to merge constraints (0 = compliance-based, 1 = spatial coordinates)
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_merge_spatial_step; ///< if merge_method is 1: grid size reduction between multigrid levels
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_merge_local_levels; ///< if merge_method is 1: up to the specified level of the multigrid, constraints are grouped locally, i.e. separately within each contact pairs, while on upper levels they are grouped globally independently of contact pairs.
Data<type::vector< SReal >> d_constraintForces; ///< OUTPUT: constraint forces (stored only if computeConstraintForces=True)
Data<bool> d_computeConstraintForces; ///< The indices of the constraintForces to store in the constraintForce data field

Data < std::set<int> > d_constraintGroups; ///< list of ID of groups of constraints to be handled by this solver.

Data<std::map < std::string, sofa::type::vector<SReal> > > d_graph; ///< Graph of residuals at each iteration

DeprecatedAndRemoved d_showLevels; ///< Number of constraint levels to display
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_showLevels; ///< Number of constraint levels to display
Data<SReal> d_showCellWidth; ///< Distance between each constraint cells
Data<type::Vec3> d_showTranslation; ///< Position of the first cell
DeprecatedAndRemoved d_showLevelTranslation; ///< Translation between levels
SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() DeprecatedAndRemoved d_showLevelTranslation; ///< Translation between levels

ConstraintProblem* getConstraintProblem() override;
void lockConstraintProblem(sofa::core::objectmodel::BaseComponent* from, ConstraintProblem* p1, ConstraintProblem* p2=nullptr) override; ///< Do not use the following LCPs until the next call to this function. This is used to prevent concurrent access to the LCP when using a LCPForceFeedback through an haptic thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
# define SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#ifdef SOFA_BUILD_SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER
#define SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID()
#else
#define SOFA_ATTRIBUTE_DISABLED__LCPCONSTRAINTSOLVERMULTIGRID() \
SOFA_ATTRIBUTE_DISABLED("v25.12", "v27.06", "Multigrid support has been removed from LCPConstraintSolver.")
#endif

namespace sofa::component::constraint::lagrangian::solver
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ class TetrahedronDiffusionFEMForceField : public core::behavior::ForceField<Data
Data<Real> d_constantDiffusionCoefficient;
/// Vector of diffusivities associated with all tetras
Data<sofa::type::vector<Real> > d_tetraDiffusionCoefficient;
/// bool used to specify 1D diffusion
/// This data is now useless, as it can be deduced from the template
DeprecatedAndRemoved d_1DDiffusion;

/// Ratio for anisotropic diffusion
Data<Real> d_transverseAnisotropyRatio;
/// Vector for transverse anisotropy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class EigenDirectSparseSolver

protected:

DeprecatedAndRemoved d_orderingMethod;
std::string m_selectedOrderingMethod;

std::unique_ptr<BaseEigenSolverProxy> m_solver;
Expand Down
2 changes: 0 additions & 2 deletions Sofa/Component/LinearSolver/Iterative/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ set(HEADER_FILES
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/MatrixLinearSystem[GraphScattered].h
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/MinResLinearSolver.h
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/MinResLinearSolver.inl
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/ShewchukPCGLinearSolver.h
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/ShewchukPCGLinearSolver.inl
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/PCGLinearSolver.h
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/PCGLinearSolver.inl
${SOFACOMPONENTLINEARSOLVERITERATIVE_SOURCE_DIR}/PreconditionedMatrixFreeSystem.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ class BaseMatrixLinearSolver : public sofa::core::behavior::LinearSolver

virtual void solve(Matrix& M, Vector& solution, Vector& rh) = 0;

SOFA_ITERATIVE_SOLVER_ATTRIBUTE_REMOVE_ASSEMBLY_API()
virtual Matrix * getSystemMatrix() final = delete;

};

/// Empty class used for default solver implementation without multi-threading support
Expand Down Expand Up @@ -194,10 +191,6 @@ class MatrixLinearSolver<Matrix,Vector,NoThreadManager> : public BaseMatrixLinea

void init() override;

/// Reset the current linear system.
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_REMOVE_ASSEMBLY_API()
void resizeSystem(Size n) = delete;

/// Get the linear system right-hand term vector, or nullptr if this solver does not build it
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DISABLED_ASSEMBLY_API()
Vector* getSystemRHVector() = delete;
Expand All @@ -212,10 +205,6 @@ class MatrixLinearSolver<Matrix,Vector,NoThreadManager> : public BaseMatrixLinea
/// Solve the system as constructed using the previous methods
void solveSystem() override;

/// Apply the solution of the system to all the objects
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_REMOVE_ASSEMBLY_API()
void applySystemSolution() = delete;

/// Invert the system, this method is optional because it's call when solveSystem() is called for the first time
void invertSystem() override;

Expand Down Expand Up @@ -332,12 +321,6 @@ class MatrixLinearSolver<Matrix,Vector,NoThreadManager> : public BaseMatrixLinea

virtual MatrixInvertData * createInvertData();

SOFA_ITERATIVE_SOLVER_ATTRIBUTE_REMOVE_ASSEMBLY_API()
DeprecatedAndRemoved linearSystem;

SOFA_ITERATIVE_SOLVER_ATTRIBUTE_REMOVE_ASSEMBLY_API()
DeprecatedAndRemoved currentMFactor, currentBFactor, currentKFactor;

bool singleThreadAddJMInvJtLocal(Matrix * /*M*/,ResMatrixType * result,const JMatrixType * J, SReal fact);

Data<bool> d_factorizationInvalidation;
Expand Down
Loading
Loading