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
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ namespace sofa::component::constraint::lagrangian::model
using namespace sofa::defaulttype;
using namespace sofa::helper;

int MORUnilateralInteractionConstraintClass = core::RegisterObject("Unilateral constraint in a reduced model")
.add< MORUnilateralInteractionConstraint<Vec3Types> >()
;
void registerMORUnilateralInteractionConstraint(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Unilateral constraint in a reduced model")
.add< MORUnilateralInteractionConstraint<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API MORUnilateralInteractionConstraint<Vec3Types>;
} // namespace sofa::component::constraint::lagrangian::model
Expand Down
12 changes: 7 additions & 5 deletions src/ModelOrderReduction/component/contact/MORpointModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ using namespace sofa::defaulttype;
using namespace sofa::core::collision;
using namespace helper;

int MORPointCollisionModelClass = core::RegisterObject("Collision model which represents a set of points")
.add< MORPointCollisionModel<defaulttype::Vec3Types> >()

.addAlias("MORPoint")
;
void registerMORPointCollisionModel(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Collision model which represents a set of points")
.add< MORPointCollisionModel<defaulttype::Vec3Types> >()
.addAlias("MORPoint")
);
}

template class SOFA_MODELORDERREDUCTION_API MORPointCollisionModel<defaulttype::Vec3Types>;
} // namespace sofa::component::collision::geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ using namespace sofa::defaulttype;
//SOFA_DECL_CLASS(HyperReducedHexahedronFEMForceField)

// Register in the Factory
int HyperReducedHexahedronFEMForceFieldClass = core::RegisterObject("Hexahedral finite elements")
.add< HyperReducedHexahedronFEMForceField<Vec3Types> >()
;
void registerHyperReducedHexahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Hexahedral finite elements")
.add< HyperReducedHexahedronFEMForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedHexahedronFEMForceField<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ using namespace sofa::defaulttype;

SOFA_DECL_CLASS(HyperReducedRestShapeSpringsForceField)


int HyperReducedRestShapeSpringsForceFieldClass = core::RegisterObject("Simple elastic springs applied to given degrees of freedom between their current and rest shape position")
.add< HyperReducedRestShapeSpringsForceField<Vec3Types> >()
;
void registerHyperReducedRestShapeSpringsForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Simple elastic springs applied to given degrees of freedom between their current and rest shape position")
.add< HyperReducedRestShapeSpringsForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedRestShapeSpringsForceField<Vec3Types>;
} // namespace sofa::component::solidmechanics::spring
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ using namespace sofa::defaulttype;
SOFA_DECL_CLASS(HyperReducedTetrahedralCorotationalFEMForceField)

// Register in the Factory
int HyperReducedTetrahedralCorotationalFEMForceFieldClass = core::RegisterObject("Corotational FEM Tetrahedral finite elements")
.add< HyperReducedTetrahedralCorotationalFEMForceField<Vec3Types> >()
;
void registerHyperReducedTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Corotational FEM Tetrahedral finite elements")
.add< HyperReducedTetrahedralCorotationalFEMForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedTetrahedralCorotationalFEMForceField<Vec3Types>;
} // namespace sofa::component::solidmechanics::fem::elastic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ using namespace sofa::defaulttype;
SOFA_DECL_CLASS(HyperReducedTetrahedronFEMForceField)

// Register in the Factory
int HyperReducedTetrahedronFEMForceFieldClass = core::RegisterObject("Tetrahedral finite elements")
.add< HyperReducedTetrahedronFEMForceField<Vec3Types> >()
;
void registerHyperReducedTetrahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Tetrahedral finite elements")
.add< HyperReducedTetrahedronFEMForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedTetrahedronFEMForceField<Vec3Types>;
} // namespace sofa::component::forcefield
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ using namespace sofa::defaulttype;
SOFA_DECL_CLASS(HyperReducedTetrahedronHyperelasticityFEMForceField)

// Register in the Factory
int HyperReducedTetrahedronHyperelasticityFEMForceFieldClass = core::RegisterObject("Generic Tetrahedral finite elements")
.add< HyperReducedTetrahedronHyperelasticityFEMForceField<Vec3Types> >()
;
void registerHyperReducedTetrahedronHyperelasticityFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Generic Tetrahedral finite elements")
.add< HyperReducedTetrahedronHyperelasticityFEMForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedTetrahedronHyperelasticityFEMForceField<Vec3Types>;
} // namespace sofa::component::forcefield
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ SOFA_DECL_CLASS(HyperReducedTriangleFEMForceField)
using namespace sofa::defaulttype;

// Register in the Factory
int HyperReducedTriangleFEMForceFieldClass = core::RegisterObject("Triangular finite elements")
.add< HyperReducedTriangleFEMForceField<Vec3Types> >()
;
void registerHyperReducedTriangleFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Triangular finite elements")
.add< HyperReducedTriangleFEMForceField<Vec3Types> >());
}

template class SOFA_MODELORDERREDUCTION_API HyperReducedTriangleFEMForceField<Vec3Types>;
} // namespace sofa::component::solidmechanics::fem::elastic
16 changes: 7 additions & 9 deletions src/ModelOrderReduction/component/mapping/MORContactMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,20 @@ using namespace core::behavior;


// Register in the Factory
int MORContactMappingClass = core::RegisterObject("Special case of mapping where the child points are the same as the parent points")
.add< MORContactMapping< Vec3dTypes, Vec3dTypes > >()
.add< MORContactMapping< Vec2Types, Vec2Types > >()
.add< MORContactMapping< Vec1Types, Vec1Types > >()

;

void registerMORContactMapping(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Special case of mapping where the child points are the same as the parent points")
.add< MORContactMapping< Vec3dTypes, Vec3dTypes > >()
.add< MORContactMapping< Vec2Types, Vec2Types > >()
.add< MORContactMapping< Vec1Types, Vec1Types > >());
}

template class MORContactMapping< Vec3dTypes, Vec3dTypes >;
template class MORContactMapping< Vec2Types, Vec2Types >;
template class MORContactMapping< Vec1Types, Vec1Types >;





} // namespace mapping

} // namespace component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ using namespace core::behavior;
SOFA_DECL_CLASS(ModelOrderReductionMapping)

// Register in the Factory
static int ModelOrderReductionMappingClass = core::RegisterObject("Reduced model")
.add< ModelOrderReductionMapping< Vec1Types, Vec3Types > >(true)
;
void registerModelOrderReductionMapping(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Reduced model")
.add< ModelOrderReductionMapping< Vec1Types, Vec3Types > >(true));
}

template class SOFA_MODELORDERREDUCTION_API ModelOrderReductionMapping< Vec1Types, Vec3Types >;

Expand Down
11 changes: 6 additions & 5 deletions src/ModelOrderReduction/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
* *
* Contact information: https://project.inria.fr/modelorderreduction/contact *
******************************************************************************/
#ifndef INITMODELORDERREDUCTION_H
#define INITMODELORDERREDUCTION_H

#pragma once

#include <sofa/config.h>

Expand All @@ -27,6 +25,9 @@
#define SOFA_MODELORDERREDUCTION_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#endif // INITINITMODELORDERREDUCTION_H

namespace modelorderreduction
{
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
} // namespace modelorderreduction

52 changes: 47 additions & 5 deletions src/ModelOrderReduction/initModelOrderReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,39 @@
******************************************************************************/
#include <ModelOrderReduction/config.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

#include <fstream>

namespace sofa::component::solidmechanics::spring
{
extern void registerHyperReducedRestShapeSpringsForceField(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::solidmechanics::fem::elastic
{
extern void registerHyperReducedTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerHyperReducedTriangleFEMForceField(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::forcefield
{
extern void registerHyperReducedHexahedronFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerHyperReducedTetrahedronHyperelasticityFEMForceField(sofa::core::ObjectFactory* factory);
extern void registerHyperReducedTetrahedronFEMForceField(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::mapping
{
extern void registerMORContactMapping(sofa::core::ObjectFactory* factory);
extern void registerModelOrderReductionMapping(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::constraint::lagrangian::model
{
extern void registerMORUnilateralInteractionConstraint(sofa::core::ObjectFactory* factory);
}
namespace sofa::component::collision::geometry
{
extern void registerMORPointCollisionModel(sofa::core::ObjectFactory* factory);
}

namespace modelorderreduction
{
//Here are just several convenient functions to help user to know what contains the plugin
Expand All @@ -29,26 +59,29 @@ extern "C" {
SOFA_MODELORDERREDUCTION_API const char* getModuleVersion();
SOFA_MODELORDERREDUCTION_API const char* getModuleLicense();
SOFA_MODELORDERREDUCTION_API const char* getModuleDescription();
SOFA_MODELORDERREDUCTION_API const char* getModuleComponentList();
SOFA_MODELORDERREDUCTION_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(MODULE_NAME);

first = false;
}
}

const char* getModuleName()
{
return "ModelOrderReduction";
return MODULE_NAME;
}

const char* getModuleVersion()
{
return "1.0";
return MODULE_VERSION;
}

const char* getModuleLicense()
Expand All @@ -57,9 +90,18 @@ const char* getModuleLicense()
}


const char* getModuleDescription()
void registerObjects(sofa::core::ObjectFactory* factory)
{
return "The ModelOrderReduction plugin builds reduced models by reducing the computational complexity of the system";
sofa::component::solidmechanics::spring::registerHyperReducedRestShapeSpringsForceField(factory);
sofa::component::solidmechanics::fem::elastic::registerHyperReducedTetrahedralCorotationalFEMForceField( factory);
sofa::component::solidmechanics::fem::elastic::registerHyperReducedTriangleFEMForceField(factory);
sofa::component::forcefield::registerHyperReducedHexahedronFEMForceField(factory);
sofa::component::forcefield::registerHyperReducedTetrahedronHyperelasticityFEMForceField(factory);
sofa::component::forcefield::registerHyperReducedTetrahedronFEMForceField(factory);
sofa::component::mapping::registerMORContactMapping(factory);
sofa::component::mapping::registerModelOrderReductionMapping(factory);
sofa::component::constraint::lagrangian::model::registerMORUnilateralInteractionConstraint(factory);
sofa::component::collision::geometry::registerMORPointCollisionModel(factory);
}

}
Loading