Skip to content
Merged
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
14 changes: 7 additions & 7 deletions src/CSparseSolvers/SparseCholeskySolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ using namespace sofa::linearalgebra;
#ifdef SOFA_FLOAT
SOFA_PRAGMA_WARNING("SparseCholeskySolver does not support float as scalar.")
#else // SOFA_DOUBLE
int SparseCholeskySolverClass =
sofa::core::RegisterObject(
"Direct linear solver based on Sparse Cholesky factorization, implemented with the "
"CSPARSE library")
.add<SparseCholeskySolver<CompressedRowSparseMatrix<SReal>, FullVector<SReal> > >();

template class SOFA_CSPARSESOLVERS_API
SparseCholeskySolver<CompressedRowSparseMatrix<SReal>, FullVector<SReal> >;
void registerSparseCholeskySolver(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Direct linear solver based on Sparse Cholesky factorization, implemented with the CSPARSE library")
.add<SparseCholeskySolver<CompressedRowSparseMatrix<SReal>, FullVector<SReal> > >());
}

template class SOFA_CSPARSESOLVERS_API SparseCholeskySolver<CompressedRowSparseMatrix<SReal>, FullVector<SReal> >;
#endif // SOFA_FLOAT

} // namespace sofa::component::linearsolver::direct
11 changes: 7 additions & 4 deletions src/CSparseSolvers/SparseLUSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ using namespace sofa::linearalgebra;
#ifdef SOFA_FLOAT
SOFA_PRAGMA_WARNING("SparseLUSolver does not support float as scalar.")
#else // SOFA_DOUBLE
int SparseLUSolverClass = sofa::core::RegisterObject("Direct linear solver based on Sparse LU factorization, implemented with the CSPARSE library")
.add< SparseLUSolver< CompressedRowSparseMatrix<SReal>, FullVector<SReal> > >()
.add< SparseLUSolver< CompressedRowSparseMatrix<sofa::type::Mat<3,3,SReal> >,FullVector<SReal> > >()
;

void registerSparseLUSolver(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Direct linear solver based on Sparse LU factorization, implemented with the CSPARSE library")
.add< SparseLUSolver< CompressedRowSparseMatrix<SReal>, FullVector<SReal> > >()
.add< SparseLUSolver< CompressedRowSparseMatrix<sofa::type::Mat<3,3,SReal> >,FullVector<SReal> > >());
}

template class SOFA_CSPARSESOLVERS_API SparseLUSolver< CompressedRowSparseMatrix<SReal>, FullVector<SReal> >;
template class SOFA_CSPARSESOLVERS_API SparseLUSolver< CompressedRowSparseMatrix<sofa::type::Mat<3,3,SReal> >, FullVector<SReal> >;
Expand Down
6 changes: 6 additions & 0 deletions src/CSparseSolvers/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
#else
# define SOFA_CSPARSESOLVERS_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

namespace csparsesolvers
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace csparsesolvers
23 changes: 16 additions & 7 deletions src/CSparseSolvers/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,43 @@

#include <sofa/core/ObjectFactory.h>
using sofa::core::ObjectFactory;
#include <sofa/helper/system/PluginManager.h>

namespace csparsesolvers
{
extern void registerSparseLUSolver(sofa::core::ObjectFactory* factory);
extern void registerSparseCholeskySolver(sofa::core::ObjectFactory* factory);
}

extern "C" {
SOFA_CSPARSESOLVERS_API void initExternalModule();
SOFA_CSPARSESOLVERS_API const char* getModuleName();
SOFA_CSPARSESOLVERS_API const char* getModuleVersion();
SOFA_CSPARSESOLVERS_API const char* getModuleLicense();
SOFA_CSPARSESOLVERS_API const char* getModuleDescription();
SOFA_CSPARSESOLVERS_API const char* getModuleComponentList();
SOFA_CSPARSESOLVERS_API void registerObjects(sofa::core::ObjectFactory* factory);
}

void initExternalModule()
{
static bool first = true;
if (first)
{
// make sure that this plugin is registered into the PluginManager
sofa::helper::system::PluginManager::getInstance().registerPlugin(csparsesolvers::MODULE_NAME);

first = false;
}
}

const char* getModuleName()
{
return sofa_tostring(SOFA_TARGET);
return csparsesolvers::MODULE_NAME;
}

const char* getModuleVersion()
{
return sofa_tostring(CSPARSESOLVERS_VERSION);
return csparsesolvers::MODULE_VERSION;
}

const char* getModuleLicense()
Expand All @@ -41,9 +51,8 @@ const char* getModuleDescription()
return "A set of linear solvers based on the library CSparse";
}

const char* getModuleComponentList()
void registerObjects(sofa::core::ObjectFactory* factory)
{
/// string containing the names of the classes provided by the plugin
static std::string classes = ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET));
return classes.c_str();
csparsesolvers::registerSparseLUSolver(factory);
csparsesolvers::registerSparseCholeskySolver(factory);
}
Loading