Skip to content

Commit

Permalink
apply new register mechanism to solidmechanics
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Sep 27, 2024
1 parent 55f303f commit abb8776
Show file tree
Hide file tree
Showing 49 changed files with 399 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@
#include <sofa/core/ObjectFactory.h>


namespace sofa::component::solidmechanics::fem::elastic::_beamfemforcefield_
namespace sofa::component::solidmechanics::fem::elastic
{

using namespace sofa::defaulttype;

// Register in the Factory
int BeamFEMForceFieldClass = core::RegisterObject("Beam finite elements")
.add< BeamFEMForceField<Rigid3Types> >()
;
void registerBeamFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Beam finite elements.")
.add< BeamFEMForceField<Rigid3Types> >());
}

namespace _beamfemforcefield_
{

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API BeamFEMForceField<Rigid3Types>;
template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API BeamFEMForceField<Rigid3Types>;

} // namespace _beamfemforcefield_

} // namespace sofa::component::solidmechanics::fem::elastic::_beamfemforcefield_
} // namespace sofa::component::solidmechanics::fem::elastic
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int FastTetrahedralCorotationalForceFieldClass = core::RegisterObject("Fast Corotational Tetrahedral Mesh")
.add< FastTetrahedralCorotationalForceField<Vec3Types> >()

;
void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Fast Corotational Tetrahedral Mesh.")
.add< FastTetrahedralCorotationalForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API FastTetrahedralCorotationalForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int HexahedralFEMForceFieldClass = core::RegisterObject("Hexahedral finite elements")
.add< HexahedralFEMForceField<Vec3Types> >()

;
void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements.")
.add< HexahedralFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedralFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;


// Register in the Factory
int HexahedralFEMForceFieldAndMassClass = core::RegisterObject("Hexahedral finite elements with mass")
.add< HexahedralFEMForceFieldAndMass<Vec3Types> >()

;
void registerHexahedralFEMForceFieldAndMass(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements with mass")
.add< HexahedralFEMForceFieldAndMass<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedralFEMForceFieldAndMass<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;


// Register in the Factory
int HexahedronFEMForceFieldClass = core::RegisterObject("Hexahedral finite elements")
.add< HexahedronFEMForceField<Vec3Types> >()

;
void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements.")
.add< HexahedronFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedronFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;


// Register in the Factory
int HexahedronFEMForceFieldAndMassClass = core::RegisterObject("Hexahedral finite elements with mass")
.add< HexahedronFEMForceFieldAndMass<Vec3Types> >()

;
void registerHexahedronFEMForceFieldAndMass(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements with mass.")
.add< HexahedronFEMForceFieldAndMass<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedronFEMForceFieldAndMass<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int QuadBendingFEMForceFieldClass = core::RegisterObject("Bending Quad finite elements")
.add< QuadBendingFEMForceField<Vec3Types> >();
void registerQuadBendingFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Bending Quad finite elements")
.add< QuadBendingFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API QuadBendingFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;


// Register in the Factory
int TetrahedralCorotationalFEMForceFieldClass = core::RegisterObject("Corotational FEM Tetrahedral finite elements")
.add< TetrahedralCorotationalFEMForceField<Vec3Types> >()

;
void registerTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational FEM Tetrahedral finite elements")
.add< TetrahedralCorotationalFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TetrahedralCorotationalFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;


// Register in the Factory
int TetrahedronFEMForceFieldClass = core::RegisterObject("Tetrahedral finite elements")
.add< TetrahedronFEMForceField<Vec3Types> >()

;
void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Tetrahedral finite elements.")
.add< TetrahedronFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TetrahedronFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int TriangleFEMForceFieldClass = core::RegisterObject("Triangular finite elements for static topology")
.add< TriangleFEMForceField<Vec3Types> >()

;
void registerTriangleFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Triangular finite elements for static topology.")
.add< TriangleFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangleFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int TriangularAnisotropicFEMForceFieldClass = core::RegisterObject("Triangular finite element model using anisotropic material")
.add< TriangularAnisotropicFEMForceField<Vec3Types> >()

;
void registerTriangularAnisotropicFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Triangular finite element model using anisotropic material.")
.add< TriangularAnisotropicFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularAnisotropicFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int TriangularFEMForceFieldClass = core::RegisterObject("Corotational Triangular finite elements for dynamic topology")
.add< TriangularFEMForceField<Vec3Types> >()

;
void registerTriangularFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational Triangular finite elements for dynamic topology.")
.add< TriangularFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace sofa::component::solidmechanics::fem::elastic

using namespace sofa::defaulttype;

// Register in the Factory
int TriangularFEMForceFieldOptimClass = core::RegisterObject("Corotational Triangular finite elements")
.add< TriangularFEMForceFieldOptim<Vec3Types> >()

;
void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational Triangular finite elements.")
.add< TriangularFEMForceFieldOptim<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularFEMForceFieldOptim<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,30 @@
******************************************************************************/
#include <sofa/component/solidmechanics/fem/elastic/init.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

namespace sofa::component::solidmechanics::fem::elastic
{


extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory);
extern void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerHexahedralFEMForceFieldAndMass(sofa::core::ObjectFactory* factory);
extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerHexahedronFEMForceFieldAndMass(sofa::core::ObjectFactory* factory);
extern void registerQuadBendingFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTriangleFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTriangularAnisotropicFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTriangularFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTriangularFEMForceFieldOptim(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()
Expand All @@ -45,11 +62,31 @@ const char* getModuleVersion()
return MODULE_VERSION;
}

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerBeamFEMForceField(factory);
registerFastTetrahedralCorotationalForceField(factory);
registerHexahedralFEMForceField(factory);
registerHexahedralFEMForceFieldAndMass(factory);
registerHexahedronFEMForceField(factory);
registerHexahedronFEMForceFieldAndMass(factory);
registerQuadBendingFEMForceField(factory);
registerTetrahedralCorotationalFEMForceField(factory);
registerTetrahedronFEMForceField(factory);
registerTriangleFEMForceField(factory);
registerTriangularAnisotropicFEMForceField(factory);
registerTriangularFEMForceField(factory);
registerTriangularFEMForceFieldOptim(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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ namespace sofa::component::solidmechanics::fem::hyperelastic

using namespace sofa::defaulttype;

// Register in the Factory
int StandardTetrahedralFEMForceFieldClass = core::RegisterObject("Generic Tetrahedral finite elements")
.add< StandardTetrahedralFEMForceField<Vec3Types> >()

;
void registerStandardTetrahedralFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Generic Tetrahedral finite elements.")
.add< StandardTetrahedralFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API StandardTetrahedralFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ namespace sofa::component::solidmechanics::fem::hyperelastic

using namespace sofa::defaulttype;

//////////****************To register in the factory******************

// Register in the Factory
int TetrahedronHyperelasticityFEMForceFieldClass = core::RegisterObject("Generic Tetrahedral finite elements")
.add< TetrahedronHyperelasticityFEMForceField<Vec3Types> >()

;
void registerTetrahedronHyperelasticityFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Generic Hyperelastic Tetrahedral finite elements.")
.add< TetrahedronHyperelasticityFEMForceField<Vec3Types> >());
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_API TetrahedronHyperelasticityFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
******************************************************************************/
#include <sofa/component/solidmechanics/fem/hyperelastic/init.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

namespace sofa::component::solidmechanics::fem::hyperelastic
{

extern void registerPlasticMaterial(sofa::core::ObjectFactory* factory);
extern void registerStandardTetrahedralFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerTetrahedronHyperelasticityFEMForceField(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()
Expand All @@ -45,11 +51,21 @@ const char* getModuleVersion()
return MODULE_VERSION;
}

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerPlasticMaterial(factory);
registerStandardTetrahedralFEMForceField(factory);
registerTetrahedronHyperelasticityFEMForceField(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;
}
}
Expand Down
Loading

0 comments on commit abb8776

Please sign in to comment.