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

[Config] Introduce SOFA modules data structure #5148

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions Sofa/Component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ sofa_create_package_with_targets(
INCLUDE_SOURCE_DIR "src"
INCLUDE_INSTALL_DIR "${PROJECT_NAME}"
)

# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SOFA_COMPONENT_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SOFA_COMPONENT_BUILD_TESTS)
add_subdirectory(test)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class TestCollisionPipeline : public BaseSimulationTest {

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Collision");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Collision);
}

void TearDown() override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ namespace
struct TestLocalMinDistance : public BaseSimulationTest {
void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Intersection");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Collision.Detection.Intersection);
}
void TearDown() override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <sofa/helper/system/PluginManager.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/Modules.h>

namespace sofa::component::collision::detection
{
Expand Down Expand Up @@ -54,8 +55,8 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Detection.Algorithm");
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Detection.Intersection");
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Detection.Algorithm);
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Detection.Intersection);
}

void init()
Expand Down
4 changes: 2 additions & 2 deletions Sofa/Component/Collision/Geometry/tests/Sphere_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct TestSphere : public BaseSimulationTest
{
void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Geometry");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Collision.Geometry);

m_proxIntersection = sofa::core::objectmodel::New<MinProximityIntersection>();
m_proxIntersection->setAlarmDistance(1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <sofa/helper/system/PluginManager.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/Modules.h>

namespace sofa::component::collision::response
{
Expand Down Expand Up @@ -54,8 +55,8 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Response.Mapper");
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Response.Contact");
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Response.Mapper);
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Response.Contact);
}

void init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <sofa/helper/system/PluginManager.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/Modules.h>

namespace sofa::component::collision
{
Expand Down Expand Up @@ -55,9 +56,9 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Geometry");
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Detection");
factory->registerObjectsFromPlugin("Sofa.Component.Collision.Response");
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Geometry);
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Detection);
factory->registerObjectsFromPlugin(Sofa.Component.Collision.Response);
}

void init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::constraint::lagrangian
{
Expand Down Expand Up @@ -55,9 +56,9 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Correction");
factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Model");
factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Solver");
factory->registerObjectsFromPlugin(Sofa.Component.Constraint.Lagrangian.Correction);
factory->registerObjectsFromPlugin(Sofa.Component.Constraint.Lagrangian.Model);
factory->registerObjectsFromPlugin(Sofa.Component.Constraint.Lagrangian.Solver);
}

void init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ struct FixedProjectiveConstraint_test : public BaseTest
const simulation::Node::SPtr root = simulation->createNewGraph("root");
root->setGravity( type::Vec3(0,0,0) );

simpleapi::createObject(root , "RequiredPlugin", {{"name", "Sofa.Component.LinearSolver.Direct"}}) ;
simpleapi::createObject(root , "RequiredPlugin", {{"name", "Sofa.Component.ODESolver.Forward"}}) ;
simpleapi::createObject(root , "RequiredPlugin", {{"name", "Sofa.Component.ODESolver.Backward"}}) ;
simpleapi::createObject(root , "RequiredPlugin", {{"name", Sofa.Component.LinearSolver.Direct}}) ;
simpleapi::createObject(root , "RequiredPlugin", {{"name", Sofa.Component.ODESolver.Forward}}) ;
simpleapi::createObject(root , "RequiredPlugin", {{"name", Sofa.Component.ODESolver.Backward}}) ;

simulation::Node::SPtr node = createEulerSolverNode(root,"test", integrationScheme);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::constraint
{
Expand Down Expand Up @@ -54,8 +55,8 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian");
factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Projective");
factory->registerObjectsFromPlugin(Sofa.Component.Constraint.Lagrangian);
factory->registerObjectsFromPlugin(Sofa.Component.Constraint.Projective);
}

void init()
Expand Down
6 changes: 3 additions & 3 deletions Sofa/Component/Engine/Select/tests/BoxROI_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ struct BoxROITest : public sofa::testing::BaseTest

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
sofa::simpleapi::importPlugin("Sofa.Component.Engine.Select");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic);
sofa::simpleapi::importPlugin(Sofa.Component.Engine.Select);

m_simu = sofa::simulation::getSimulation();
ASSERT_NE(m_simu, nullptr);
Expand Down
6 changes: 3 additions & 3 deletions Sofa/Component/Engine/Select/tests/MeshROI_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ struct MeshROI_test : public BaseSimulationTest,

void SetUp() override
{
simpleapi::importPlugin("Sofa.Component.Engine.Select");
simpleapi::importPlugin("Sofa.Component.Topology.Container.Constant");
simpleapi::importPlugin("Sofa.Component.IO.Mesh");
simpleapi::importPlugin(Sofa.Component.Engine.Select);
simpleapi::importPlugin(Sofa.Component.Topology.Container.Constant);
simpleapi::importPlugin(Sofa.Component.IO.Mesh);

// SetUp3
const string scene2 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct MeshSubsetEngine_test : public testing::BaseSimulationTest

void SetUp() override
{
simpleapi::importPlugin("Sofa.Component.Engine.Select");
simpleapi::importPlugin(Sofa.Component.Engine.Select);

m_root = simulation::getSimulation()->createNewNode("root");
ASSERT_NE(nullptr, m_root);
Expand Down
9 changes: 5 additions & 4 deletions Sofa/Component/Engine/src/sofa/component/engine/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::engine
{
Expand Down Expand Up @@ -56,10 +57,10 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Engine.Analyze");
factory->registerObjectsFromPlugin("Sofa.Component.Engine.Generate");
factory->registerObjectsFromPlugin("Sofa.Component.Engine.Select");
factory->registerObjectsFromPlugin("Sofa.Component.Engine.Transform");
factory->registerObjectsFromPlugin(Sofa.Component.Engine.Analyze);
factory->registerObjectsFromPlugin(Sofa.Component.Engine.Generate);
factory->registerObjectsFromPlugin(Sofa.Component.Engine.Select);
factory->registerObjectsFromPlugin(Sofa.Component.Engine.Transform);
}

void init()
Expand Down
4 changes: 2 additions & 2 deletions Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class MeshExporter_test

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Grid");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid);
}

void TearDown() override
Expand Down
2 changes: 1 addition & 1 deletion Sofa/Component/IO/Mesh/tests/MeshXspLoader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MeshXspLoader_test : public BaseSimulationTest
const Node::SPtr root = sofa::simpleapi::createRootNode(simulation, "root");

sofa::simpleapi::createObject(root, "DefaultAnimationLoop");
sofa::simpleapi::createObject(root, "RequiredPlugin", { { "name","Sofa.Component.IO.Mesh" } });
sofa::simpleapi::createObject(root, "RequiredPlugin", { { "name",Sofa.Component.IO.Mesh } });
auto loader = sofa::simpleapi::createObject(root, "MeshXspLoader",
{{"filename", std::string(SOFA_COMPONENT_IO_MESH_TEST_FILES_DIR)+"test.xs3"}});
sofa::simulation::node::initRoot(root.get());
Expand Down
6 changes: 3 additions & 3 deletions Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class STLExporter_test : public BaseSimulationTest {

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Visual");
sofa::simpleapi::importPlugin("Sofa.Component.IO.Mesh");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Visual);
sofa::simpleapi::importPlugin(Sofa.Component.IO.Mesh);
}

void TearDown() override
Expand Down
3 changes: 2 additions & 1 deletion Sofa/Component/IO/src/sofa/component/io/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::io
{
Expand Down Expand Up @@ -53,7 +54,7 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.IO.Mesh");
factory->registerObjectsFromPlugin(Sofa.Component.IO.Mesh);
}

void init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ TEST(SparseLDLSolver, EmptyMState)

const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root");

sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Direct");
sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward");
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin(Sofa.Component.LinearSolver.Direct);
sofa::simpleapi::importPlugin(Sofa.Component.ODESolver.Backward);
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);

sofa::simpleapi::createObject(root, "DefaultAnimationLoop");
sofa::simpleapi::createObject(root, "EulerImplicitSolver");
Expand All @@ -85,12 +85,12 @@ TEST(SparseLDLSolver, TopologyChangeEmptyMState)

const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root");

sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Direct");
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward");
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Utility");
sofa::simpleapi::importPlugin(Sofa.Component.LinearSolver.Direct);
sofa::simpleapi::importPlugin(Sofa.Component.Mass);
sofa::simpleapi::importPlugin(Sofa.Component.ODESolver.Backward);
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Utility);

sofa::simpleapi::createObject(root, "DefaultAnimationLoop");
sofa::simpleapi::createObject(root, "EulerImplicitSolver");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::linearsolver
{
Expand Down Expand Up @@ -56,10 +57,10 @@ const char* getModuleVersion()

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");
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()
Expand Down
2 changes: 1 addition & 1 deletion Sofa/Component/LinearSystem/tests/MappingGraph_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ TEST(MappingGraph, diamondMapping)
sofa::simulation::Node::SPtr root = simulation->createNewGraph("root");
EXPECT_EQ(root->getName(), "root");

sofa::simpleapi::importPlugin("Sofa.Component.Mapping.Linear");
sofa::simpleapi::importPlugin(Sofa.Component.Mapping.Linear);

const auto top = sofa::core::objectmodel::New<sofa::component::statecontainer::MechanicalObject<sofa::defaulttype::Vec3Types> >();
root->addObject(top);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct SquareDistanceMappingCompare_test : NumericTest<SReal>
{
root = simulation::getSimulation()->createNewNode("root");

simpleapi::createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component"}});
simpleapi::createObject(root, "RequiredPlugin", {{"pluginName", Sofa.Component}});
simpleapi::createObject(root, "DefaultAnimationLoop");
simpleapi::createObject(root, "StringMeshCreator", {{"name", "loader"}, {"resolution", "3"}});

Expand Down
5 changes: 3 additions & 2 deletions Sofa/Component/Mapping/src/sofa/component/mapping/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <sofa/core/ObjectFactory.h>
#include <sofa/helper/system/PluginManager.h>
#include <sofa/Modules.h>

namespace sofa::component::mapping
{
Expand Down Expand Up @@ -53,8 +54,8 @@ const char* getModuleVersion()

void registerObjects(sofa::core::ObjectFactory* factory)
{
factory->registerObjectsFromPlugin("Sofa.Component.Mapping.Linear");
factory->registerObjectsFromPlugin("Sofa.Component.Mapping.NonLinear");
factory->registerObjectsFromPlugin(Sofa.Component.Mapping.Linear);
factory->registerObjectsFromPlugin(Sofa.Component.Mapping.NonLinear);
}

void init()
Expand Down
8 changes: 4 additions & 4 deletions Sofa/Component/Mass/tests/DiagonalMass_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class DiagonalMass_test : public BaseTest

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Grid");
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid);
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Mass);

simulation = simulation::getSimulation();
root = simulation::getSimulation()->createNewGraph("root");
Expand Down
8 changes: 4 additions & 4 deletions Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ class MeshMatrixMass_test : public BaseTest

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Grid");
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Dynamic);
sofa::simpleapi::importPlugin(Sofa.Component.Topology.Container.Grid);
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Mass);

simulation = simulation::getSimulation();
root = simulation::getSimulation()->createNewGraph("root");
Expand Down
4 changes: 2 additions & 2 deletions Sofa/Component/Mass/tests/UniformMass_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ struct UniformMassTest : public BaseTest

void SetUp() override
{
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
sofa::simpleapi::importPlugin(Sofa.Component.StateContainer);
sofa::simpleapi::importPlugin(Sofa.Component.Mass);

todo = true ;
m_simu = sofa::simulation::getSimulation();
Expand Down
Loading
Loading