diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/AsyncSparseLDLSolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/AsyncSparseLDLSolver.cpp index 151e45250eb..5049fba0152 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/AsyncSparseLDLSolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/AsyncSparseLDLSolver.cpp @@ -30,10 +30,12 @@ namespace sofa::component::linearsolver::direct using linearalgebra::CompressedRowSparseMatrix; using linearalgebra::FullVector; -int AsyncSparseLDLSolverClass = core::RegisterObject("Asynchronous direct Linear Solver using a Sparse LDL^T factorization.") - .add< AsyncSparseLDLSolver< CompressedRowSparseMatrix , FullVector > >(true) - .add< AsyncSparseLDLSolver< CompressedRowSparseMatrix >, FullVector > >() -; +void registerAsyncSparseLDLSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Asynchronous direct Linear Solver using a Sparse LDL^T factorization.") + .add< AsyncSparseLDLSolver< CompressedRowSparseMatrix, FullVector > >(true) + .add< AsyncSparseLDLSolver< CompressedRowSparseMatrix >, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API AsyncSparseLDLSolver< CompressedRowSparseMatrix ,FullVector >; template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API AsyncSparseLDLSolver< CompressedRowSparseMatrix< type::Mat<3,3,SReal> >,FullVector >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/BTDLinearSolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/BTDLinearSolver.cpp index 1aa29fd88ad..0eadbac996e 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/BTDLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/BTDLinearSolver.cpp @@ -31,9 +31,12 @@ namespace sofa::component::linearsolver::direct { -int BTDLinearSolverClass = core::RegisterObject("Linear system solver using Thomas Algorithm for Block Tridiagonal matrices") - .add< BTDLinearSolver, linearalgebra::BlockVector<6, SReal> > >(true) -; + +void registerBTDLinearSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver using Thomas Algorithm for Block Tridiagonal matrices.") + .add< BTDLinearSolver, linearalgebra::BlockVector<6, SReal> > >(true)); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API BTDLinearSolver< linearalgebra::BTDMatrix<6, SReal>, linearalgebra::BlockVector<6, SReal> >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/CholeskySolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/CholeskySolver.cpp index f4a9417e8a6..c887c85f5a5 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/CholeskySolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/CholeskySolver.cpp @@ -30,9 +30,12 @@ namespace sofa::component::linearsolver::direct using namespace sofa::defaulttype; using namespace sofa::linearalgebra; -int CholeskySolverClass = core::RegisterObject("Direct linear solver based on Cholesky factorization, for dense matrices") +void registerCholeskySolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct linear solver based on Cholesky factorization, for dense matrices.") .add< CholeskySolver< SparseMatrix, FullVector > >(true) - .add< CholeskySolver< FullMatrix, FullVector > >(); + .add< CholeskySolver< FullMatrix, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API CholeskySolver< SparseMatrix, FullVector >; template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API CholeskySolver< FullMatrix, FullVector >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLDLT.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLDLT.cpp index 92452e1cba8..6d55e0978ef 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLDLT.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLDLT.cpp @@ -30,9 +30,11 @@ namespace sofa::component::linearsolver::direct template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLDLT< SReal >; template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLDLT< sofa::type::Mat<3,3,SReal> >; -int EigenSimplicialLDLTCRSClass = sofa::core::RegisterObject("Direct Linear Solver using a Sparse LDL^T factorization.") -.add< EigenSimplicialLDLT< SReal > >() -.add< EigenSimplicialLDLT< sofa::type::Mat<3,3,SReal> > >() -; +void registerEigenSimplicialLDLT(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct Linear Solver using a Sparse LDL^T factorization.") + .add< EigenSimplicialLDLT< SReal > >() + .add< EigenSimplicialLDLT< sofa::type::Mat<3, 3, SReal> > >()); +} } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLLT.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLLT.cpp index 260bf66c3c4..bc70b31eeef 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLLT.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSimplicialLLT.cpp @@ -27,12 +27,15 @@ namespace sofa::component::linearsolver::direct { - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLLT< SReal >; - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLLT< sofa::type::Mat<3,3,SReal> >; - int EigenSimplicialLLTCRSClass = sofa::core::RegisterObject("Direct Linear Solver using a Sparse LL^T factorization.") - .add< EigenSimplicialLLT< SReal > >() - .add< EigenSimplicialLLT< sofa::type::Mat<3,3,SReal> > >() - ; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLLT< SReal >; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSimplicialLLT< sofa::type::Mat<3,3,SReal> >; + +void registerEigenSimplicialLLT(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct Linear Solver using a Sparse LL^T factorization.") + .add< EigenSimplicialLLT< SReal > >() + .add< EigenSimplicialLLT< sofa::type::Mat<3, 3, SReal> > >()); +} } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseLU.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseLU.cpp index 3c31eb127ae..50dd336a6af 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseLU.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseLU.cpp @@ -27,12 +27,15 @@ namespace sofa::component::linearsolver::direct { - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseLU< SReal >; - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseLU< sofa::type::Mat<3,3,SReal> >; - int EigenSparseLUCRSClass = sofa::core::RegisterObject("Direct Linear Solver using a Sparse LU factorization.") - .add< EigenSparseLU< SReal > >() - .add< EigenSparseLU< sofa::type::Mat<3,3,SReal> > >() - ; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseLU< SReal >; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseLU< sofa::type::Mat<3,3,SReal> >; + +void registerEigenSparseLU(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct Linear Solver using a Sparse LU factorization.") + .add< EigenSparseLU< SReal > >() + .add< EigenSparseLU< sofa::type::Mat<3, 3, SReal> > >()); +} } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseQR.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseQR.cpp index 790246c146c..3b7040affd6 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseQR.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/EigenSparseQR.cpp @@ -27,12 +27,15 @@ namespace sofa::component::linearsolver::direct { - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseQR< SReal >; - template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseQR< sofa::type::Mat<3,3,SReal>>; - int EigenSparseQRCRSClass = sofa::core::RegisterObject("Direct Linear Solver using a Sparse QR factorization.") - .add< EigenSparseQR< SReal > >() - .add< EigenSparseQR< sofa::type::Mat<3,3,SReal> > >() - ; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseQR< SReal >; +template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API EigenSparseQR< sofa::type::Mat<3,3,SReal>>; + +void registerEigenSparseQR(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct Linear Solver using a Sparse QR factorization.") + .add< EigenSparseQR< SReal > >() + .add< EigenSparseQR< sofa::type::Mat<3, 3, SReal> > >()); +} } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/MatrixLinearSystem[BTDMatrix].cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/MatrixLinearSystem[BTDMatrix].cpp index 2bfd60b26d1..0ac05098281 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/MatrixLinearSystem[BTDMatrix].cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/MatrixLinearSystem[BTDMatrix].cpp @@ -27,10 +27,13 @@ namespace sofa::component::linearsystem { + template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API MatrixLinearSystem< linearalgebra::BTDMatrix<6, SReal>, linearalgebra::BlockVector<6, SReal> >; -int AssemblingMatrixLinearSystemBTDClass = core::RegisterObject("Linear system") -.add, linearalgebra::BlockVector<6, SReal> > >(); -; +void registerMatrixLinearSystemBTDMatrix(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system.") + .add, linearalgebra::BlockVector<6, SReal> > >()); +} } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/PrecomputedLinearSolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/PrecomputedLinearSolver.cpp index ce9235152f0..4c49fa0d738 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/PrecomputedLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/PrecomputedLinearSolver.cpp @@ -28,9 +28,11 @@ namespace sofa::component::linearsolver::direct using namespace sofa::linearalgebra; -int PrecomputedLinearSolverClass = core::RegisterObject("Linear system solver based on a precomputed inverse matrix") - .add< PrecomputedLinearSolver< CompressedRowSparseMatrix , FullVector > >() - ; +void registerPrecomputedLinearSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver based on a precomputed inverse matrix") + .add< PrecomputedLinearSolver< CompressedRowSparseMatrix, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API PrecomputedLinearSolver< CompressedRowSparseMatrix , FullVector >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SVDLinearSolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SVDLinearSolver.cpp index c1b513a292d..6b42d529ef6 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SVDLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SVDLinearSolver.cpp @@ -32,13 +32,13 @@ namespace sofa::component::linearsolver::direct using namespace sofa::linearalgebra; -int SVDLinearSolverClass = core::RegisterObject("Linear system solver using a SVD decomposition of a dense matrix") +void registerSVDLinearSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver using a SVD decomposition of a dense matrix.") .add< SVDLinearSolver< FullMatrix, FullVector > >() .add< SVDLinearSolver< CompressedRowSparseMatrix, FullVector > >() - .add< SVDLinearSolver< CompressedRowSparseMatrix>, FullVector > >() - .addAlias("SVDLinear") - .addAlias("SVD") - ; + .add< SVDLinearSolver< CompressedRowSparseMatrix>, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API SVDLinearSolver< FullMatrix, FullVector >; template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API SVDLinearSolver< CompressedRowSparseMatrix, FullVector >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SparseLDLSolver.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SparseLDLSolver.cpp index 432fce75598..09b9bb1442d 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SparseLDLSolver.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/SparseLDLSolver.cpp @@ -29,11 +29,12 @@ namespace sofa::component::linearsolver::direct using namespace sofa::linearalgebra; -int SparseLDLSolverClass = core::RegisterObject("Direct Linear Solver using a Sparse LDL^T factorization.") - .add< SparseLDLSolver< CompressedRowSparseMatrix,FullVector > >(true) - .add< SparseLDLSolver< CompressedRowSparseMatrix >,FullVector > >() - -; +void registerSparseLDLSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Direct Linear Solver using a Sparse LDL^T factorization.") + .add< SparseLDLSolver< CompressedRowSparseMatrix, FullVector > >(true) + .add< SparseLDLSolver< CompressedRowSparseMatrix >, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API SparseLDLSolver< CompressedRowSparseMatrix,FullVector >; template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API SparseLDLSolver< CompressedRowSparseMatrix< type::Mat<3,3,SReal> >,FullVector >; diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/TypedMatrixLinearSystem[BTDMatrix].cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/TypedMatrixLinearSystem[BTDMatrix].cpp index 83593d78d59..c64bbe97a22 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/TypedMatrixLinearSystem[BTDMatrix].cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/TypedMatrixLinearSystem[BTDMatrix].cpp @@ -23,7 +23,16 @@ #include #include +#include + namespace sofa::component::linearsystem { template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API TypedMatrixLinearSystem< linearalgebra::BTDMatrix<6, SReal>, linearalgebra::BlockVector<6, SReal> >; + +void registerTypedMatrixLinearSystemBTDMatrix(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system.") + .add, linearalgebra::BlockVector<6, SReal> > >()); +} + } diff --git a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/init.cpp b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/init.cpp index c2cb8734ee2..2515edac27b 100644 --- a/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/init.cpp +++ b/Sofa/Component/LinearSolver/Direct/src/sofa/component/linearsolver/direct/init.cpp @@ -22,13 +22,33 @@ #include #include #include +#include + +namespace sofa::component::linearsystem +{ + extern void registerMatrixLinearSystemBTDMatrix(sofa::core::ObjectFactory* factory); + extern void registerTypedMatrixLinearSystemBTDMatrix(sofa::core::ObjectFactory* factory); +} + namespace sofa::component::linearsolver::direct { - + +extern void registerAsyncSparseLDLSolver(sofa::core::ObjectFactory* factory); +extern void registerBTDLinearSolver(sofa::core::ObjectFactory* factory); +extern void registerCholeskySolver(sofa::core::ObjectFactory* factory); +extern void registerEigenSimplicialLDLT(sofa::core::ObjectFactory* factory); +extern void registerEigenSimplicialLLT(sofa::core::ObjectFactory* factory); +extern void registerEigenSparseLU(sofa::core::ObjectFactory* factory); +extern void registerEigenSparseQR(sofa::core::ObjectFactory* factory); +extern void registerPrecomputedLinearSolver(sofa::core::ObjectFactory* factory); +extern void registerSparseLDLSolver(sofa::core::ObjectFactory* factory); +extern void registerSVDLinearSolver(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -63,11 +83,30 @@ void registerOrderingMethods() registerOrderingMethods(); } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerAsyncSparseLDLSolver(factory); + registerBTDLinearSolver(factory); + registerCholeskySolver(factory); + registerEigenSimplicialLDLT(factory); + registerEigenSimplicialLLT(factory); + registerEigenSparseLU(factory); + registerEigenSparseQR(factory); + linearsystem::registerMatrixLinearSystemBTDMatrix(factory); + registerPrecomputedLinearSolver(factory); + registerSparseLDLSolver(factory); + registerSVDLinearSolver(factory); + linearsystem::registerTypedMatrixLinearSystemBTDMatrix(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + registerOrderingMethods(); registerOrderingMethods(); diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/CGLinearSolver.cpp b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/CGLinearSolver.cpp index d37ba06bb40..c7fc473754e 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/CGLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/CGLinearSolver.cpp @@ -64,20 +64,19 @@ inline void CGLinearSolverregisterObjects(core::ObjectRegistrationData("Linear system solver using the conjugate gradient iterative algorithm") .add< CGLinearSolver< GraphScatteredMatrix, GraphScatteredVector > >(true) .add< CGLinearSolver< FullMatrix, FullVector > >() .add< CGLinearSolver< SparseMatrix, FullVector > >() .add< CGLinearSolver< CompressedRowSparseMatrix, FullVector > >() - .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - - .addAlias("CGSolver") - .addAlias("ConjugateGradient") - ; + .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< CGLinearSolver< CompressedRowSparseMatrix >, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API CGLinearSolver< GraphScatteredMatrix, GraphScatteredVector >; template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API CGLinearSolver< FullMatrix, FullVector >; diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixFreeSystem[GraphScattered].cpp b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixFreeSystem[GraphScattered].cpp index 0c515378227..05947ee87d3 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixFreeSystem[GraphScattered].cpp +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixFreeSystem[GraphScattered].cpp @@ -25,12 +25,16 @@ namespace sofa::component::linearsystem { - using sofa::component::linearsolver::GraphScatteredMatrix; - using sofa::component::linearsolver::GraphScatteredVector; - template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API MatrixFreeSystem; +using sofa::component::linearsolver::GraphScatteredMatrix; +using sofa::component::linearsolver::GraphScatteredVector; - int MatrixFreeSystemClass = core::RegisterObject("Matrix-free linear system") - .add< MatrixFreeSystem >(); +template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API MatrixFreeSystem; + +void registerMatrixFreeSystemGraphScattered(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Matrix-free linear system.") + .add< MatrixFreeSystem >()); +} } //namespace sofa::component::linearsystem diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MinResLinearSolver.cpp b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MinResLinearSolver.cpp index 3461baeca09..8c967538b4a 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MinResLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MinResLinearSolver.cpp @@ -31,21 +31,19 @@ using namespace sofa::type; using namespace sofa::defaulttype; using namespace sofa::linearalgebra; - -int MinResLinearSolverClass = core::RegisterObject("Linear system solver using the MINRES iterative algorithm") +void registerMinResLinearSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver using the MINRES iterative algorithm.") .add< MinResLinearSolver< GraphScatteredMatrix, GraphScatteredVector > >(true) .add< MinResLinearSolver< FullMatrix, FullVector > >() .add< MinResLinearSolver< SparseMatrix, FullVector > >() .add< MinResLinearSolver< CompressedRowSparseMatrix, FullVector > >() - .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() - - .addAlias("MINRESSolver") - .addAlias("MinResSolver") - ; + .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >() + .add< MinResLinearSolver< CompressedRowSparseMatrix >, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API MinResLinearSolver< GraphScatteredMatrix, GraphScatteredVector >; template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API MinResLinearSolver< FullMatrix, FullVector >; diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/ShewchukPCGLinearSolver.cpp b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/ShewchukPCGLinearSolver.cpp index 31a37f1962c..5cd240c90db 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/ShewchukPCGLinearSolver.cpp +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/ShewchukPCGLinearSolver.cpp @@ -28,9 +28,11 @@ namespace sofa::component::linearsolver::iterative { -int ShewchukPCGLinearSolverClass = core::RegisterObject("Linear system solver using the conjugate gradient iterative algorithm") - .add< ShewchukPCGLinearSolver >(true) - .addAlias("PCGLinearSolver"); +void registerShewchukPCGLinearSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver using the Shewchuk conjugate gradient iterative algorithm.") + .add< ShewchukPCGLinearSolver >()); +} template class SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API ShewchukPCGLinearSolver; diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/init.cpp b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/init.cpp index c64c072b575..c29da966335 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/init.cpp +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/init.cpp @@ -21,13 +21,25 @@ ******************************************************************************/ #include #include +#include + +namespace sofa::component::linearsystem +{ + extern void registerMatrixFreeSystemGraphScattered(sofa::core::ObjectFactory* factory); +} + namespace sofa::component::linearsolver::iterative { - + +extern void registerCGLinearSolver(sofa::core::ObjectFactory* factory); +extern void registerMinResLinearSolver(sofa::core::ObjectFactory* factory); +extern void registerShewchukPCGLinearSolver(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +57,22 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerCGLinearSolver(factory); + linearsystem::registerMatrixFreeSystemGraphScattered(factory); + registerMinResLinearSolver(factory); + registerShewchukPCGLinearSolver(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/AMDOrderingMethod.cpp b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/AMDOrderingMethod.cpp index f64521895c8..9cc53bc6c49 100644 --- a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/AMDOrderingMethod.cpp +++ b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/AMDOrderingMethod.cpp @@ -25,8 +25,11 @@ namespace sofa::component::linearsolver::ordering { -int AMDOrderingMethodClass = sofa::core::RegisterObject("Approximate minimum degree ordering implemented in the Eigen library") - .add(); +void registerAMDOrderingMethod(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Approximate minimum degree ordering implemented in the Eigen library.") + .add()); +} std::string AMDOrderingMethod::methodName() const { diff --git a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/COLAMDOrderingMethod.cpp b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/COLAMDOrderingMethod.cpp index 3ee7670ffbf..7c8080f97ef 100644 --- a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/COLAMDOrderingMethod.cpp +++ b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/COLAMDOrderingMethod.cpp @@ -25,8 +25,11 @@ namespace sofa::component::linearsolver::ordering { -int COLAMDOrderingMethodClass = sofa::core::RegisterObject("Column approximate minimum degree ordering implemented in the Eigen library") - .add(); +void registerCOLAMDOrderingMethod(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Column approximate minimum degree ordering implemented in the Eigen library.") + .add()); +} std::string COLAMDOrderingMethod::methodName() const { diff --git a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/NaturalOrderingMethod.cpp b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/NaturalOrderingMethod.cpp index 95fbaaac862..e618bbc7a10 100644 --- a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/NaturalOrderingMethod.cpp +++ b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/NaturalOrderingMethod.cpp @@ -42,7 +42,10 @@ void NaturalOrderingMethod::computePermutation( } } -int NaturalOrderingMethodClass = core::RegisterObject("Natural order (no permutation). Corresponding to an identity matrix.") - .add(); +void registerNaturalOrderingMethod(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Natural order (no permutation). Corresponding to an identity matrix.") + .add()); +} } diff --git a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/init.cpp b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/init.cpp index 63dd35a4118..9df8a85c25c 100644 --- a/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/init.cpp +++ b/Sofa/Component/LinearSolver/Ordering/src/sofa/component/linearsolver/ordering/init.cpp @@ -21,13 +21,20 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::linearsolver::ordering { +extern void registerAMDOrderingMethod(sofa::core::ObjectFactory* factory); +extern void registerCOLAMDOrderingMethod(sofa::core::ObjectFactory* factory); +extern void registerNaturalOrderingMethod(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +52,21 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerAMDOrderingMethod(factory); + registerCOLAMDOrderingMethod(factory); + registerNaturalOrderingMethod(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/BlockJacobiPreconditioner.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/BlockJacobiPreconditioner.cpp index 0b1d8c1de4b..84c98e82376 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/BlockJacobiPreconditioner.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/BlockJacobiPreconditioner.cpp @@ -27,8 +27,11 @@ namespace sofa::component::linearsolver::preconditioner using namespace sofa::linearalgebra; -int BlockJacobiPreconditionerClass = core::RegisterObject("Linear solver based on a NxN block diagonal matrix (i.e. block Jacobi preconditioner)") - .add< BlockJacobiPreconditioner ,FullVector > >(); +void registerBlockJacobiPreconditioner(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear solver based on a NxN block diagonal matrix (i.e. block Jacobi preconditioner).") + .add< BlockJacobiPreconditioner, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API BlockJacobiPreconditioner, FullVector >; diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/JacobiPreconditioner.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/JacobiPreconditioner.cpp index ddc5ae29adc..162a3dfd877 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/JacobiPreconditioner.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/JacobiPreconditioner.cpp @@ -28,11 +28,11 @@ namespace sofa::component::linearsolver::preconditioner using namespace sofa::linearalgebra; -int JacobiPreconditionerClass = core::RegisterObject("Linear solver based on a diagonal matrix (i.e. Jacobi preconditioner)") - .add< JacobiPreconditioner, FullVector > >(true) - .addAlias("JacobiLinearSolver") - .addAlias("JacobiSolver") - ; +void registerJacobiPreconditioner(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear solver based on a diagonal matrix (i.e. Jacobi preconditioner).") + .add< JacobiPreconditioner, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API JacobiPreconditioner, FullVector >; diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedMatrixSystem.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedMatrixSystem.cpp index 3d43ff07361..b8a3eb1b01f 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedMatrixSystem.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedMatrixSystem.cpp @@ -1,14 +1,41 @@ -#include +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include #include #include #include namespace sofa::component::linearsolver::preconditioner { - using sofa::linearalgebra::CompressedRowSparseMatrix; - using sofa::linearalgebra::FullVector; - template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API PrecomputedMatrixSystem< linearalgebra::CompressedRowSparseMatrix, FullVector >; - int PrecomputedMatrixSystemClass = core::RegisterObject("Matrix system") - .add, FullVector > >(true); +using sofa::linearalgebra::CompressedRowSparseMatrix; +using sofa::linearalgebra::FullVector; + +template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API PrecomputedMatrixSystem< linearalgebra::CompressedRowSparseMatrix, FullVector >; + +void registerPrecomputedMatrixSystem(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Matrix system.") + .add, FullVector > >()); +} + } diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedWarpPreconditioner.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedWarpPreconditioner.cpp index 483b4b65747..897f854328d 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedWarpPreconditioner.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/PrecomputedWarpPreconditioner.cpp @@ -25,9 +25,11 @@ namespace sofa::component::linearsolver::preconditioner { -int PrecomputedWarpPreconditionerClass = core::RegisterObject("Linear system solver based on a precomputed inverse matrix, wrapped by a per-node rotation matrix") - .add< PrecomputedWarpPreconditioner< defaulttype::Vec3Types > >() - ; +void registerPrecomputedWarpPreconditioner(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver based on a precomputed inverse matrix, wrapped by a per-node rotation matrix.") + .add< PrecomputedWarpPreconditioner< defaulttype::Vec3Types > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API PrecomputedWarpPreconditioner< defaulttype::Vec3Types >; diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/RotationMatrixSystem.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/RotationMatrixSystem.cpp index 6b5f16142cd..ffa1961911f 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/RotationMatrixSystem.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/RotationMatrixSystem.cpp @@ -1,14 +1,40 @@ -#include +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include #include #include #include namespace sofa::component::linearsolver::preconditioner { - using sofa::linearalgebra::RotationMatrix; - using sofa::linearalgebra::FullVector; - template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API RotationMatrixSystem< RotationMatrix, FullVector >; +using sofa::linearalgebra::RotationMatrix; +using sofa::linearalgebra::FullVector; + +template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API RotationMatrixSystem< RotationMatrix, FullVector >; + +void registerRotationMatrixSystem(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Rotation matrix warpping the main linear system.") + .add, FullVector > >()); +} - int RotationMatrixSystemClass = core::RegisterObject("Rotation matrix warpping the main linear system") - .add, FullVector > >(true); } diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/SSORPreconditioner.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/SSORPreconditioner.cpp index 426ce65735e..a4e249d56f0 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/SSORPreconditioner.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/SSORPreconditioner.cpp @@ -170,12 +170,12 @@ void SSORPreconditioner< linearalgebra::CompressedRowSparseMatrix< type::Mat<3,3 } } -int SSORPreconditionerClass = core::RegisterObject("Linear system solver / preconditioner based on Symmetric Successive Over-Relaxation (SSOR). If the matrix is decomposed as $A = D + L + L^T$, this solver computes $(1/(2-w))(D/w+L)(D/w)^{-1}(D/w+L)^T x = b, or $(D+L)D^{-1}(D+L)^T x = b$ if $w=1$.") +void registerSSORPreconditioner(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver / preconditioner based on Symmetric Successive Over-Relaxation (SSOR). If the matrix is decomposed as $A = D + L + L^T$, this solver computes $(1/(2-w))(D/w+L)(D/w)^{-1}(D/w+L)^T x = b, or $(D+L)D^{-1}(D+L)^T x = b$ if $w=1$.") .add< SSORPreconditioner< CompressedRowSparseMatrix, FullVector > >(true) - .add< SSORPreconditioner< CompressedRowSparseMatrix< type::Mat<3,3,SReal> >, FullVector > >() - .addAlias("SSORLinearSolver") - .addAlias("SSORSolver") - ; + .add< SSORPreconditioner< CompressedRowSparseMatrix< type::Mat<3, 3, SReal> >, FullVector > >()); +} template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API SSORPreconditioner< linearalgebra::CompressedRowSparseMatrix, linearalgebra::FullVector >; template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API SSORPreconditioner< linearalgebra::CompressedRowSparseMatrix< type::Mat<3, 3, SReal> >, linearalgebra::FullVector >; diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/WarpPreconditioner.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/WarpPreconditioner.cpp index 84419ada4d6..ae1ccc31644 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/WarpPreconditioner.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/WarpPreconditioner.cpp @@ -31,10 +31,12 @@ namespace sofa::component::linearsolver::preconditioner using namespace sofa::linearalgebra; -int WarpPreconditionerClass = core::RegisterObject("Linear system solver wrapping another (precomputed) linear solver by a per-node rotation matrix") - .add< WarpPreconditioner< RotationMatrix, FullVector, NoThreadManager > >() -; -template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API WarpPreconditioner< RotationMatrix, FullVector, NoThreadManager >; +void registerWarpPreconditioner(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Linear system solver wrapping another (precomputed) linear solver by a per-node rotation matrix.") + .add< WarpPreconditioner< RotationMatrix, FullVector, NoThreadManager > >()); +} +template class SOFA_COMPONENT_LINEARSOLVER_PRECONDITIONER_API WarpPreconditioner< RotationMatrix, FullVector, NoThreadManager >; } // namespace sofa::component::linearsolver::preconditioner diff --git a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/init.cpp b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/init.cpp index b135b8700dc..38a7944ee1d 100644 --- a/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/init.cpp +++ b/Sofa/Component/LinearSolver/Preconditioner/src/sofa/component/linearsolver/preconditioner/init.cpp @@ -21,13 +21,24 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::linearsolver::preconditioner { - + +extern void registerBlockJacobiPreconditioner(sofa::core::ObjectFactory* factory); +extern void registerJacobiPreconditioner(sofa::core::ObjectFactory* factory); +extern void registerPrecomputedMatrixSystem(sofa::core::ObjectFactory* factory); +extern void registerPrecomputedWarpPreconditioner(sofa::core::ObjectFactory* factory); +extern void registerRotationMatrixSystem(sofa::core::ObjectFactory* factory); +extern void registerSSORPreconditioner(sofa::core::ObjectFactory* factory); +extern void registerWarpPreconditioner(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +56,25 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerBlockJacobiPreconditioner(factory); + registerJacobiPreconditioner(factory); + registerPrecomputedMatrixSystem(factory); + registerPrecomputedWarpPreconditioner(factory); + registerRotationMatrixSystem(factory); + registerSSORPreconditioner(factory); + registerWarpPreconditioner(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/LinearSolver/src/sofa/component/linearsolver/init.cpp b/Sofa/Component/LinearSolver/src/sofa/component/linearsolver/init.cpp index e6d0a6bdbbd..3e4a9c37cee 100644 --- a/Sofa/Component/LinearSolver/src/sofa/component/linearsolver/init.cpp +++ b/Sofa/Component/LinearSolver/src/sofa/component/linearsolver/init.cpp @@ -26,6 +26,9 @@ #include #include +#include +#include + namespace sofa::component::linearsolver { @@ -33,6 +36,7 @@ extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -50,6 +54,14 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver.Direct"); + factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver.Iterative"); + factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver.Ordering"); + factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver.Preconditioner"); +} + void init() { static bool first = true; @@ -61,6 +73,9 @@ void init() sofa::component::linearsolver::iterative::init(); sofa::component::linearsolver::preconditioner::init(); + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/src/sofa/component/init.cpp b/Sofa/Component/src/sofa/component/init.cpp index 783ca1c1aeb..52d75b41254 100644 --- a/Sofa/Component/src/sofa/component/init.cpp +++ b/Sofa/Component/src/sofa/component/init.cpp @@ -86,6 +86,7 @@ void registerObjects(sofa::core::ObjectFactory* factory) factory->registerObjectsFromPlugin("Sofa.Component.Haptics"); factory->registerObjectsFromPlugin("Sofa.Component.Diffusion"); factory->registerObjectsFromPlugin("Sofa.Component.ODESolver"); + factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver"); } void init() diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index a0ef1c3c0a9..ef971f1f8e8 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -784,6 +784,17 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"ImplicitEulerSolver", Dealiased("v24.12","EulerImplicitSolver")}, {"ImplicitEuler", Dealiased("v24.12","EulerImplicitSolver")}, {"VariationalSolver", Dealiased("v24.12","VariationalSymplecticSolver")}, + {"SVDLinear", Dealiased("v24.12","SVDLinearSolver")}, + {"SVD", Dealiased("v24.12","SVDLinearSolver")}, + {"CGSolver", Dealiased("v24.12","CGLinearSolver")}, + {"ConjugateGradient", Dealiased("v24.12","CGLinearSolver")}, + {"MINRESSolver", Dealiased("v24.12","MinResLinearSolver")}, + {"MinResSolver", Dealiased("v24.12","MinResLinearSolver")}, + {"PCGLinearSolver", Dealiased("v24.12","ShewchukPCGLinearSolver")}, + {"JacobiLinearSolver", Dealiased("v24.12","JacobiPreconditioner")}, + {"JacobiSolver", Dealiased("v24.12","JacobiPreconditioner")}, + {"SSORLinearSolver", Dealiased("v24.12","SSORPreconditioner")}, + {"SSORSolver", Dealiased("v24.12","SSORPreconditioner")}, };