Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Engine] Apply new factory registration mechanism #5010

Merged
merged 4 commits into from
Oct 2, 2024
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 @@ -30,14 +30,14 @@ namespace sofa::component::engine::analyze

using namespace sofa::defaulttype;

int AverageCoordClass = core::RegisterObject("Compute the average of coordinates")
void registerAverageCoord(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Compute the average of coordinates.")
.add< AverageCoord<Vec2Types> >()
.add< AverageCoord<Vec3Types> >()
.add< AverageCoord<Rigid2Types> >()
.add< AverageCoord<Rigid3Types> >()

;

.add< AverageCoord<Rigid3Types> >());
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API AverageCoord<Vec2Types>;
template class SOFA_COMPONENT_ENGINE_ANALYZE_API AverageCoord<Rigid2Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ namespace sofa::component::engine::analyze

using namespace sofa::defaulttype;

int ClusteringEngineClass = core::RegisterObject("Group points into overlapping clusters according to a user defined number of clusters and radius")
.add< ClusteringEngine<Vec3Types> >()

;
void registerClusteringEngine(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Group points into overlapping clusters according to a user defined number of clusters and radius.")
.add< ClusteringEngine<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API ClusteringEngine<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ namespace sofa::component::engine::analyze

using namespace sofa::defaulttype;

int DistancesClass = core::RegisterObject("Compute distances based on a grid.")
.add< Distances<Vec3Types> >()

;
void registerDistances(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Compute distances based on a grid.")
.add< Distances<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API Distances<Vec3Types>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ namespace sofa::component::engine::analyze

using namespace sofa::defaulttype;

int HausdorffDistanceClass = core::RegisterObject("Compute the Hausdorff distance of two point clouds")
void registerHausdorffDistance(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Compute the Hausdorff distance of two point clouds.")
.add< HausdorffDistance<Vec1Types> >()
.add< HausdorffDistance<Vec2Types> >()
.add< HausdorffDistance<Vec3Types> >(true)
.add< HausdorffDistance<Rigid2Types> >()
.add< HausdorffDistance<Rigid3Types> >()

;
.add< HausdorffDistance<Rigid3Types> >());
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API HausdorffDistance<Vec1Types>;
template class SOFA_COMPONENT_ENGINE_ANALYZE_API HausdorffDistance<Vec2Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ namespace sofa::component::engine::analyze

using namespace defaulttype;

int ShapeMatchingClass = core::RegisterObject("Compute target positions using shape matching deformation method by Mueller et al.")
void registerShapeMatching(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Compute target positions using shape matching deformation method by Mueller et al.")
.add< ShapeMatching<Vec3Types> >()
.add< ShapeMatching<Rigid3Types> >()

;
.add< ShapeMatching<Rigid3Types> >());
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API ShapeMatching<Vec3Types>;
template class SOFA_COMPONENT_ENGINE_ANALYZE_API ShapeMatching<Rigid3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ namespace sofa::component::engine::analyze
{

using namespace sofa::type;
using namespace sofa::defaulttype;

int SumEngineClass = core::RegisterObject("Computing the Sum between two vector of dofs")
void registerSumEngine(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Computing the sum between two vector of dofs.")
.add< SumEngine<Vec1> >()
.add< SumEngine<Vec3> >(true) // default template

;
.add< SumEngine<Vec3> >(true));
}

template class SOFA_COMPONENT_ENGINE_ANALYZE_API SumEngine<Vec1>;
template class SOFA_COMPONENT_ENGINE_ANALYZE_API SumEngine<Vec3>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@
******************************************************************************/
#include <sofa/component/engine/analyze/init.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>

namespace sofa::component::engine::analyze
{


extern void registerAverageCoord(sofa::core::ObjectFactory* factory);
extern void registerClusteringEngine(sofa::core::ObjectFactory* factory);
extern void registerDistances(sofa::core::ObjectFactory* factory);
extern void registerHausdorffDistance(sofa::core::ObjectFactory* factory);
extern void registerShapeMatching(sofa::core::ObjectFactory* factory);
extern void registerSumEngine(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 +55,24 @@ const char* getModuleVersion()
return MODULE_VERSION;
}

void registerObjects(sofa::core::ObjectFactory* factory)
{
registerAverageCoord(factory);
registerClusteringEngine(factory);
registerDistances(factory);
registerHausdorffDistance(factory);
registerShapeMatching(factory);
registerSumEngine(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 @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int ExtrudeEdgesAndGenerateQuadsClass = core::RegisterObject("This engine extrudes an edge-based curve into a quad surface patch")
.add< ExtrudeEdgesAndGenerateQuads<Vec3Types> >(true) // default template

;
void registerExtrudeEdgesAndGenerateQuads(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine extruding an edge-based curve into a quad surface patch.")
.add< ExtrudeEdgesAndGenerateQuads<Vec3Types> >(true));
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeEdgesAndGenerateQuads<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int ExtrudeQuadsAndGenerateHexasClass = core::RegisterObject("This engine extrudes a quad-based surface into a set of hexahedral elements")
.add< ExtrudeQuadsAndGenerateHexas<Vec3Types> >()

;
void registerExtrudeQuadsAndGenerateHexas(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine extruding a quad-based surface into a set of hexahedral elements.")
.add< ExtrudeQuadsAndGenerateHexas<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeQuadsAndGenerateHexas<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int ExtrudeSurfaceClass = core::RegisterObject("This class truns on spiral any topological model")
.add< ExtrudeSurface<Vec3Types> >()

;
void registerExtrudeSurface(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine creating a mesh from the extrusion of the surface of a given mesh.")
.add< ExtrudeSurface<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeSurface<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ namespace sofa::component::engine::generate
{
using namespace sofa::defaulttype;

int GenerateCylinderClass = core::RegisterObject("Generate a Cylindrical Tetrahedral Mesh")
.add< GenerateCylinder<Vec3Types> >()

;

void registerGenerateCylinder(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine generating a cylindrical tetrahedral mesh.")
.add< GenerateCylinder<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateCylinder<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ namespace sofa::component::engine::generate
{
using namespace sofa::defaulttype;

int GenerateGridClass = core::RegisterObject("Generate a Grid Tetrahedral or Hexahedral Mesh")
void registerGenerateGrid(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine generating a grid tetrahedral or hexahedral mesh.")
.add< GenerateGrid<Vec3Types> >()
.add< GenerateGrid<Vec2Types> >()

;

.add< GenerateGrid<Vec2Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateGrid<Vec3Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateGrid<Vec2Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int GenerateRigidMassClass = core::RegisterObject("An engine computing the RigidMass of a mesh : mass, volume and inertia matrix.")
.add< GenerateRigidMass<Rigid3Types, Rigid3Mass> >()

;
void registerGenerateRigidMass(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine computing the RigidMass of a mesh: mass, volume and inertia matrix.")
.add< GenerateRigidMass<Rigid3Types, Rigid3Mass> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateRigidMass<Rigid3Types, Rigid3Mass>;


} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ namespace sofa::component::engine::generate
{
using namespace sofa::defaulttype;

int GenerateSphereClass = core::RegisterObject("Generate a sphereical (Bezier) Tetrahedral and Triangular Mesh")
.add< GenerateSphere<Vec3Types> >()

;

void registerGenerateSphere(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine generating a spherical (Bezier) tetrahedral and triangular mesh.")
.add< GenerateSphere<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateSphere<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int GroupFilterYoungModulusClass = core::RegisterObject("This class gives a vector of young modulus according of a list of defined groups")
.add< GroupFilterYoungModulus<Vec3Types> >()

;
void registerGroupFilterYoungModulus(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Engine defining a vector of young modulus according of a list of defined groups.")
.add< GroupFilterYoungModulus<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API GroupFilterYoungModulus<Vec3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ namespace sofa::component::engine::generate

using namespace sofa::defaulttype;

int JoinPointsClass = core::RegisterObject("?")
.add< JoinPoints<Vec3Types> >()

;
void registerJoinPoints(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Merge points from a set of points within a given distance.")
.add< JoinPoints<Vec3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API JoinPoints<Vec3Types>;


} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@
namespace sofa::component::engine::generate
{

int MergeMeshesClass = core::RegisterObject("Merge several meshes")
void registerMergeMeshes(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Merge several meshes.")
.add< MergeMeshes<defaulttype::Vec3Types> >(true) // default template
.add< MergeMeshes<defaulttype::Vec1Types> >()
.add< MergeMeshes<defaulttype::Vec2Types> >()
.add< MergeMeshes<defaulttype::Rigid2Types> >()
.add< MergeMeshes<defaulttype::Rigid3Types> >()

;
.add< MergeMeshes<defaulttype::Rigid3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes<defaulttype::Vec1Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes<defaulttype::Vec2Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes<defaulttype::Vec3Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes<defaulttype::Rigid2Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes<defaulttype::Rigid3Types>;



} //namespace sofa::component::engine::generate
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@
namespace sofa::component::engine::generate
{

int MergePointsClass = core::RegisterObject("Merge 2 cordinate vectors")
void registerMergePoints(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Merge 2 cordinate vectors.")
.add< MergePoints<defaulttype::Vec3Types> >(true) // default template
.add< MergePoints<defaulttype::Vec1Types> >()
.add< MergePoints<defaulttype::Vec2Types> >()
.add< MergePoints<defaulttype::Rigid2Types> >()
.add< MergePoints<defaulttype::Rigid3Types> >()

;
.add< MergePoints<defaulttype::Rigid3Types> >());
}

template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints<defaulttype::Vec1Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints<defaulttype::Vec2Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints<defaulttype::Vec3Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints<defaulttype::Rigid2Types>;
template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints<defaulttype::Rigid3Types>;



} //namespace sofa::component::engine::generate
Loading
Loading