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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace sofa::component::collision::detection::algorithm

void registerRayTraceDetection(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Collision detection using TriangleOctreeModel.")
factory->registerObjects(core::ObjectRegistrationData("Collision detection using TriangleOctreeCollisionModel.")
.add<RayTraceDetection>());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace sofa::component::collision::detection::algorithm
*
* For each point in one object, we trace a ray following the opposite of the point's normal
* up to find a triangle in the other object. Both triangles are tested to evaluate if they are in
* colliding state. It must be used with a TriangleOctreeModel,as an octree is used to traverse the object.
* colliding state. It must be used with a TriangleOctreeCollisionModel,as an octree is used to traverse the object.
*/
class SOFA_COMPONENT_COLLISION_DETECTION_ALGORITHM_API RayTraceDetection final :
public sofa::core::objectmodel::BaseObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ using sofa::helper::TriangleOctree;

void registerRayTraceNarrowPhase(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Narrow phase of the collision detection using TriangleOctreeModel")
factory->registerObjects(core::ObjectRegistrationData("Narrow phase of the collision detection using TriangleOctreeCollisionModel")
.add < RayTraceNarrowPhase >());
}

void RayTraceNarrowPhase::findPairsVolume (CubeCollisionModel * cm1, CubeCollisionModel * cm2)
{
/*Obtain the CollisionModel at the lowest level, in this case it must be a TriangleOctreeModel */
/*Obtain the CollisionModel at the lowest level, in this case it must be a TriangleOctreeCollisionModel */

TriangleOctreeModel *tm1 =
dynamic_cast < TriangleOctreeModel * >(cm1->getLast ());
TriangleOctreeModel *tm2 =
dynamic_cast < TriangleOctreeModel * >(cm2->getLast ());
TriangleOctreeCollisionModel *tm1 =
dynamic_cast < TriangleOctreeCollisionModel * >(cm1->getLast ());
TriangleOctreeCollisionModel *tm2 =
dynamic_cast < TriangleOctreeCollisionModel * >(cm2->getLast ());
if (!tm1 || !tm2)
return;

Expand All @@ -66,7 +66,7 @@ void RayTraceNarrowPhase::findPairsVolume (CubeCollisionModel * cm1, CubeCollisi

}

/* get the output vector for a TriangleOctreeModel, TriangleOctreeModel Collision*/
/* get the output vector for a TriangleOctreeCollisionModel, TriangleOctreeCollisionModel Collision*/
/*Get the cube representing the bounding box of both Models */
// sofa::core::collision::DetectionOutputVector *& contacts=outputsMap[std::make_pair(tm1, tm2)];
core::collision::DetectionOutputVector*& contacts = this->getDetectionOutputs(tm1, tm2);
Expand All @@ -76,17 +76,17 @@ void RayTraceNarrowPhase::findPairsVolume (CubeCollisionModel * cm1, CubeCollisi
{
contacts = new
sofa::core::collision::TDetectionOutputVector <
TriangleOctreeModel, TriangleOctreeModel >;
TriangleOctreeCollisionModel, TriangleOctreeCollisionModel >;

}




TDetectionOutputVector < TriangleOctreeModel,
TriangleOctreeModel > *outputs =
static_cast < TDetectionOutputVector < TriangleOctreeModel,
TriangleOctreeModel > *>(contacts);
TDetectionOutputVector < TriangleOctreeCollisionModel,
TriangleOctreeCollisionModel > *outputs =
static_cast < TDetectionOutputVector < TriangleOctreeCollisionModel,
TriangleOctreeCollisionModel > *>(contacts);

Cube cube1 (cm1, 0);
const Cube cube2 (cm2, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace sofa::component::collision::detection::algorithm
*
* For each point in one object, we trace a ray following the opposite of the point's normal
* up to find a triangle in the other object. Both triangles are tested to evaluate if they are in
* colliding state. It must be used with a TriangleOctreeModel,as an octree is used to traverse the object.
* colliding state. It must be used with a TriangleOctreeCollisionModel,as an octree is used to traverse the object.
*/
class SOFA_COMPONENT_COLLISION_DETECTION_ALGORITHM_API RayTraceNarrowPhase : public core::collision::NarrowPhaseDetection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
#include <sofa/component/collision/geometry/config.h>
#include <sofa/component/collision/geometry/TriangleOctreeCollisionModel.h>

SOFA_HEADER_DEPRECATED("v25.12", "v26.06", "sofa/component/collision/geometry/TriangleOctreeModel.h")
SOFA_HEADER_DISABLED("v25.12", "v26.06", "sofa/component/collision/geometry/TriangleOctreeCollisionModel.h")
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ typedef core::topology::BaseMeshTopology::Triangle Triangle;
namespace sofa::component::collision::geometry
{

void registerTriangleOctreeModel(sofa::core::ObjectFactory* factory)
void registerTriangleOctreeCollisionModel(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Collision model using a triangular mesh mapped to an Octree.")
.add < TriangleOctreeCollisionModel >()
.addAlias("TriangleOctreeModel")); // SOFA_ATTRIBUTE_DEPRECATED__RENAMED_TRIANGLEOCTREEMODEL()
.add < TriangleOctreeCollisionModel >());
}

TriangleOctreeCollisionModel::TriangleOctreeCollisionModel ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,4 @@ class SOFA_COMPONENT_COLLISION_GEOMETRY_API TriangleOctreeCollisionModel : publi
void buildOctree ();
};


using TriangleOctreeModel SOFA_ATTRIBUTE_DEPRECATED__RENAMED_TRIANGLEOCTREEMODEL() = TriangleOctreeCollisionModel;


} // namespace sofa::component::collision::geometry
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,3 @@ namespace sofa::component::collision::geometry
} // namespace sofa::component::collision::geometry


#ifdef SOFA_BUILD_SOFA_COMPONENT_COLLISION_GEOMETRY
#define SOFA_ATTRIBUTE_DEPRECATED__RENAMED_TRIANGLEOCTREEMODEL()
#else
#define SOFA_ATTRIBUTE_DEPRECATED__RENAMED_TRIANGLEOCTREEMODEL() \
SOFA_ATTRIBUTE_DEPRECATED( \
"v25.12", "v26.06", \
"TriangleOctreeModel has been renamed to TriangleOctreeCollisionModel in PR5766")
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern void registerSphereCollisionModel(sofa::core::ObjectFactory* factory);
extern void registerTetrahedronCollisionModel(sofa::core::ObjectFactory* factory);
extern void registerTriangleCollisionModel(sofa::core::ObjectFactory* factory);
extern void registerTriangleModelInRegularGrid(sofa::core::ObjectFactory* factory);
extern void registerTriangleOctreeModel(sofa::core::ObjectFactory* factory);
extern void registerTriangleOctreeCollisionModel(sofa::core::ObjectFactory* factory);

extern "C" {
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
Expand Down Expand Up @@ -70,7 +70,7 @@ void registerObjects(sofa::core::ObjectFactory* factory)
registerTetrahedronCollisionModel(factory);
registerTriangleCollisionModel(factory);
registerTriangleModelInRegularGrid(factory);
registerTriangleOctreeModel(factory);
registerTriangleOctreeCollisionModel(factory);
}

void init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ void GenericConstraintCorrection::removeConstraintSolver(ConstraintSolver *s)
constraintsolvers.remove(s);
}

void GenericConstraintCorrection::rebuildSystem(SReal massFactor, SReal forceFactor)
{
}

void GenericConstraintCorrection::addComplianceInConstraintSpace(const ConstraintParams *cparams, BaseMatrix* W)
{
if (!l_ODESolver.get()) return;
Expand Down Expand Up @@ -229,12 +225,6 @@ void GenericConstraintCorrection::applyContactForce(const BaseVector *f)
applyMotionCorrection(&cparams, core::vec_id::write_access::position, core::vec_id::write_access::velocity, dx, force);
}

void GenericConstraintCorrection::computeResidual(const ExecParams* params, linearalgebra::BaseVector *lambda)
{
l_linearSolver.get()->computeResidual(params, lambda);
}


void GenericConstraintCorrection::getComplianceMatrix(linearalgebra::BaseMatrix* Minv) const
{
if (!l_ODESolver.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,10 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API GenericConstraintCorre

void applyPredictiveConstraintForce(const core::ConstraintParams *cparams, core::MultiVecDerivId f, const linearalgebra::BaseVector *lambda) override;

void rebuildSystem(SReal massFactor, SReal forceFactor) override;

void applyContactForce(const linearalgebra::BaseVector *f) override;

void resetContactForce() override;

void computeResidual(const core::ExecParams* params, linearalgebra::BaseVector *lambda) override;

SingleLink<GenericConstraintCorrection, sofa::core::behavior::LinearSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_linearSolver; ///< Link towards the linear solver used to compute the compliance matrix, requiring the inverse of the linear system matrix
SingleLink<GenericConstraintCorrection, sofa::core::behavior::OdeSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_ODESolver; ///< Link towards the ODE solver used to recover the integration factors
Data< SReal > d_complianceFactor; ///< Factor applied to the position factor and velocity factor used to calculate compliance matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ class LinearSolverConstraintCorrection : public sofa::core::behavior::Constraint

void applyVelocityCorrection(const sofa::core::ConstraintParams *cparams, Data< VecDeriv>& v, Data< VecDeriv>& dv, const Data< VecDeriv >& f) override;

void rebuildSystem(SReal massFactor, SReal forceFactor) override;


/// @name Deprecated API
/// @{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,6 @@ void LinearSolverConstraintCorrection<DataTypes>::addComplianceInConstraintSpace
addRegularization(W);
}


template<class DataTypes>
void LinearSolverConstraintCorrection<DataTypes>::rebuildSystem(SReal massFactor, SReal forceFactor)
{
SOFA_UNUSED(massFactor);
SOFA_UNUSED(forceFactor);
}

template<class DataTypes>
void LinearSolverConstraintCorrection<DataTypes>::getComplianceMatrix(linearalgebra::BaseMatrix* Minv) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,6 @@ bool GenericConstraintSolver::buildSystem(const core::ConstraintParams *cParams,
return true;
}


void GenericConstraintSolver::rebuildSystem(const SReal massFactor, const SReal forceFactor)
{
for (const auto& cc : l_constraintCorrections)
{
if (cc->isActive())
{
cc->rebuildSystem(massFactor, forceFactor);
}
}
}

void printLCP(std::ostream& file, SReal *q, SReal **M, SReal *f, int dim, bool printMatrix = true)
{
file.precision(9);
Expand Down Expand Up @@ -299,14 +287,6 @@ bool GenericConstraintSolver::solveSystem(const core::ConstraintParams * /*cPara
return true;
}

void GenericConstraintSolver::computeResidual(const core::ExecParams* eparam)
{
for (const auto& cc : l_constraintCorrections)
{
cc->computeResidual(eparam,&current_cp->f);
}
}

sofa::type::vector<core::behavior::BaseConstraintCorrection*> GenericConstraintSolver::filteredConstraintCorrections() const
{
sofa::type::vector<core::behavior::BaseConstraintCorrection*> filteredConstraintCorrections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API GenericConstraintSolver :

bool prepareStates(const core::ConstraintParams * /*cParams*/, MultiVecId res1, MultiVecId res2=MultiVecId::null()) override;
bool buildSystem(const core::ConstraintParams * /*cParams*/, MultiVecId res1, MultiVecId res2=MultiVecId::null()) override;
void rebuildSystem(const SReal massFactor, const SReal forceFactor) override;
bool solveSystem(const core::ConstraintParams * /*cParams*/, MultiVecId res1, MultiVecId res2=MultiVecId::null()) override;
bool applyCorrection(const core::ConstraintParams * /*cParams*/, MultiVecId res1, MultiVecId res2=MultiVecId::null()) override;
void computeResidual(const core::ExecParams* /*params*/) override;
ConstraintProblem* getConstraintProblem() override;
void lockConstraintProblem(sofa::core::objectmodel::BaseObject* from, ConstraintProblem* p1, ConstraintProblem* p2 = nullptr) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ void MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManage
{
}

template<>
void MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManager>::computeResidual(const core::ExecParams* /*params*/,linearalgebra::BaseVector* /*f*/) {
//todo
}

template<>
GraphScatteredVector* MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManager>::createPersistentVector()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ class MatrixLinearSolver<Matrix,Vector,NoThreadManager> : public BaseMatrixLinea
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_DEPRECATED_ASSEMBLY_API()
Vector* getSystemRHVector() { return l_linearSystem ? l_linearSystem->getRHSVector() : nullptr; }
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DISABLED_ASSEMBLY_API()
Vector* getSystemRHVector() = delete;

/// Get the linear system left-hand term vector, or nullptr if this solver does not build it
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DEPRECATED_ASSEMBLY_API()
Vector* getSystemLHVector() { return l_linearSystem ? l_linearSystem->getSolutionVector() : nullptr; }
SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DISABLED_ASSEMBLY_API()
Vector* getSystemLHVector() = delete;

/// Returns the linear system component associated to the linear solver
sofa::component::linearsystem::TypedMatrixLinearSystem<Matrix, Vector>* getLinearSystem() const override { return l_linearSystem.get(); }
Expand Down Expand Up @@ -246,8 +246,6 @@ class MatrixLinearSolver<Matrix,Vector,NoThreadManager> : public BaseMatrixLinea

void applyConstraintForce(const sofa::core::ConstraintParams* cparams, sofa::core::MultiVecDerivId dx, const linearalgebra::BaseVector* f) override;

void computeResidual(const core::ExecParams* params, linearalgebra::BaseVector* f) override;

///< Parallelize the computation of the product J*M^{-1}*J^T where M is the
///< matrix of the linear system and J is any matrix with compatible dimensions
Data<bool> d_parallelInverseProduct;
Expand Down Expand Up @@ -370,9 +368,6 @@ GraphScatteredVector* MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVect
template<> SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API
void MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManager>::applyConstraintForce(const sofa::core::ConstraintParams* /*cparams*/, sofa::core::MultiVecDerivId /*dx*/, const linearalgebra::BaseVector* /*f*/);

template<> SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API
void MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManager>::computeResidual(const core::ExecParams* params,linearalgebra::BaseVector* f);

template<> SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API
void MatrixLinearSolver<GraphScatteredMatrix,GraphScatteredVector,NoThreadManager>::checkLinearSystem();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,23 +506,4 @@ void MatrixLinearSolver<Matrix,Vector>::applyConstraintForce(const sofa::core::C
l_linearSystem->dispatchSystemRHS(cparams->lambda());
}

template<class Matrix, class Vector>
void MatrixLinearSolver<Matrix,Vector>::computeResidual(const core::ExecParams* params,linearalgebra::BaseVector* f)
{
auto* rhsVector = l_linearSystem->getRHSVector();
rhsVector->clear();
rhsVector->resize(l_linearSystem->getSystemBaseMatrix()->colSize());

/// rhs = J^t * f
internalData.projectForceInConstraintSpace(rhsVector, f);

sofa::simulation::common::VectorOperations vop( params, this->getContext() );
sofa::core::behavior::MultiVecDeriv force(&vop, core::vec_id::write_access::force );

// force += rhs
executeVisitor( MechanicalMultiVectorPeqBaseVectorVisitor(core::execparams::defaultInstance(), force, rhsVector, nullptr) );
}



} // namespace sofa::component::linearsolver
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ namespace sofa::component::linearsolver::iterative
} // namespace sofa::component::linearsolver::iterative

#ifdef SOFA_BUILD_SOFA_COMPONENT_LINEARSOLVER_ITERATIVE
#define SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DEPRECATED_ASSEMBLY_API()
#define SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DISABLED_ASSEMBLY_API()
#else
#define SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DEPRECATED_ASSEMBLY_API() \
SOFA_ATTRIBUTE_DEPRECATED("v25.12", "v26.06", "The assembly of the linear system is no longer the responsibility of the solver. Instead, a linear system component lives along with the linear solver. This component is in charge of the assembly.")
#define SOFA_ITERATIVE_SOLVER_ATTRIBUTE_DISABLED_ASSEMBLY_API() \
SOFA_ATTRIBUTE_DISABLED("v25.12", "v26.06", "The assembly of the linear system is no longer the responsibility of the solver. Instead, a linear system component lives along with the linear solver. This component is in charge of the assembly.")
#endif

#ifdef SOFA_BUILD_SOFA_COMPONENT_LINEARSOLVER_ITERATIVE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class WarpPreconditioner : public sofa::component::linearsolver::MatrixLinearSol

bool addMInvJt(linearalgebra::BaseMatrix* result, linearalgebra::BaseMatrix* J, SReal fact) override;

void computeResidual(const core::ExecParams* params, linearalgebra::BaseVector* /*f*/) override;

protected:

void checkLinearSystem() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,4 @@ bool WarpPreconditioner<TMatrix,TVector,ThreadManager >::addMInvJt(linearalgebra
return l_linearSolver->addMInvJt(result,&j_local,fact);
}

template<class TMatrix, class TVector,class ThreadManager>
void WarpPreconditioner<TMatrix,TVector,ThreadManager >::computeResidual(const core::ExecParams* params, linearalgebra::BaseVector* f)
{
l_linearSolver->computeResidual(params,f);
}

} // namespace sofa::component::linearsolver::preconditioner
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,6 @@ void OglColorMap::reinit()
m_colorMap.reinit();
}

OglColorMap* OglColorMap::getDefault()
{
static OglColorMap::SPtr defaultOglColorMap;
if (defaultOglColorMap == nullptr)
{
defaultOglColorMap = sofa::core::objectmodel::New<OglColorMap>();
defaultOglColorMap->init();
}
return defaultOglColorMap.get();
}

void OglColorMap::deleteTexture()
{
if (texture != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class SOFA_GL_COMPONENT_RENDERING2D_API OglColorMap : public sofa::core::visual:
return m_colorMap.getColor(i);
}

SOFA_ATTRIBUTE_DEPRECATED__OGLCOLORMAPGETDEFAULT()
static OglColorMap* getDefault();
SOFA_ATTRIBUTE_DISABLED__OGLCOLORMAPGETDEFAULT()
static OglColorMap* getDefault() = delete;

template<class Real>
helper::ColorMap::evaluator<Real> getEvaluator(Real vmin, Real vmax)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace sofa::gl::component::rendering2d
} // namespace sofa::gl::component::rendering2d

#ifdef SOFA_BUILD_SOFA_GL_COMPONENT_RENDERING2D
#define SOFA_ATTRIBUTE_DEPRECATED__OGLCOLORMAPGETDEFAULT()
#define SOFA_ATTRIBUTE_DISABLED__OGLCOLORMAPGETDEFAULT()
#else
#define SOFA_ATTRIBUTE_DEPRECATED__OGLCOLORMAPGETDEFAULT() \
SOFA_ATTRIBUTE_DEPRECATED("v25.12", "v26.06", "")
#define SOFA_ATTRIBUTE_DISABLED__OGLCOLORMAPGETDEFAULT() \
SOFA_ATTRIBUTE_DISABLED("v25.12", "v26.06", "")
#endif
Loading
Loading