diff --git a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp index b816831edf0..802cffe8f65 100644 --- a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp +++ b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp @@ -34,9 +34,6 @@ using sofa::core::objectmodel::BaseComponent ; #include using sofa::component::collision::detection::algorithm::CollisionPipeline ; -#include -using sofa::simulation::graph::DAGSimulation ; - #include using sofa::simulation::Node ; diff --git a/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp b/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp index 76d43def6a6..faf0cc73335 100644 --- a/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/tests/LocalMinDistance_test.cpp @@ -29,8 +29,8 @@ using std::string; #include using sofa::testing::BaseSimulationTest; -#include -using sofa::simulation::graph::DAGSimulation ; +#include +using sofa::simulation::Simulation ; using sofa::simulation::Node ; #include @@ -73,7 +73,7 @@ void TestLocalMinDistance::checkBasicIntersectionTests() { ExpectMessage warning(Message::Warning) ; - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); std::stringstream scene ; scene << " \n" @@ -102,7 +102,7 @@ void TestLocalMinDistance::checkMissingRequiredAttributes() { ExpectMessage warning(Message::Warning) ; - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); std::stringstream scene ; scene << " \n" @@ -125,7 +125,7 @@ void TestLocalMinDistance::checkMissingRequiredAttributes() void TestLocalMinDistance::checkAttributes() { - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); std::stringstream scene ; scene << " \n" @@ -158,7 +158,7 @@ void TestLocalMinDistance::checkAttributes() void TestLocalMinDistance::checkDoubleInit() { - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); std::stringstream scene ; scene << " \n" @@ -186,7 +186,7 @@ void TestLocalMinDistance::checkDoubleInit() void TestLocalMinDistance::checkInitReinit() { - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); std::stringstream scene ; scene << " \n" diff --git a/Sofa/Component/Constraint/Lagrangian/Model/tests/BilateralInteractionLagrangianConstraint_test.cpp b/Sofa/Component/Constraint/Lagrangian/Model/tests/BilateralInteractionLagrangianConstraint_test.cpp index e1f40f538e2..14113ec721d 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/tests/BilateralInteractionLagrangianConstraint_test.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/tests/BilateralInteractionLagrangianConstraint_test.cpp @@ -20,7 +20,6 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include #include #include #include @@ -74,7 +73,7 @@ struct BilateralInteractionLangrangianConstraint_test : public NumericTest<> sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Intersection"); sofa::simpleapi::importPlugin("Sofa.Component.Collision.Response.Contact"); sofa::simpleapi::importPlugin("Sofa.GL.Component.Rendering3D"); - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); } void TearDown() override @@ -180,7 +179,7 @@ void BilateralInteractionLangrangianConstraint_test::init_Vec3Setup() // a scene independently of the data template to use. std::string sceneName = "BilateralInteractionLangrangianConstraint.scn"; std::string fileName = std::string(SOFATEST_SCENES_DIR) + "/" + sceneName; - root = sofa::simulation::getSimulation()->load(fileName.c_str()).get(); + root = sofa::simulation::MainSimulation::getSimulation()->load(fileName.c_str()).get(); //TODO(dmarchal): I'm very surprised that scene.loadSucceed could contain // a state about the load results that happens "before" maybe a side effect @@ -196,7 +195,7 @@ void BilateralInteractionLangrangianConstraint_test::init_Vec3Setup() /// Init - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::MainSimulation::getSimulation()->init(root.get()); } template<> @@ -214,7 +213,7 @@ bool BilateralInteractionLangrangianConstraint_test::test_Vec3Constra } for(int i=0; i<10; i++) - sofa::simulation::getSimulation()->animate(root.get(),(double)0.001); + sofa::simulation::MainSimulation::getSimulation()->animate(root.get(),(double)0.001); if(meca.size()==2) { diff --git a/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp index 4b4f258cb12..a1bf632742f 100644 --- a/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/AffineMovementProjectiveConstraint_test.cpp @@ -24,7 +24,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::testing::NumericTest; -#include #include #include #include @@ -73,9 +72,9 @@ struct AffineMovementProjectiveConstraint_test : public BaseSimulationTest, Nume void doSetUp() override { // Init simulation - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); // Init seed with a random value between 0 and 100 randomGenerator.initSeed( (long)time(0) ); diff --git a/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp index d599139cb25..11c0e7c9ea4 100644 --- a/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/DirectionProjectiveConstraint_test.cpp @@ -24,7 +24,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::testing::NumericTest; -#include #include #include #include @@ -72,7 +71,7 @@ struct DirectionProjectiveConstraint_test : public BaseSimulationTest, NumericTe void doSetUp() override { //Init - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(simulation, nullptr); /// Create the scene diff --git a/Sofa/Component/Constraint/Projective/tests/FixedPlaneProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/FixedPlaneProjectiveConstraint_test.cpp index 36694560ec9..400973223df 100644 --- a/Sofa/Component/Constraint/Projective/tests/FixedPlaneProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/FixedPlaneProjectiveConstraint_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; #include #include #include -#include #include #include #include @@ -69,7 +68,7 @@ struct FixedPlaneProjectiveConstraint_test : public BaseSimulationTest /// Scene initialization sofa::simulation::Simulation* simulation; - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); simulation::Node::SPtr root = simulation->createNewGraph("root"); root->setGravity( type::Vec3(0,0,0) ); diff --git a/Sofa/Component/Constraint/Projective/tests/FixedProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/FixedProjectiveConstraint_test.cpp index 9ba4d234576..7b0b9744522 100644 --- a/Sofa/Component/Constraint/Projective/tests/FixedProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/FixedProjectiveConstraint_test.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -69,7 +68,7 @@ struct FixedProjectiveConstraint_test : public BaseTest { //Init - simulation::Simulation* simulation = sofa::simulation::getSimulation(); + simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); assert(simulation); Coord initCoord1, initCoord2; @@ -151,7 +150,7 @@ struct FixedProjectiveConstraint_test : public BaseTest bool testTopologicalChanges() { - simulation::Simulation* simulation = sofa::simulation::getSimulation(); + simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); assert(simulation); /// Scene creation diff --git a/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp index 07e2dc61dc7..17f39943d1c 100644 --- a/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/LineProjectiveConstraint_test.cpp @@ -24,7 +24,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::testing::NumericTest; -#include #include #include #include @@ -70,7 +69,7 @@ struct LineProjectiveConstraint_test : public BaseSimulationTest, NumericTest #include #include -#include #include #include #include @@ -67,7 +66,7 @@ struct PartialFixedProjectiveConstraint_test : public BaseSimulationTest typename sofa::component::statecontainer::MechanicalObject::SPtr mstate; /// Scene initialization - sofa::simulation::Simulation* simulation = sofa::simulation::getSimulation(); + sofa::simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); assert(simulation); const simulation::Node::SPtr root = simulation->createNewGraph("root"); diff --git a/Sofa/Component/Constraint/Projective/tests/PlaneProjectiveConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/PlaneProjectiveConstraint_test.cpp index fd18ee14205..ac8d4a61b6c 100644 --- a/Sofa/Component/Constraint/Projective/tests/PlaneProjectiveConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/PlaneProjectiveConstraint_test.cpp @@ -24,7 +24,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::testing::NumericTest; -#include #include #include #include @@ -71,7 +70,7 @@ struct PlaneProjectiveConstraint_test : public BaseSimulationTest, NumericTest using sofa::testing::NumericTest; -#include #include #include #include @@ -71,7 +70,7 @@ struct PointProjectiveConstraint_test : public BaseSimulationTest, NumericTest using sofa::testing::BaseSimulationTest; -#include - #include #include #include @@ -100,7 +98,7 @@ struct TetrahedronDiffusionFEMForceField_test : public BaseSimulationTest timeStep = 0.0001; idMiddlePoint = 1270; - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); assert(simu); /// Load the scene diff --git a/Sofa/Component/Engine/Analyze/tests/AverageCoord_test.cpp b/Sofa/Component/Engine/Analyze/tests/AverageCoord_test.cpp index 96d9416c4f6..1feb741d8c1 100644 --- a/Sofa/Component/Engine/Analyze/tests/AverageCoord_test.cpp +++ b/Sofa/Component/Engine/Analyze/tests/AverageCoord_test.cpp @@ -27,12 +27,11 @@ using sofa::testing::BaseSimulationTest; #include using sofa::component::statecontainer::MechanicalObject ; -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::analyze::AverageCoord ; @@ -59,7 +58,7 @@ struct AverageCoord_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp b/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp index b57ca438e54..886b188e2a5 100644 --- a/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp +++ b/Sofa/Component/Engine/Analyze/tests/ClusteringEngine_test.cpp @@ -26,12 +26,10 @@ using sofa::testing::BaseSimulationTest; #include using sofa::component::statecontainer::MechanicalObject ; -#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::core::visual::VisualParams; @@ -59,7 +57,7 @@ struct ClusteringEngine_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp b/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp index c7a2fdd853c..55bbee6363c 100644 --- a/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/ExtrudeEdgesAndGenerateQuads_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::generate::ExtrudeEdgesAndGenerateQuads ; @@ -57,7 +56,7 @@ struct ExtrudeEdgesAndGenerateQuads_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp b/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp index 5f50d949e1f..ebc9680ffcc 100644 --- a/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/MergePoints_test.cpp @@ -22,8 +22,7 @@ #include using sofa::testing::BaseSimulationTest; -#include -using sofa::simulation::graph::DAGSimulation; +#include using sofa::simulation::Simulation ; using sofa::core::objectmodel::New ; @@ -51,7 +50,7 @@ struct MergePoints_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_thisObject = New(); diff --git a/Sofa/Component/Engine/Generate/tests/VolumeFromTriangles_test.cpp b/Sofa/Component/Engine/Generate/tests/VolumeFromTriangles_test.cpp index eaefad223e7..e38bcf71696 100644 --- a/Sofa/Component/Engine/Generate/tests/VolumeFromTriangles_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/VolumeFromTriangles_test.cpp @@ -40,7 +40,7 @@ using sofa::defaulttype::Vec3Types ; #include using sofa::simulation::SceneLoaderXML ; -#include +#include using sofa::simulation::Simulation ; #include using sofa::simulation::Node ; @@ -84,7 +84,7 @@ struct VolumeFromTrianglesTest : public sofa::testing::BaseTest, VolumeFromTrian void normalTests() { - Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); + Node::SPtr node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); typename MechanicalObject::SPtr mecaobject = New >() ; typename ThisClass::SPtr thisobject = New() ; mecaobject->init() ; @@ -119,7 +119,7 @@ struct VolumeFromTrianglesTest : public sofa::testing::BaseTest, VolumeFromTrian double volumeComputationTest() { - Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); + Node::SPtr node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); typename MeshTopology::SPtr mesh = New< MeshTopology >() ; typename MechanicalObject::SPtr mecaobject = New< MechanicalObject >() ; diff --git a/Sofa/Component/Engine/Generate/tests/VolumeFromVolumetricElements_test.cpp b/Sofa/Component/Engine/Generate/tests/VolumeFromVolumetricElements_test.cpp index 81d08829f81..d4d2f68ef2a 100644 --- a/Sofa/Component/Engine/Generate/tests/VolumeFromVolumetricElements_test.cpp +++ b/Sofa/Component/Engine/Generate/tests/VolumeFromVolumetricElements_test.cpp @@ -37,7 +37,7 @@ using sofa::defaulttype::Vec3Types ; #include using sofa::simulation::SceneLoaderXML ; -#include +#include using sofa::simulation::Simulation ; #include using sofa::simulation::Node ; @@ -84,7 +84,7 @@ struct VolumeFromVolumetricElementsTest : public sofa::testing::BaseTest, Volume void normalTests() { - const Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); + const Node::SPtr node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); typename MechanicalObject::SPtr mecaobject = New >() ; typename ThisClass::SPtr thisobject = New() ; mecaobject->init() ; @@ -118,7 +118,7 @@ struct VolumeFromVolumetricElementsTest : public sofa::testing::BaseTest, Volume double volumeComputationTest() { - const Node::SPtr node = sofa::simulation::getSimulation()->createNewGraph("root"); + const Node::SPtr node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); typename MeshTopology::SPtr mesh = New< MeshTopology >() ; typename MechanicalObject::SPtr mecaobject = New< MechanicalObject >() ; diff --git a/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp b/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp index ad752d4ba25..9ffeeec3878 100644 --- a/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/BoxROI_test.cpp @@ -37,9 +37,8 @@ using sofa::core::objectmodel::ComponentState; #include using sofa::component::engine::select::BoxROI; -#include +#include using sofa::simulation::Simulation; -using sofa::simulation::graph::DAGSimulation; #include using sofa::simulation::Node; using sofa::core::objectmodel::BaseComponent; @@ -77,7 +76,7 @@ struct BoxROITest : public sofa::testing::BaseTest Sofa.Component.Topology.Container.Dynamic, Sofa.Component.Engine.Select}); - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_root = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp b/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp index ec055b0321a..8172d59d5d6 100644 --- a/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/ComplementaryROI_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::core::visual::VisualParams; @@ -57,7 +56,7 @@ struct ComplementaryROI_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp index 66867cba9b5..ff9bcf9ee97 100644 --- a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::select::MeshROI ; diff --git a/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp b/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp index a37e15c54f7..46ce8f3ce84 100644 --- a/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp +++ b/Sofa/Component/Engine/Select/tests/MeshSubsetEngine_test.cpp @@ -35,7 +35,7 @@ struct MeshSubsetEngine_test : public testing::BaseSimulationTest { loadPlugins({Sofa.Component.Engine.Select}); - m_root = simulation::getSimulation()->createNewNode("root"); + m_root = simulation::MainSimulation::getSimulation()->createNewNode("root"); ASSERT_NE(nullptr, m_root); m_engine = core::objectmodel::New>(); diff --git a/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp b/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp index a50e5cb6519..c0ba5a1c81e 100644 --- a/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/PlaneROI_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::select::PlaneROI ; @@ -64,7 +63,7 @@ struct PlaneROI_test : public BaseSimulationTest, void doSetUp() override { // SetUp1 - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_thisObject = New(); diff --git a/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp b/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp index 0bfb8a12387..fc188a51986 100644 --- a/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/SphereROI_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::select::SphereROI ; @@ -63,7 +62,7 @@ struct SphereROI_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_thisObject = New(); diff --git a/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp index d2f7ecddbbd..5b6a74a557d 100644 --- a/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/DifferenceEngine_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::core::visual::VisualParams; @@ -56,7 +55,7 @@ struct DifferenceEngine_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp index bbed29b8fa5..65d1b0babb1 100644 --- a/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/DilateEngine_test.cpp @@ -25,12 +25,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::transform::DilateEngine ; @@ -54,7 +53,7 @@ struct DilateEngine_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp b/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp index d28d41321e9..ab921d8638c 100644 --- a/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp +++ b/Sofa/Component/Engine/Transform/tests/SmoothMeshEngine_test.cpp @@ -24,12 +24,11 @@ using sofa::testing::BaseSimulationTest; #include -#include +#include using sofa::simulation::Simulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; -using sofa::simulation::graph::DAGSimulation; #include using sofa::component::engine::transform::SmoothMeshEngine ; @@ -55,7 +54,7 @@ struct SmoothMeshEngine_test : public BaseSimulationTest, void doSetUp() override { - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(m_simu, nullptr); m_node = m_simu->createNewGraph("root"); diff --git a/Sofa/Component/Haptics/tests/LCPForceFeedback_test.cpp b/Sofa/Component/Haptics/tests/LCPForceFeedback_test.cpp index 39e5d95a9ef..c1bfcbaf875 100644 --- a/Sofa/Component/Haptics/tests/LCPForceFeedback_test.cpp +++ b/Sofa/Component/Haptics/tests/LCPForceFeedback_test.cpp @@ -21,7 +21,7 @@ ******************************************************************************/ #include -#include +#include #include #include @@ -134,7 +134,7 @@ void LCPForceFeedback_test::HapticsThread(std::atomic& terminate, void * p void LCPForceFeedback_test::loadTestScene(const std::string& filename) { - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(simu, nullptr); /// Load the scene diff --git a/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp index 112017d7a2d..c89bc983c1c 100644 --- a/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/MeshExporter_test.cpp @@ -33,9 +33,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::core::objectmodel::BaseObject ; -#include -using sofa::simulation::graph::DAGSimulation ; - #include using sofa::simulation::Node ; diff --git a/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp index 9753bd4101c..64c9eff1028 100644 --- a/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/STLExporter_test.cpp @@ -31,9 +31,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::core::objectmodel::BaseObject ; -#include -using sofa::simulation::graph::DAGSimulation ; - #include using sofa::simulation::Node ; @@ -98,7 +95,7 @@ class STLExporter_test : public BaseSimulationTest { EXPECT_MSG_NOEMIT(Error, Warning) ; - const Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root", {{"gravity", "0 0 0"}}); + const Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root", {{"gravity", "0 0 0"}}); sofa::simpleapi::createObject(root, "DefaultAnimationLoop"); sofa::simpleapi::createObject(root, "MechanicalObject", {{"position", "0 1 2 3 4 5 6 7 8 9"}}); sofa::simpleapi::createObject(root, "MeshOBJLoader", {{"name", "loader"}, {"filename", "mesh/liver-smooth.obj"}}); @@ -129,7 +126,7 @@ class STLExporter_test : public BaseSimulationTest { EXPECT_MSG_NOEMIT(Error, Warning) ; - const Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root", {{"gravity", "0 0 0"}}); + const Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root", {{"gravity", "0 0 0"}}); sofa::simpleapi::createObject(root, "DefaultAnimationLoop"); sofa::simpleapi::createObject(root, "MechanicalObject", {{"position", "0 1 2 3 4 5 6 7 8 9"}}); sofa::simpleapi::createObject(root, "MeshOBJLoader", {{"name", "loader"}, {"filename", "mesh/liver-smooth.obj"}}); diff --git a/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp b/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp index eeb1810bcd0..526563cd35d 100644 --- a/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp +++ b/Sofa/Component/IO/Mesh/tests/VisualModelOBJExporter_test.cpp @@ -31,9 +31,6 @@ using sofa::testing::BaseSimulationTest; #include using sofa::core::objectmodel::BaseObject ; -#include -using sofa::simulation::graph::DAGSimulation ; - #include using sofa::simulation::Node ; diff --git a/Sofa/Component/LinearSolver/Direct/tests/SparseLDLSolver_test.cpp b/Sofa/Component/LinearSolver/Direct/tests/SparseLDLSolver_test.cpp index d00efa006f4..32f00f4cf3e 100644 --- a/Sofa/Component/LinearSolver/Direct/tests/SparseLDLSolver_test.cpp +++ b/Sofa/Component/LinearSolver/Direct/tests/SparseLDLSolver_test.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -58,7 +57,7 @@ TEST(SparseLDLSolver, EmptyMState) // required to be able to use EXPECT_MSG_NOEMIT and EXPECT_MSG_EMIT sofa::helper::logging::MessageDispatcher::addHandler(sofa::testing::MainGtestMessageHandler::getInstance() ) ; - const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root"); + const sofa::simulation::Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); const auto plugins = sofa::testing::makeScopedPlugin({ Sofa.Component.LinearSolver.Direct, @@ -87,7 +86,7 @@ TEST(SparseLDLSolver, TopologyChangeEmptyMState) // required to be able to use EXPECT_MSG_NOEMIT and EXPECT_MSG_EMIT sofa::helper::logging::MessageDispatcher::addHandler(sofa::testing::MainGtestMessageHandler::getInstance() ) ; - const sofa::simulation::Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph("root"); + const sofa::simulation::Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); const auto plugins = sofa::testing::makeScopedPlugin({ Sofa.Component.LinearSolver.Direct, diff --git a/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp b/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp index 2f923ea9221..0946247f300 100644 --- a/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp +++ b/Sofa/Component/Mapping/Linear/tests/BarycentricMapping_test.cpp @@ -38,9 +38,7 @@ using sofa::testing::BaseTest; using sofa::type::Vec3; using sofa::type::Vec3u; using sofa::core::objectmodel::New; - -#include -using sofa::simulation::graph::DAGSimulation; +#include using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; @@ -91,7 +89,7 @@ struct BarycentricMapperTriangleSetTopologyTest : public BaseTest, public Baryc } void scene_test(){ - sofa::simulation::Simulation* simu = sofa::simulation::getSimulation(); + sofa::simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); typename BarycentricMapping::SPtr thisObject = New>(); thisObject->setName("barycentricMapping"); diff --git a/Sofa/Component/Mapping/Linear/tests/DistanceToPlaneMapping_test.cpp b/Sofa/Component/Mapping/Linear/tests/DistanceToPlaneMapping_test.cpp index 85165f8a9bc..1a476f3804a 100644 --- a/Sofa/Component/Mapping/Linear/tests/DistanceToPlaneMapping_test.cpp +++ b/Sofa/Component/Mapping/Linear/tests/DistanceToPlaneMapping_test.cpp @@ -28,9 +28,8 @@ #include "sofa/core/MechanicalParams.h" using sofa::testing::BaseTest; - -#include -using sofa::simulation::graph::DAGSimulation; +#include +#include using sofa::simulation::Node ; using sofa::core::objectmodel::New ; using sofa::core::objectmodel::BaseData ; @@ -57,7 +56,7 @@ class PlaneMappingTest : public testing::Test { - sofa::simulation::Simulation* simu = sofa::simulation::getSimulation(); + sofa::simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); const Node::SPtr node = simu->createNewGraph("root"); diff --git a/Sofa/Component/Mapping/Linear/tests/SubsetMultiMapping_test.cpp b/Sofa/Component/Mapping/Linear/tests/SubsetMultiMapping_test.cpp index b9fec71addd..d45ea0f4636 100644 --- a/Sofa/Component/Mapping/Linear/tests/SubsetMultiMapping_test.cpp +++ b/Sofa/Component/Mapping/Linear/tests/SubsetMultiMapping_test.cpp @@ -19,7 +19,6 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include #include #include #include diff --git a/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp b/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp index d18e3bbf623..de9def1e8eb 100644 --- a/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp +++ b/Sofa/Component/Mapping/NonLinear/tests/RigidMapping_test.cpp @@ -22,7 +22,6 @@ #include using sofa::testing::BaseSimulationTest; -#include #include #include #include diff --git a/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp b/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp index f62537fceb7..7a7c29b290b 100644 --- a/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp +++ b/Sofa/Component/Mapping/NonLinear/tests/SquareDistanceMapping_test.cpp @@ -152,7 +152,7 @@ struct SquareDistanceMappingCompare_test : NumericTest void doSetUp() override { - root = simulation::getSimulation()->createNewNode("root"); + root = simulation::MainSimulation::getSimulation()->createNewNode("root"); simpleapi::createObject(root, "RequiredPlugin", {{"pluginName", Sofa.Component}}); simpleapi::createObject(root, "DefaultAnimationLoop"); diff --git a/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MappingTestCreation.h b/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MappingTestCreation.h index 2db177dc5fd..87a9f23eaca 100644 --- a/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MappingTestCreation.h +++ b/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MappingTestCreation.h @@ -33,7 +33,6 @@ using sofa::testing::NumericTest; #include #include -#include #include #include @@ -124,7 +123,7 @@ struct Mapping_test: public BaseSimulationTest, NumericTest(); root->addObject(inDofs); @@ -146,10 +145,10 @@ struct Mapping_test: public BaseSimulationTest, NumericTest #include #include -#include +#include #include #include @@ -118,7 +118,7 @@ struct Multi2Mapping_test : public BaseSimulationTest, NumericTestinit(root); + sofa::simulation::MainSimulation::getSimulation()->init(root); /// Apply the mapping // --- Use of the method apply diff --git a/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MultiMappingTestCreation.h b/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MultiMappingTestCreation.h index e7039a7b04a..6b1cbd357e8 100644 --- a/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MultiMappingTestCreation.h +++ b/Sofa/Component/Mapping/Testing/src/sofa/component/mapping/testing/MultiMappingTestCreation.h @@ -36,7 +36,6 @@ using sofa::testing::NumericTest; #include #include #include -#include #include #include @@ -93,7 +92,7 @@ struct MultiMapping_test : public BaseSimulationTest, NumericTestcreateNewGraph("root"); diff --git a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp index 6cc3205661f..37c5f1223a7 100644 --- a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp +++ b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp @@ -44,7 +44,6 @@ using sofa::core::ExecParams ; using sofa::simulation::Node ; #include -#include #include @@ -105,8 +104,8 @@ class DiagonalMass_test : public BaseTest Sofa.Component.Mass }); - simulation = simulation::getSimulation(); - root = simulation::getSimulation()->createNewGraph("root"); + simulation = simulation::MainSimulation::getSimulation(); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } void doTearDown() override diff --git a/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp b/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp index db3a4b26ca1..01548d0f40d 100644 --- a/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp +++ b/Sofa/Component/Mass/tests/MeshMatrixMass_test.cpp @@ -48,7 +48,7 @@ using sofa::testing::BaseSimulationTest; using sofa::simulation::Node ; #include -#include +#include #include @@ -108,8 +108,8 @@ class MeshMatrixMass_test : public BaseTest Sofa.Component.Mass }); - simulation = simulation::getSimulation(); - root = simulation::getSimulation()->createNewGraph("root"); + simulation = simulation::MainSimulation::getSimulation(); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } void doTearDown() override diff --git a/Sofa/Component/Mass/tests/UniformMass_test.cpp b/Sofa/Component/Mass/tests/UniformMass_test.cpp index b027671c1f5..4fbeea66b2e 100644 --- a/Sofa/Component/Mass/tests/UniformMass_test.cpp +++ b/Sofa/Component/Mass/tests/UniformMass_test.cpp @@ -30,10 +30,7 @@ using namespace sofa::defaulttype ; using sofa::component::mass::UniformMass ; #include - -#include using sofa::simulation::Simulation ; -using sofa::simulation::graph::DAGSimulation ; #include using sofa::simulation::Node; @@ -85,7 +82,7 @@ struct UniformMassTest : public BaseTest }); todo = true ; - m_simu = sofa::simulation::getSimulation(); + m_simu = sofa::simulation::MainSimulation::getSimulation(); m_root = m_simu->createNewGraph("root"); } diff --git a/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp b/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp index 601f3426ac4..4fb2402f162 100644 --- a/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp +++ b/Sofa/Component/MechanicalLoad/tests/ConstantForceField_test.cpp @@ -116,7 +116,7 @@ struct ConstantForceField_test : public BaseSimulationTest, NumericTestgetTreeObject(forcefield) ; ASSERT_NE(nullptr, forcefield) ; - Simulation* simulation = sofa::simulation::getSimulation() ; + Simulation* simulation = sofa::simulation::MainSimulation::getSimulation() ; ASSERT_NE(nullptr, simulation) ; Real xi = mechanicalobject->x.getValue()[0][0]; @@ -205,7 +205,7 @@ struct ConstantForceField_test : public BaseSimulationTest, NumericTestfindData(attrname) ) << "Missing attribute with name '" << attrname << "'." ; - Simulation* simulation = sofa::simulation::getSimulation() ; + Simulation* simulation = sofa::simulation::MainSimulation::getSimulation() ; ASSERT_NE(nullptr, simulation) ; for(int i=0; i<100; i++) { diff --git a/Sofa/Component/MechanicalLoad/tests/PlaneForceField_test.cpp b/Sofa/Component/MechanicalLoad/tests/PlaneForceField_test.cpp index 20eced1a952..584174d5ce5 100644 --- a/Sofa/Component/MechanicalLoad/tests/PlaneForceField_test.cpp +++ b/Sofa/Component/MechanicalLoad/tests/PlaneForceField_test.cpp @@ -23,9 +23,8 @@ #include using sofa::testing::BaseSimulationTest; -#include +#include using sofa::simulation::Simulation ; -using sofa::simulation::graph::DAGSimulation ; using sofa::simulation::Node ; using sofa::core::objectmodel::BaseObject ; using sofa::core::objectmodel::BaseData ; @@ -69,8 +68,6 @@ using sofa::component::linearsolver::GraphScatteredMatrix ; using sofa::component::linearsolver::GraphScatteredVector ; using sofa::component::linearsolver::iterative::CGLinearSolver ; -using sofa::simulation::graph::DAGSimulation ; - using sofa::component::mass::UniformMass ; using sofa::component::mechanicalload::PlaneForceField ; @@ -130,7 +127,7 @@ struct PlaneForceField_test : public BaseSimulationTest { if(m_simulation==nullptr){ BackTrace::autodump() ; - m_simulation = sofa::simulation::getSimulation(); + m_simulation = sofa::simulation::MainSimulation::getSimulation(); } /// Create the scene m_root = m_simulation->createNewGraph("root"); diff --git a/Sofa/Component/MechanicalLoad/tests/SkeletalMotionConstraint_test.cpp b/Sofa/Component/MechanicalLoad/tests/SkeletalMotionConstraint_test.cpp index b91c76a8d01..5609b005ebc 100644 --- a/Sofa/Component/MechanicalLoad/tests/SkeletalMotionConstraint_test.cpp +++ b/Sofa/Component/MechanicalLoad/tests/SkeletalMotionConstraint_test.cpp @@ -24,7 +24,7 @@ using sofa::testing::BaseSimulationTest; #include using sofa::testing::NumericTest; -#include +#include #include #include #include @@ -69,7 +69,7 @@ struct SkeletalMotionProjectiveConstraint_test : public BaseSimulationTest, Nume /// Create the context for the tests. void doSetUp() override { - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); /// Create the scene root = simulation->createNewGraph("root"); diff --git a/Sofa/Component/ODESolver/Backward/tests/EulerImplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/EulerImplicitSolverDynamic_test.cpp index d0a0fe377ee..78a745a8642 100644 --- a/Sofa/Component/ODESolver/Backward/tests/EulerImplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/EulerImplicitSolverDynamic_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; #include #include -#include #include typedef sofa::component::statecontainer::MechanicalObject MechanicalObject3; diff --git a/Sofa/Component/ODESolver/Backward/tests/NewmarkImplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/NewmarkImplicitSolverDynamic_test.cpp index 82922f25323..1e2918a9947 100644 --- a/Sofa/Component/ODESolver/Backward/tests/NewmarkImplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/NewmarkImplicitSolverDynamic_test.cpp @@ -28,7 +28,6 @@ using sofa::testing::NumericTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/ODESolver/Backward/tests/NewtonRaphsonSolver_test.cpp b/Sofa/Component/ODESolver/Backward/tests/NewtonRaphsonSolver_test.cpp index 50f258f044d..b6c996fc184 100644 --- a/Sofa/Component/ODESolver/Backward/tests/NewtonRaphsonSolver_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/NewtonRaphsonSolver_test.cpp @@ -32,7 +32,7 @@ struct NewtonRaphsonSquareRootTest : public testing::NumericTest { void doSetUp() override { - root = simulation::getSimulation()->createNewNode("root"); + root = simulation::MainSimulation::getSimulation()->createNewNode("root"); solver = core::objectmodel::New (); root->addObject(solver); diff --git a/Sofa/Component/ODESolver/Backward/tests/SpringSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/SpringSolverDynamic_test.cpp index 4a7ae8a587b..ffbb7c0d42b 100644 --- a/Sofa/Component/ODESolver/Backward/tests/SpringSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/SpringSolverDynamic_test.cpp @@ -24,7 +24,6 @@ using sofa::testing::NumericTest; //Including Simulation #include -#include #include // Including mechanical object @@ -63,8 +62,8 @@ struct SpringSolverDynamic_test : public NumericTest void doSetUp() override { // Init simulation - simulation = sofa::simulation::getSimulation(); - root = simulation::getSimulation()->createNewGraph("root"); + simulation = sofa::simulation::MainSimulation::getSimulation(); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } void loadScene(std::string sceneName) diff --git a/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp b/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp index 8a78b4dc8fd..9f6e67f2792 100644 --- a/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/StaticSolver_test.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -32,7 +31,6 @@ using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace sofa::helper::logging; -using sofa::simulation::graph::DAGSimulation; using sofa::component::odesolver::backward::StaticSolver; static constexpr SReal poissonRatio = 0; @@ -53,7 +51,7 @@ class StaticSolverTest : public sofa::testing::BaseTest public: void doSetUp() override { - root = getSimulation()->createNewNode("root"); + root = MainSimulation::getSimulation()->createNewNode("root"); this->loadPlugins({ Sofa.Component.Topology.Container.Grid, diff --git a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticExplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticExplicitSolverDynamic_test.cpp index d002cc9af83..c780fe1ab83 100644 --- a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticExplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticExplicitSolverDynamic_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverDynamic_test.cpp index e0c21b0c99b..fb56ac37d53 100644 --- a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverDynamic_test.cpp @@ -29,7 +29,6 @@ using sofa::testing::NumericTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverNonLinearForceDynamic_test.cpp b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverNonLinearForceDynamic_test.cpp index aa1234010e5..f5d96ea741e 100644 --- a/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverNonLinearForceDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Backward/tests/VariationalSymplecticImplicitSolverNonLinearForceDynamic_test.cpp @@ -28,7 +28,6 @@ using sofa::testing::NumericTest; //Including Simulation #include -#include #include // Including mechanical object @@ -102,8 +101,8 @@ struct VariationalSymplecticImplicitSolverNonLinearForceDynamic_test : public Ba void createScene(double g, double M, double m, double x0_x, double v0_y) { // Init simulation - assert(sofa::simulation::getSimulation()); - root = simulation::getSimulation()->createNewGraph("root"); + assert(sofa::simulation::MainSimulation::getSimulation()); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); // Create the scene root->setGravity(Coord(0,0,0)); @@ -160,7 +159,7 @@ struct VariationalSymplecticImplicitSolverNonLinearForceDynamic_test : public Ba int i = 0; // Init simulation - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::MainSimulation::getSimulation()->init(root.get()); double time = root->getTime(); // Get mechanical object @@ -198,7 +197,7 @@ struct VariationalSymplecticImplicitSolverNonLinearForceDynamic_test : public Ba } //Animate - sofa::simulation::getSimulation()->animate(root.get(),h); + sofa::simulation::MainSimulation::getSimulation()->animate(root.get(),h); time = root->getTime(); // Check energy is constant when there is no damping diff --git a/Sofa/Component/ODESolver/Forward/tests/CentralDifferenceExplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Forward/tests/CentralDifferenceExplicitSolverDynamic_test.cpp index d285140199c..95d9f7c3711 100644 --- a/Sofa/Component/ODESolver/Forward/tests/CentralDifferenceExplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Forward/tests/CentralDifferenceExplicitSolverDynamic_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; //Including Simulation #include -#include #include #include diff --git a/Sofa/Component/ODESolver/Forward/tests/EulerExplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Forward/tests/EulerExplicitSolverDynamic_test.cpp index f6a13eb435f..397f96a9cb8 100644 --- a/Sofa/Component/ODESolver/Forward/tests/EulerExplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Forward/tests/EulerExplicitSolverDynamic_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/ODESolver/Forward/tests/RungeKutta2ExplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Forward/tests/RungeKutta2ExplicitSolverDynamic_test.cpp index 683e546b8fa..a4cd48fddae 100644 --- a/Sofa/Component/ODESolver/Forward/tests/RungeKutta2ExplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Forward/tests/RungeKutta2ExplicitSolverDynamic_test.cpp @@ -28,7 +28,6 @@ using sofa::testing::NumericTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/ODESolver/Forward/tests/RungeKutta4ExplicitSolverDynamic_test.cpp b/Sofa/Component/ODESolver/Forward/tests/RungeKutta4ExplicitSolverDynamic_test.cpp index eddbfaa0338..d5cf5567ba7 100644 --- a/Sofa/Component/ODESolver/Forward/tests/RungeKutta4ExplicitSolverDynamic_test.cpp +++ b/Sofa/Component/ODESolver/Forward/tests/RungeKutta4ExplicitSolverDynamic_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; //Including Simulation #include -#include #include // Including mechanical object diff --git a/Sofa/Component/Playback/tests/WriteState_test.cpp b/Sofa/Component/Playback/tests/WriteState_test.cpp index d0b92f7f4e8..890b45e644c 100644 --- a/Sofa/Component/Playback/tests/WriteState_test.cpp +++ b/Sofa/Component/Playback/tests/WriteState_test.cpp @@ -27,8 +27,6 @@ #include using sofa::testing::BaseSimulationTest; -#include - #include #include #include @@ -74,7 +72,7 @@ namespace sofa { void doSetUp() override { // Init simulation - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } // Create the scene and the components diff --git a/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp b/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp index 6237b5d6e44..a0534ba0ee9 100644 --- a/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp +++ b/Sofa/Component/SceneUtility/tests/AddResourceRepository_test.cpp @@ -26,7 +26,6 @@ using sofa::testing::BaseSimulationTest; #include #include -#include #include #include diff --git a/Sofa/Component/SceneUtility/tests/MessageHandlerComponent_test.cpp b/Sofa/Component/SceneUtility/tests/MessageHandlerComponent_test.cpp index 94b69d307c0..40ed35d0a29 100644 --- a/Sofa/Component/SceneUtility/tests/MessageHandlerComponent_test.cpp +++ b/Sofa/Component/SceneUtility/tests/MessageHandlerComponent_test.cpp @@ -27,9 +27,6 @@ using std::string ; #include #include -#include -using sofa::simulation::graph::DAGSimulation ; - #include using sofa::simulation::Node ; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h index f19c9d27127..12246e76d00 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h @@ -66,7 +66,7 @@ class BaseTetrahedronFEMForceField_test : public sofa::testing::BaseTest void doSetUp() override { - m_simulation = sofa::simulation::getSimulation(); + m_simulation = sofa::simulation::MainSimulation::getSimulation(); } void doTearDown() override diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp index 6b3fbb27ab3..f0a80bcc58c 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BeamFEMForceField_test.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -68,7 +67,7 @@ class BeamFEMForceField_test : public BaseTest void doSetUp() override { - m_simulation = sofa::simulation::getSimulation(); + m_simulation = sofa::simulation::MainSimulation::getSimulation(); } void doTearDown() override diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp index b50b8bfc479..f23a34ede30 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/TriangleFEMForceField_test.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -81,7 +80,7 @@ class TriangleFEMForceField_test : public BaseTest void doSetUp() override { - m_simulation = sofa::simulation::getSimulation(); + m_simulation = sofa::simulation::MainSimulation::getSimulation(); } void doTearDown() override diff --git a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp index 45ef2c8a21b..eafb7026116 100644 --- a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_params_test.cpp @@ -19,7 +19,6 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include #include using sofa::testing::BaseSimulationTest; @@ -84,7 +83,7 @@ struct TetrahedronHyperelasticityFEMForceField_params_test : public BaseSimulati { timeStep = 0.02; - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); /// Load the scene root = simu->createNewGraph("root"); diff --git a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp index 5fa2c6b37e2..8b15ebe3823 100644 --- a/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp +++ b/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/TetrahedronHyperelasticityFEMForceField_scene_test.cpp @@ -19,7 +19,6 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include #include using sofa::testing::BaseSimulationTest; @@ -93,7 +92,7 @@ struct TetrahedronHyperelasticityFEMForceField_scene_test : public BaseSimulatio // Simulation gives a slightly different reference: refY[0] = -0.106832; - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); /// Load the scene root = simu->createNewGraph("root"); diff --git a/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp b/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp index fef5f82a243..d7b7d0a29bc 100644 --- a/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp +++ b/Sofa/Component/SolidMechanics/Spring/tests/TriangularBendingSprings_test.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include using sofa::simulation::Node; @@ -69,7 +68,7 @@ class TriangularBendingSprings_test : public BaseTest void doSetUp() override { - m_simulation = sofa::simulation::getSimulation(); + m_simulation = sofa::simulation::MainSimulation::getSimulation(); this->loadPlugins({ Sofa.Component.Topology.Container.Dynamic, Sofa.Component.Topology.Container.Grid diff --git a/Sofa/Component/SolidMechanics/Testing/src/sofa/component/solidmechanics/testing/ForceFieldTestCreation.h b/Sofa/Component/SolidMechanics/Testing/src/sofa/component/solidmechanics/testing/ForceFieldTestCreation.h index fedceca6fa5..0b0f336fe01 100644 --- a/Sofa/Component/SolidMechanics/Testing/src/sofa/component/solidmechanics/testing/ForceFieldTestCreation.h +++ b/Sofa/Component/SolidMechanics/Testing/src/sofa/component/solidmechanics/testing/ForceFieldTestCreation.h @@ -107,7 +107,7 @@ struct ForceField_test : public sofa::testing::BaseSimulationTest, public sofa:: , flags( TEST_ALL ) { using modeling::addNew; - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); assert(simu); /// node 1 @@ -128,7 +128,7 @@ struct ForceField_test : public sofa::testing::BaseSimulationTest, public sofa:: , flags( TEST_ALL ) { using modeling::addNew; - simulation::Simulation* simu = sofa::simulation::getSimulation(); + simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); assert(simu); /// Load the scene diff --git a/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp b/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp index baa7a16efde..009c75840e5 100644 --- a/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp +++ b/Sofa/Component/SolidMechanics/simutests/AffinePatch_test.cpp @@ -26,7 +26,6 @@ //Including Simulation #include -#include #include // Including constraint, force and mass @@ -83,9 +82,9 @@ struct AffinePatch_sofa_test : public sofa::testing::BaseSimulationTest, sofa::t void doSetUp() override { // Init simulation - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } diff --git a/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp b/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp index 7ea797b36b2..78a48598b4f 100644 --- a/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp +++ b/Sofa/Component/SolidMechanics/simutests/LinearElasticity_test.cpp @@ -26,8 +26,6 @@ #include //Including Simulation -#include - #include #include #include @@ -81,7 +79,7 @@ CylinderTractionStruct createCylinderTractionScene( CylinderTractionStruct tractionStruct; // Root node - root = sofa::simulation::getSimulation()->createNewGraph("root"); + root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); tractionStruct.root=root; root->setGravity( Coord(0,0,0) ); @@ -201,7 +199,7 @@ struct LinearElasticity_test : public sofa::testing::BaseSimulationTest, sofa::t void doSetUp() override { // Init simulation - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); const size_t resolutionCircumferential=7; const size_t resolutionRadial=3; const size_t resolutionHeight=7; diff --git a/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp b/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp index c172e8c740e..7a904016d2d 100644 --- a/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/tests/TetrahedronNumericalIntegration_test.cpp @@ -22,7 +22,6 @@ //Including Simulation #include -#include #include // Including constraint, force and mass #include @@ -66,9 +65,9 @@ struct TetrahedronNumericalIntegration_test : public NumericTestcreateNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } // create the TetrahedronSetGeometryAlgorithms object void createScene() diff --git a/Sofa/Component/Topology/Container/Dynamic/tests/TriangleNumericalIntegration_test.cpp b/Sofa/Component/Topology/Container/Dynamic/tests/TriangleNumericalIntegration_test.cpp index 4fb6f1a330e..c876dc77d32 100644 --- a/Sofa/Component/Topology/Container/Dynamic/tests/TriangleNumericalIntegration_test.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/tests/TriangleNumericalIntegration_test.cpp @@ -22,7 +22,6 @@ //Including Simulation #include -#include #include // Including constraint, force and mass #include @@ -67,9 +66,9 @@ struct TriangleNumericalIntegration_test : public NumericTestcreateNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); } // create the TriangleSetGeometryAlgorithms object void createScene() diff --git a/Sofa/Component/Topology/Testing/CMakeLists.txt b/Sofa/Component/Topology/Testing/CMakeLists.txt index e152bf73d1e..ef9557686d7 100644 --- a/Sofa/Component/Topology/Testing/CMakeLists.txt +++ b/Sofa/Component/Topology/Testing/CMakeLists.txt @@ -17,4 +17,4 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_compile_definitions(${PROJECT_NAME} PUBLIC "-DSOFA_COMPONENT_TOPOLOGY_TESTING_RESOURCES_DIR=\"${CMAKE_SOURCE_DIR}/share\"") target_include_directories(${PROJECT_NAME} PUBLIC src/) -target_link_libraries(${PROJECT_NAME} Sofa.Config Sofa.Simulation.Graph) +target_link_libraries(${PROJECT_NAME} Sofa.Config Sofa.Simulation.Common) diff --git a/Sofa/GL/Component/Rendering2D/tests/ClipPlane_test.cpp b/Sofa/GL/Component/Rendering2D/tests/ClipPlane_test.cpp index 7b8aa2baa1d..e656f5a2303 100644 --- a/Sofa/GL/Component/Rendering2D/tests/ClipPlane_test.cpp +++ b/Sofa/GL/Component/Rendering2D/tests/ClipPlane_test.cpp @@ -31,9 +31,8 @@ using sofa::testing::BaseTest; #include using sofa::core::objectmodel::BaseObject ; -#include +#include using sofa::simulation::Simulation ; -using sofa::simulation::graph::DAGSimulation ; #include using sofa::simulation::Node ; @@ -67,7 +66,7 @@ class TestClipPlane : public BaseTest { public: void SetUp() override { - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); } void checkClipPlaneValidAttributes(); @@ -103,8 +102,8 @@ void TestClipPlane::checkClipPlaneValidAttributes() for(auto& attrname : attrnames) EXPECT_NE( clp->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; - sofa::simulation::getSimulation()->unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->unload(root); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } @@ -130,8 +129,8 @@ void TestClipPlane::checkClipPlaneAttributesValues(const std::string& dataname, BaseObject* clp = root->getTreeNode("Level 1")->getObject("clipplane") ; ASSERT_NE(clp, nullptr) ; - sofa::simulation::getSimulation()->unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->unload(root); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } TEST_F(TestClipPlane, checkClipPlaneIdInValidValues) diff --git a/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp b/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp index 615196a39ee..a6cf39cca5d 100644 --- a/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp +++ b/Sofa/GL/Component/Rendering2D/tests/OglLabel_test.cpp @@ -31,9 +31,8 @@ using sofa::testing::BaseTest; #include using sofa::core::objectmodel::BaseObject ; -#include +#include using sofa::simulation::Simulation ; -using sofa::simulation::graph::DAGSimulation ; #include using sofa::simulation::Node ; @@ -87,7 +86,7 @@ class OglLabelTest : public BaseTest EXPECT_EQ(RGBAColor::fromFloat(1,1,1,1), ogllabel->d_color.getValue()) ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } @@ -117,7 +116,7 @@ class OglLabelTest : public BaseTest EXPECT_EQ(RGBAColor::fromFloat(1,1,1,1), ogllabel->d_color.getValue()) ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } void checkAttributes() @@ -146,7 +145,7 @@ class OglLabelTest : public BaseTest EXPECT_NE( lm->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } }; diff --git a/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp b/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp index 60e52caf497..4ff69f13119 100644 --- a/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp +++ b/Sofa/GL/Component/Rendering3D/tests/ClipPlane_test.cpp @@ -31,9 +31,8 @@ using sofa::testing::BaseTest; #include using sofa::core::objectmodel::BaseObject ; -#include +#include using sofa::simulation::Simulation ; -using sofa::simulation::graph::DAGSimulation ; #include using sofa::simulation::Node ; @@ -100,7 +99,7 @@ void TestClipPlane::checkClipPlaneValidAttributes() EXPECT_NE( clp->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } @@ -125,7 +124,7 @@ void TestClipPlane::checkClipPlaneAttributesValues(const std::string& dataname, ASSERT_NE(clp, nullptr) ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } TEST_F(TestClipPlane, checkClipPlaneIdInValidValues) diff --git a/Sofa/GL/Component/Rendering3D/tests/OglModel_test.cpp b/Sofa/GL/Component/Rendering3D/tests/OglModel_test.cpp index 8b126c1f447..50dc26040c5 100644 --- a/Sofa/GL/Component/Rendering3D/tests/OglModel_test.cpp +++ b/Sofa/GL/Component/Rendering3D/tests/OglModel_test.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -43,7 +43,7 @@ TEST(OglModel, templateName) helper::logging::MessageDispatcher::addHandler( sofa::testing::MainGtestMessageHandler::getInstance() ); - simulation::Simulation* simulation = sofa::simulation::getSimulation(); + simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); const simulation::Node::SPtr root = simulation->createNewGraph("root"); const auto plugins = testing::makeScopedPlugin({Sofa.GL.Component.Rendering3D}); diff --git a/Sofa/GL/Component/Shader/tests/LightManager_test.cpp b/Sofa/GL/Component/Shader/tests/LightManager_test.cpp index e7e4d16039c..e39dc488484 100644 --- a/Sofa/GL/Component/Shader/tests/LightManager_test.cpp +++ b/Sofa/GL/Component/Shader/tests/LightManager_test.cpp @@ -31,8 +31,8 @@ using sofa::testing::BaseTest; #include using sofa::core::objectmodel::BaseObject ; -#include -using sofa::simulation::graph::DAGSimulation ; +#include +using sofa::simulation::Simulation ; #include using sofa::simulation::Node ; @@ -90,7 +90,7 @@ void checkAttributes() EXPECT_NE( lm->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } diff --git a/Sofa/GL/Component/Shader/tests/Light_test.cpp b/Sofa/GL/Component/Shader/tests/Light_test.cpp index 3f0cbccbfb4..dc3623d2bcd 100644 --- a/Sofa/GL/Component/Shader/tests/Light_test.cpp +++ b/Sofa/GL/Component/Shader/tests/Light_test.cpp @@ -31,8 +31,8 @@ using sofa::testing::BaseTest; #include using sofa::core::objectmodel::BaseObject ; -#include -using sofa::simulation::graph::DAGSimulation ; +#include +using sofa::simulation::Simulation ; #include using sofa::simulation::Node ; @@ -105,7 +105,7 @@ void TestLight::checkLightMissingLightManager(const std::string& lighttype) ASSERT_NE(lm, nullptr) ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } void TestLight::checkPositionalLightValidAttributes() @@ -146,7 +146,7 @@ void TestLight::checkPositionalLightValidAttributes() EXPECT_NE( light->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } void TestLight::checkDirectionalLightValidAttributes() @@ -187,7 +187,7 @@ void TestLight::checkDirectionalLightValidAttributes() EXPECT_NE( light->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } void TestLight::checkSpotLightValidAttributes() @@ -232,7 +232,7 @@ void TestLight::checkSpotLightValidAttributes() EXPECT_NE( light->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ; sofa::simulation::node::unload(root); - sofa::simulation::getSimulation()->createNewGraph(""); + sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); } diff --git a/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp b/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp index 774e6cee16d..3be47691c00 100644 --- a/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp +++ b/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp @@ -463,7 +463,7 @@ BodyPicked PickHandler::findCollisionUsingBruteForce(const type::Vec3& origin, // Look for particles hit by this ray // msg_info()<<"PickHandler::findCollisionUsingBruteForce" << std::endl; MechanicalPickParticlesVisitor picker(sofa::core::execparams::defaultInstance(), origin, direction, maxLength, 0 ); - //core::objectmodel::BaseNode* rootNode = mouseNode->getRoot(); //sofa::simulation::getSimulation()->getContext()->toBaseNode(); + //core::objectmodel::BaseNode* rootNode = mouseNode->getRoot(); //sofa::simulation::MainSimulation::getSimulation()->getContext()->toBaseNode(); if (rootNode) picker.execute(rootNode->getContext()); else diff --git a/Sofa/GUI/Component/src/sofa/gui/component/performer/FixParticlePerformer.inl b/Sofa/GUI/Component/src/sofa/gui/component/performer/FixParticlePerformer.inl index 698323e6a7e..fbdb08f4b25 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/performer/FixParticlePerformer.inl +++ b/Sofa/GUI/Component/src/sofa/gui/component/performer/FixParticlePerformer.inl @@ -94,7 +94,7 @@ void FixParticlePerformer::draw(const core::visual::VisualParams* /*v // bool b = vparams->displayFlags().getShowBehaviorModels(); // core::visual::DisplayFlags* flags = const_cast(&vparams->displayFlags()); // flags->setShowBehaviorModels(true); -// simulation::getSimulation()->draw(const_cast(vparams),fixations[i]); +// simulation::MainSimulation::getSimulation()->draw(const_cast(vparams),fixations[i]); // flags->setShowBehaviorModels(b); // } } diff --git a/Sofa/framework/Core/src/sofa/core/visual/BaseVisualStyle.h b/Sofa/framework/Core/src/sofa/core/visual/BaseVisualStyle.h index a96702893ef..0b38da65b5f 100644 --- a/Sofa/framework/Core/src/sofa/core/visual/BaseVisualStyle.h +++ b/Sofa/framework/Core/src/sofa/core/visual/BaseVisualStyle.h @@ -47,5 +47,4 @@ class SOFA_CORE_API BaseVisualStyle : public sofa::core::objectmodel::BaseCompon }; -} // namespace sofa::simulation::graph - +} // namespace sofa::core::visual diff --git a/Sofa/framework/DefaultType/test/QuaternionIntegration_test.cpp b/Sofa/framework/DefaultType/test/QuaternionIntegration_test.cpp index 34c8e03fff0..a6049f00f74 100644 --- a/Sofa/framework/DefaultType/test/QuaternionIntegration_test.cpp +++ b/Sofa/framework/DefaultType/test/QuaternionIntegration_test.cpp @@ -22,11 +22,9 @@ #include using sofa::testing::NumericTest; -#include #include #include - namespace sofa { namespace { diff --git a/Sofa/framework/Framework/CMakeLists.txt b/Sofa/framework/Framework/CMakeLists.txt index eed47bb88e1..fa83520f170 100644 --- a/Sofa/framework/Framework/CMakeLists.txt +++ b/Sofa/framework/Framework/CMakeLists.txt @@ -3,7 +3,7 @@ project(Sofa.Framework LANGUAGES CXX) set(SOFAFRAMEWORK_SOURCE_DIR "src/sofa/framework") -set(SOFAFRAMEWORK_MODULES Sofa.Config Sofa.Type Sofa.Geometry Sofa.Topology Sofa.Helper Sofa.LinearAlgebra Sofa.DefaultType Sofa.Core Sofa.Simulation.Core Sofa.Simulation.Common Sofa.Simulation.Graph Sofa.Testing) +set(SOFAFRAMEWORK_MODULES Sofa.Config Sofa.Type Sofa.Geometry Sofa.Topology Sofa.Helper Sofa.LinearAlgebra Sofa.DefaultType Sofa.Core Sofa.Simulation.Core Sofa.Simulation.Common Sofa.Testing) foreach(framework_module ${SOFAFRAMEWORK_MODULES}) sofa_find_package(${framework_module} REQUIRED) endforeach() diff --git a/Sofa/framework/Helper/src/sofa/helper/init.h b/Sofa/framework/Helper/src/sofa/helper/init.h index f38a64043ed..a4e2b275714 100644 --- a/Sofa/framework/Helper/src/sofa/helper/init.h +++ b/Sofa/framework/Helper/src/sofa/helper/init.h @@ -44,7 +44,6 @@ namespace sofa::helper // └──sofa::type::init() // SofaDefaultType // └──sofa::core::init() // SofaCore // └──sofa::simulation::common::init() // SofaSimulationCommon -// └──sofa::simulation::graph::init() // SofaSimulationGraph // // For example: // diff --git a/Sofa/framework/SimpleApi/CMakeLists.txt b/Sofa/framework/SimpleApi/CMakeLists.txt index 7b8950d7b17..97a673d175b 100644 --- a/Sofa/framework/SimpleApi/CMakeLists.txt +++ b/Sofa/framework/SimpleApi/CMakeLists.txt @@ -14,10 +14,10 @@ set(SOURCE_FILES ${SOFASIMPLEAPI_SRC}/SimpleApi.cpp ) -sofa_find_package(Sofa.Simulation.Graph REQUIRED) +sofa_find_package(Sofa.Simulation.Common REQUIRED) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Graph) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Common) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder diff --git a/Sofa/framework/SimpleApi/Sofa.SimpleApiConfig.cmake.in b/Sofa/framework/SimpleApi/Sofa.SimpleApiConfig.cmake.in index 67073dba6a6..1039e7169de 100644 --- a/Sofa/framework/SimpleApi/Sofa.SimpleApiConfig.cmake.in +++ b/Sofa/framework/SimpleApi/Sofa.SimpleApiConfig.cmake.in @@ -4,7 +4,7 @@ @PACKAGE_INIT@ find_package(Sofa.Config QUIET REQUIRED) -sofa_find_package(Sofa.Simulation.Graph QUIET REQUIRED) +sofa_find_package(Sofa.Simulation.Common QUIET REQUIRED) if(NOT TARGET @PROJECT_NAME@) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/Sofa/framework/SimpleApi/src/sofa/simpleapi/SimpleApi.cpp b/Sofa/framework/SimpleApi/src/sofa/simpleapi/SimpleApi.cpp index 4b865e1a3d6..44b3593b5c8 100644 --- a/Sofa/framework/SimpleApi/src/sofa/simpleapi/SimpleApi.cpp +++ b/Sofa/framework/SimpleApi/src/sofa/simpleapi/SimpleApi.cpp @@ -26,8 +26,8 @@ #include using sofa::core::ObjectFactory ; -#include -using sofa::simulation::graph::DAGSimulation ; +#include +using sofa::simulation::Simulation ; #include using sofa::simulation::Node; @@ -68,7 +68,7 @@ Simulation::SPtr createSimulation(const std::string& type) return nullptr ; } - return std::make_shared(); + return std::make_shared(); } diff --git a/Sofa/framework/SimpleApi/src/sofa/simpleapi/init.cpp b/Sofa/framework/SimpleApi/src/sofa/simpleapi/init.cpp index e9b0e906913..f0535b1d425 100644 --- a/Sofa/framework/SimpleApi/src/sofa/simpleapi/init.cpp +++ b/Sofa/framework/SimpleApi/src/sofa/simpleapi/init.cpp @@ -20,8 +20,6 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include - -#include #include namespace sofa::simpleapi @@ -34,7 +32,6 @@ SOFA_SIMPLEAPI_API void init() { if (!s_initialized) { - sofa::simulation::graph::init(); s_initialized = true; } } @@ -48,7 +45,6 @@ SOFA_SIMPLEAPI_API void cleanup() { if (!s_cleanedUp) { - sofa::simulation::graph::cleanup(); s_cleanedUp = true; } } diff --git a/Sofa/framework/SimpleApi/test/CMakeLists.txt b/Sofa/framework/SimpleApi/test/CMakeLists.txt index 8eee1832cc8..12b072a3fe8 100644 --- a/Sofa/framework/SimpleApi/test/CMakeLists.txt +++ b/Sofa/framework/SimpleApi/test/CMakeLists.txt @@ -6,6 +6,6 @@ set(SOURCE_FILES ) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} Sofa.Testing Sofa.Simulation.Graph) +target_link_libraries(${PROJECT_NAME} Sofa.Testing Sofa.Simulation) add_test(Name ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) diff --git a/Sofa/framework/Simulation/Common/test/LoadScene_test.cpp b/Sofa/framework/Simulation/Common/test/LoadScene_test.cpp index 11fcbfe90e4..cec44fdeed4 100644 --- a/Sofa/framework/Simulation/Common/test/LoadScene_test.cpp +++ b/Sofa/framework/Simulation/Common/test/LoadScene_test.cpp @@ -23,7 +23,6 @@ using sofa::testing::BaseTest; #include -#include #include #include #include diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.cpp index 138156326a4..0039a38d644 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.cpp @@ -33,7 +33,7 @@ #include #include -namespace sofa::simulation::graph +namespace sofa::simulation { ExportDotVisitor::ExportDotVisitor(const sofa::core::ExecParams* params, std::ostream* out) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.h index 4f2cb0f3bad..31c640dff47 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/ExportDotVisitor.h @@ -26,7 +26,7 @@ #include -namespace sofa::simulation::graph +namespace sofa::simulation { /** @@ -99,5 +99,5 @@ class SOFA_SIMULATION_CORE_API ExportDotVisitor : public sofa::simulation::Visit }; -} // namespace sofa::simulation::graph +} // namespace sofa::simulation diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.cpp index 11a9c821a38..c4ee93c7716 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.cpp @@ -1083,12 +1083,12 @@ class GetUpObjectsVisitor : public Visitor GetUpObjectsVisitor(Node* searchNode, const sofa::core::objectmodel::ClassInfo& class_info, Node::GetObjectsCallBack& container, const sofa::core::objectmodel::TagSet& tags); ~GetUpObjectsVisitor() override; - Result processNodeTopDown(simulation::Node* node) override + Result processNodeTopDown(simulation::Node* basenode) override { - const Node* dagnode = dynamic_cast(node); - if( dagnode->_descendancy.contains(_searchNode) ) // searchNode is in the current node descendancy, so the current node is a parent of searchNode + const Node* node = dynamic_cast(basenode); + if( node->_descendancy.contains(_searchNode) ) // searchNode is in the current node descendancy, so the current node is a parent of searchNode { - dagnode->getLocalObjects( _class_info, _container, _tags ); + node->getLocalObjects( _class_info, _container, _tags ); return RESULT_CONTINUE; } else // the current node is NOT a parent of searchNode, stop here @@ -1170,8 +1170,8 @@ Node::SPtr Node::createChild(const std::string& nodeName) void Node::moveChild(BaseNode::SPtr node) { - const Node::SPtr dagnode = sofa::core::objectmodel::SPtr_static_cast(node); - for (const auto& parent : dagnode->getParents()) { + const Node::SPtr nnode = sofa::core::objectmodel::SPtr_static_cast(node); + for (const auto& parent : nnode->getParents()) { Node::moveChild(node, parent); } } diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.inl b/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.inl index 14cf15f7a1c..c819969daf1 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.inl +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Node.inl @@ -29,7 +29,7 @@ namespace sofa::simulation template Node::SPtr Node::create( RealObject*, sofa::core::objectmodel::BaseObjectDescription* arg) { - if (Simulation* simulation = getSimulation()) + if (Simulation* simulation = MainSimulation::getSimulation()) { Node::SPtr obj = simulation->createNewNode(arg->getName()); obj->parse(arg); diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.cpp index cfade426869..eac16077fee 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.cpp @@ -1,24 +1,24 @@ /****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ + * SOFA, Simulation Open-Framework Architecture * + * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * + * * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as published by * + * the Free Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, but WITHOUT * + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * + * for more details. * + * * + * You should have received a copy of the GNU Lesser General Public License * + * along with this program. If not, see . * + ******************************************************************************* + * Authors: The SOFA Team and external contributors (see Authors.txt) * + * * + * Contact information: contact@sofa-framework.org * + ******************************************************************************/ #include #include #include @@ -91,9 +91,9 @@ void initRoot(Node* root) if (!root->getAnimationLoop()) { msg_warning(root) << "An animation loop is required, but has not been found. Add an animation loop in the root " - "of your scene to fix this warning. The list of available animation loop components is: [" - << sofa::core::ObjectFactory::getInstance()->listClassesDerivedFrom() - << "]. A component of type " << DefaultAnimationLoop::GetClass()->className << " will be automatically added for you."; + "of your scene to fix this warning. The list of available animation loop components is: [" + << sofa::core::ObjectFactory::getInstance()->listClassesDerivedFrom() + << "]. A component of type " << DefaultAnimationLoop::GetClass()->className << " will be automatically added for you."; const DefaultAnimationLoop::SPtr aloop = sofa::core::objectmodel::New(); @@ -104,23 +104,23 @@ void initRoot(Node* root) if (!root->getVisualLoop()) { msg_info(root) << "A visual loop is required, but has not been found. Add a visual loop in the root " - "of your scene to fix this warning. The list of available visual loop components is: [" - << sofa::core::ObjectFactory::getInstance()->listClassesDerivedFrom() - << "]. A component of type " << DefaultVisualManagerLoop::GetClass()->className << " will be automatically added for you."; + "of your scene to fix this warning. The list of available visual loop components is: [" + << sofa::core::ObjectFactory::getInstance()->listClassesDerivedFrom() + << "]. A component of type " << DefaultVisualManagerLoop::GetClass()->className << " will be automatically added for you."; const DefaultVisualManagerLoop::SPtr vloop = sofa::core::objectmodel::New(); vloop->setName(root->getNameHelper().resolveName(vloop->getClassName(), sofa::core::ComponentNameHelper::Convention::python)); root->addObject(vloop, sofa::core::objectmodel::TypeOfInsertion::AtBegin); } - // all the objects have now been created, update the links + // all the objects have now been created, update the links root->execute(params); init(root); root->execute(params); - // propagate the visualization settings (showVisualModels, etc.) in the whole graph + // propagate the visualization settings (showVisualModels, etc.) in the whole graph updateVisualContext(root); } @@ -136,8 +136,8 @@ void init(Node* node) PropagateEventVisitor pb{params, &beginInit}; node->execute(pb); - // apply the init() and bwdInit() methods to all the components. - // and put the VisualModels in a separate graph, rooted at getVisualRoot() + // apply the init() and bwdInit() methods to all the components. + // and put the VisualModels in a separate graph, rooted at getVisualRoot() node->execute(params); SimulationInitDoneEvent endInit; @@ -253,7 +253,7 @@ void reset(Node* root) const sofa::core::ExecParams* params = sofa::core::execparams::defaultInstance(); - // start by resetting the time + // start by resetting the time if (const sofa::core::behavior::BaseAnimationLoop* animLoop = root->getAnimationLoop()) { root->setTime(animLoop->getResetTime()); @@ -264,8 +264,8 @@ void reset(Node* root) } UpdateSimulationContextVisitor(sofa::core::execparams::defaultInstance()).execute(root); - // by definition cleanup() MUST only be called right before destroying the object - // if for some reason some components need to do something, it has to be done in reset or storeResetState + // by definition cleanup() MUST only be called right before destroying the object + // if for some reason some components need to do something, it has to be done in reset or storeResetState root->execute(params); const sofa::core::MechanicalParams mparams(*params); root->execute(&mparams); @@ -449,7 +449,7 @@ NodeSPtr load(const std::string& filename, bool reload, const std::vectordetachFromGraph(); root->execute(params); @@ -482,9 +482,25 @@ Simulation::Simulation() Simulation::~Simulation() {} -Simulation* getSimulation() + /// create a new graph(or tree) and return its root node. +NodeSPtr Simulation::createNewGraph(const std::string& name) { return createNewNode(name); } + + /// creates and returns a new node. +NodeSPtr Simulation::createNewNode(const std::string& name) { return sofa::core::objectmodel::New(name); } + + /// Can the simulation handle a directed acyclic graph? +bool Simulation::isDirectedAcyclicGraph() { return true; } + +void MainSimulation::setSimulation(Simulation::SPtr simulation) +{ + theSimulation = simulation; +} + +Simulation* MainSimulation::getSimulation() { - return Simulation::theSimulation.get(); + if(theSimulation.get()==nullptr) + theSimulation = std::make_shared(); + return theSimulation.get(); } } // namespace sofa::simulation diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.h index a6befd116e5..1e61b45f30c 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Simulation.h @@ -103,16 +103,26 @@ class SOFA_SIMULATION_CORE_API Simulation Simulation& operator=(const Simulation& n) = delete; /// create a new graph(or tree) and return its root node. - virtual NodeSPtr createNewGraph(const std::string& name)=0;//Todo replace newNode method + virtual NodeSPtr createNewGraph(const std::string& name); /// creates and returns a new node. - virtual NodeSPtr createNewNode(const std::string& name)=0; + virtual NodeSPtr createNewNode(const std::string& name); /// Can the simulation handle a directed acyclic graph? - virtual bool isDirectedAcyclicGraph() = 0; + virtual bool isDirectedAcyclicGraph(); +}; + +/// Singleton oriented API, if needed. +class SOFA_SIMULATION_CORE_API MainSimulation +{ + public: + static void setSimulation(Simulation::SPtr simulation); + static Simulation* getSimulation(); + private: inline static Simulation::SPtr theSimulation { nullptr }; }; + } // namespace sofa::simulation MSG_REGISTER_CLASS(sofa::simulation::Simulation, "Simulation") diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h index abb3e194285..b9a8a4b7b37 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h @@ -36,11 +36,6 @@ namespace sofa::simulation class Simulation; typedef sofa::core::sptr SimulationSPtr; - /** Get the (unique) simulation which controls the scene. - Automatically creates one if no Simulation has been set. - */ - SOFA_SIMULATION_CORE_API Simulation* getSimulation(); - class MutationListener; class Visitor; diff --git a/Sofa/framework/Simulation/Core/test/MappingGraph2_test.cpp b/Sofa/framework/Simulation/Core/test/MappingGraph2_test.cpp index 243187ce5b2..caabebe20c9 100644 --- a/Sofa/framework/Simulation/Core/test/MappingGraph2_test.cpp +++ b/Sofa/framework/Simulation/Core/test/MappingGraph2_test.cpp @@ -69,7 +69,7 @@ struct CollectNamesVisitor : public sofa::simulation::MappingGraphVisitor TEST(MappingGraph, SingleState) { - const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root"); + const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root"); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); sofa::simpleapi::createObject(root, "MechanicalObject", {{"name", "state"}}); @@ -88,7 +88,7 @@ TEST(MappingGraph, SingleState) TEST(MappingGraph, SingleMappingInSingleNode) { - const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root"); + const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root"); sofa::simpleapi::importPlugin(Sofa.Component.Mapping.Linear); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); @@ -121,7 +121,7 @@ TEST(MappingGraph, SingleMappingInSingleNode) TEST(MappingGraph, SingleMappingWithIntermediateNode) { - const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root"); + const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root"); sofa::simpleapi::importPlugin(Sofa.Component.Mapping.Linear); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); @@ -155,7 +155,7 @@ TEST(MappingGraph, SingleMappingWithIntermediateNode) TEST(MappingGraph, SingleMappingWithIntermediateNodeInverseInputOutput) { - const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root"); + const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root"); sofa::simpleapi::importPlugin(Sofa.Component.Mapping.Linear); sofa::simpleapi::importPlugin(Sofa.Component.StateContainer); @@ -200,7 +200,7 @@ auto setupComplexGraphEnvironment() -> std::paircreateChild("node1"); sofa::simpleapi::createObject(node1, "MechanicalObject", {{"name", "state1"}}); diff --git a/Sofa/framework/Simulation/Core/test/MappingGraph_test.cpp b/Sofa/framework/Simulation/Core/test/MappingGraph_test.cpp index 9ca599c1a67..2ca7595963f 100644 --- a/Sofa/framework/Simulation/Core/test/MappingGraph_test.cpp +++ b/Sofa/framework/Simulation/Core/test/MappingGraph_test.cpp @@ -27,7 +27,6 @@ #include #include #include -#include TEST(MappingGraph, noBuild) { @@ -166,7 +165,7 @@ TEST(MappingGraph, diamondMapping) // required to be able to use EXPECT_MSG_NOEMIT and EXPECT_MSG_EMIT sofa::helper::logging::MessageDispatcher::addHandler(sofa::testing::MainGtestMessageHandler::getInstance() ) ; - sofa::simulation::Simulation* simulation = sofa::simulation::getSimulation(); + sofa::simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); sofa::simulation::Node::SPtr root = simulation->createNewGraph("root"); EXPECT_EQ(root->getName(), "root"); diff --git a/Sofa/framework/Simulation/Core/test/Simulation_test.cpp b/Sofa/framework/Simulation/Core/test/Simulation_test.cpp index 7666a440fab..391eadf269a 100644 --- a/Sofa/framework/Simulation/Core/test/Simulation_test.cpp +++ b/Sofa/framework/Simulation/Core/test/Simulation_test.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include namespace sofa @@ -39,7 +38,7 @@ TEST(simulationLoad, existingFilename) constexpr std::string_view filename { "Demos/caduceus.scn" }; const std::string path = helper::system::DataRepository.getFile(std::string{filename}); - simulation::Simulation* simulation = sofa::simulation::getSimulation(); + simulation::Simulation* simulation = sofa::simulation::MainSimulation::getSimulation(); ASSERT_NE(simulation, nullptr); const simulation::Node::SPtr groot = sofa::simulation::node::load(path, false, {}); EXPECT_NE(groot, nullptr); @@ -55,7 +54,7 @@ TEST(simulationLoad, nonExistingFilename) constexpr std::string_view filename { "aFileThatDoesNotExist.scn" }; - simulation::Simulation* simulation = simulation::getSimulation(); + simulation::Simulation* simulation = simulation::MainSimulation::getSimulation(); ASSERT_NE(simulation, nullptr); const simulation::Node::SPtr groot = sofa::simulation::node::load(std::string{filename}, false, {}); EXPECT_EQ(groot, nullptr); diff --git a/Sofa/framework/Simulation/Core/test/Visitor_test.cpp b/Sofa/framework/Simulation/Core/test/Visitor_test.cpp index e3a2d2f703d..3954dc81256 100644 --- a/Sofa/framework/Simulation/Core/test/Visitor_test.cpp +++ b/Sofa/framework/Simulation/Core/test/Visitor_test.cpp @@ -137,7 +137,7 @@ class TestMapping : public core::BaseMapping sofa::simulation::Node::SPtr makeSceneGraph() { - const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::getSimulation(), "root"); + const sofa::simulation::Node::SPtr root = sofa::simpleapi::createRootNode(sofa::simulation::MainSimulation::getSimulation(), "root"); const auto ff_0 = sofa::core::objectmodel::New(); root->addObject(ff_0); diff --git a/Sofa/framework/Simulation/Graph/CMakeLists.txt b/Sofa/framework/Simulation/Graph/CMakeLists.txt index b3d07bd5a51..9e7f4bf0af5 100644 --- a/Sofa/framework/Simulation/Graph/CMakeLists.txt +++ b/Sofa/framework/Simulation/Graph/CMakeLists.txt @@ -14,8 +14,6 @@ set(HEADER_FILES set(SOURCE_FILES ${SOFASIMULATIONGRAPH_SRC}/init.cpp ${SOFASIMULATIONGRAPH_SRC}/initSofaSimulationGraph.cpp - ${SOFASIMULATIONGRAPH_SRC}/DAGNode.cpp - ${SOFASIMULATIONGRAPH_SRC}/DAGSimulation.cpp ) sofa_find_package(Sofa.Simulation.Common REQUIRED) diff --git a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp deleted file mode 100644 index 4507024ebd5..00000000000 --- a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#include -#include - -namespace sofa::simulation -{ - -//helper::Creator NodeDefaultClass("default"); -static helper::Creator NodeClass("Node"); - -} diff --git a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.h b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.h index 9410c83068d..c278fb5d54c 100644 --- a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.h +++ b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGNode.h @@ -23,5 +23,5 @@ #include #include -//header moved in the plugin SofaValidation -SOFA_HEADER_DISABLED("v25.12", "v26.06", "'sofa/simulation/Node.h' instead of 'sofa/simulation/Node.h' and replace uses of DAGNode with Node") +//header removed +SOFA_HEADER_DISABLED("v25.12", "v26.12", "'sofa/simulation/Node.h' instead of 'sofa/simulation/DAGNode.h' and replace uses of DAGNode with Node") diff --git a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.cpp b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.cpp deleted file mode 100644 index 853861fc0d8..00000000000 --- a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#include - -#include -#include -#include - -#include -#include -#include - -namespace sofa::simulation::graph -{ - -using namespace sofa::defaulttype; - - -DAGSimulation::DAGSimulation() -{ - // Safety check; it could be elsewhere, but here is a good place, I guess. - if (!sofa::simulation::graph::isInitialized()) - sofa::helper::printUninitializedLibraryWarning("Sofa.Simulation.Graph", "sofa::simulation::graph::init()"); -} - -DAGSimulation::~DAGSimulation() -{ - -} - -Node::SPtr DAGSimulation::createNewGraph(const std::string& name) -{ - return createNewNode( name ); -} - -Node::SPtr DAGSimulation::createNewNode(const std::string& name) -{ - return sofa::core::objectmodel::New(name); -} - -} // namespace sofa::simulation::graph diff --git a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.h b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.h index 00f00178a23..a20c3caadec 100644 --- a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.h +++ b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/DAGSimulation.h @@ -20,34 +20,17 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include #include -#include -#include - +#include +//header removed +SOFA_HEADER_DEPRECATED("v26.12", "v27.06", "'sofa/simulation/Simulation.h' instead of 'sofa/simulation/DAGSimulation.h' and replace uses of DAGSimulation with Simulation") namespace sofa::simulation::graph { +using DAGSimulation=Simulation; -/** Main controller of the scene. -Defines how the scene is inited at the beginning, and updated at each time step. -Derives from BaseObject in order to model the parameters as Datas, which makes their edition easy in the GUI. - */ -class SOFA_SIMULATION_GRAPH_API DAGSimulation: public Simulation -{ -public: - DAGSimulation(); - ~DAGSimulation() override; // this is a terminal class - - /// create a new graph(or tree) and return its root node. - virtual NodeSPtr createNewGraph(const std::string& name) override; - - /// creates and returns a new node. - virtual NodeSPtr createNewNode(const std::string& name) override; - - /// Can the simulation handle a directed acyclic graph? - bool isDirectedAcyclicGraph() override { return true; } -}; +Simulation* getSimulation(){ return MainSimulation::getSimulation(); } +void setSimulation(Simulation::SPtr simulation){ MainSimulation::setSimulation(simulation); } -} // namespace sofa::simulation::graph +} \ No newline at end of file diff --git a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/init.cpp b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/init.cpp index 4d1fa04597f..75167b1dab0 100644 --- a/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/init.cpp +++ b/Sofa/framework/Simulation/Graph/src/sofa/simulation/graph/init.cpp @@ -23,7 +23,6 @@ #include #include #include -#include namespace sofa::simulation::graph { @@ -37,7 +36,6 @@ SOFA_SIMULATION_GRAPH_API void init() { sofa::simulation::common::init(); s_initialized = true; - sofa::simulation::Simulation::theSimulation = std::make_shared(); } } diff --git a/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp b/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp index 707f4ae9827..915367a1747 100644 --- a/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp +++ b/Sofa/framework/Simulation/Graph/test/MutationListener_test.cpp @@ -22,7 +22,7 @@ #include using sofa::testing::BaseTest; -#include +#include #include #include #include @@ -411,7 +411,7 @@ struct MutationListener_test : public BaseTest void doSetUp() override { - sofa::simulation::Simulation* simu = sofa::simulation::getSimulation(); + sofa::simulation::Simulation* simu = sofa::simulation::MainSimulation::getSimulation(); root = simu->createNewGraph("root"); root->addListener(&listener); diff --git a/Sofa/framework/Simulation/Graph/test/Node_test.cpp b/Sofa/framework/Simulation/Graph/test/Node_test.cpp index 297961c1d5b..dd8c0c85bb0 100644 --- a/Sofa/framework/Simulation/Graph/test/Node_test.cpp +++ b/Sofa/framework/Simulation/Graph/test/Node_test.cpp @@ -429,7 +429,7 @@ struct DAG_test : public BaseTest } -// sofa::simulation::getSimulation()->print(node.get()); +// sofa::simulation::MainSimulation::getSimulation()->print(node.get()); } @@ -446,7 +446,7 @@ Expected output: RAABBR */ void traverse_simple_tree() { - const Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); root->setName("R"); root->createChild("A"); @@ -471,7 +471,7 @@ Expected output: RABCCBAR */ void traverse_simple_diamond() { - const Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); root->setName("R"); const Node::SPtr A = root->createChild("A"); @@ -500,7 +500,7 @@ Expected output: RABCDEEDCBAR */ void traverse_complex() { - const Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); root->setName("R"); const Node::SPtr A = root->createChild("A"); const Node::SPtr B = root->createChild("B"); @@ -528,7 +528,7 @@ Expected output: RABCDEEDCBAR */ void traverse_morecomplex() { - const Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); root->setName("R"); const Node::SPtr A = root->createChild("A"); const Node::SPtr B = root->createChild("B"); @@ -560,7 +560,7 @@ Expected output: RABCDEEDCBAR */ void traverse_morecomplex2() { - const Node::SPtr root = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); root->setName("R"); const Node::SPtr A = root->createChild("A"); const Node::SPtr B = root->createChild("B"); @@ -597,7 +597,7 @@ Expected output: RABCDEEDCBAR void getObject() { - const Node::SPtr A = sofa::simulation::getSimulation()->createNewGraph(""); + const Node::SPtr A = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); A->setName("A"); const Node::SPtr B = A->createChild("B"); diff --git a/Sofa/framework/Simulation/Graph/test/Simulation_test.cpp b/Sofa/framework/Simulation/Graph/test/Simulation_test.cpp index 8fad0b75081..92d6dd62e15 100644 --- a/Sofa/framework/Simulation/Graph/test/Simulation_test.cpp +++ b/Sofa/framework/Simulation/Graph/test/Simulation_test.cpp @@ -28,7 +28,7 @@ using sofa::defaulttype::Vec3Types ; #include typedef sofa::component::statecontainer::MechanicalObject MechanicalObject3; -#include +#include #include #include #include @@ -71,14 +71,14 @@ struct Scene_test: public NumericTest Scene_test() { - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); } /// Test Simulation::computeBBox void computeBBox() { // Init Sofa - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); // create DOFs and its expected bounding box const MechanicalObject3::SPtr DOF = core::objectmodel::New(); @@ -163,7 +163,7 @@ struct Scene_test: public NumericTest /// create a scene, remove a node then step the scene void objectDestruction_subNodeAndStep() { - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); root->addObject(core::objectmodel::New()); core::objectmodel::BaseNode* child = root->createChild("child").get(); @@ -193,7 +193,7 @@ struct Scene_test: public NumericTest void sceneDestruction_createnewgraph() { createScene(); - root = simulation::getSimulation()->createNewGraph("root2"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root2"); checkDeletions(); } @@ -220,14 +220,14 @@ struct Scene_test: public NumericTest objectCounter = 0; - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); root->addObject(core::objectmodel::New >()); typename UniformMass3::SPtr uniformMass = core::objectmodel::New>(); uniformMass->d_totalMass.setValue(1.0); root->addObject(uniformMass); - const simulation::Node::SPtr child = simulation::getSimulation()->createNewNode("child"); + const simulation::Node::SPtr child = simulation::MainSimulation::getSimulation()->createNewNode("child"); root->addChild(child); child->addObject(core::objectmodel::New >()); diff --git a/Sofa/framework/Testing/CMakeLists.txt b/Sofa/framework/Testing/CMakeLists.txt index 6f04aa642da..b2901a4bdb5 100644 --- a/Sofa/framework/Testing/CMakeLists.txt +++ b/Sofa/framework/Testing/CMakeLists.txt @@ -77,11 +77,11 @@ set(SOURCE_FILES sofa_find_package(Sofa.Helper REQUIRED) sofa_find_package(Sofa.DefaultType REQUIRED) sofa_find_package(Sofa.Core REQUIRED) -sofa_find_package(Sofa.Simulation.Graph REQUIRED) +sofa_find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(Sofa.SimpleApi REQUIRED) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.DefaultType Sofa.Core Sofa.Simulation.Graph Sofa.SimpleApi GTest::gtest SofaGTestMain ) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.DefaultType Sofa.Core Sofa.Simulation.Common Sofa.SimpleApi GTest::gtest SofaGTestMain ) target_compile_options(${PROJECT_NAME} PUBLIC "-DGTEST_LINKED_AS_SHARED_LIBRARY=1") set(SOFA_TESTING_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources") diff --git a/Sofa/framework/Testing/Sofa.TestingConfig.cmake.in b/Sofa/framework/Testing/Sofa.TestingConfig.cmake.in index 41424fbc45e..bc80d3bf7fa 100644 --- a/Sofa/framework/Testing/Sofa.TestingConfig.cmake.in +++ b/Sofa/framework/Testing/Sofa.TestingConfig.cmake.in @@ -10,7 +10,7 @@ sofa_find_package(SofaGTestMain QUIET REQUIRED) sofa_find_package(Sofa.Helper QUIET REQUIRED) sofa_find_package(Sofa.DefaultType QUIET REQUIRED) sofa_find_package(Sofa.Core QUIET REQUIRED) -sofa_find_package(Sofa.Simulation.Graph QUIET REQUIRED) +sofa_find_package(Sofa.Simulation.Common QUIET REQUIRED) sofa_find_package(Sofa.SimpleApi QUIET REQUIRED) if(NOT TARGET @PROJECT_NAME@) diff --git a/Sofa/framework/Testing/SofaGTestMain/CMakeLists.txt b/Sofa/framework/Testing/SofaGTestMain/CMakeLists.txt index a3a84ffa48e..bcb5d767990 100644 --- a/Sofa/framework/Testing/SofaGTestMain/CMakeLists.txt +++ b/Sofa/framework/Testing/SofaGTestMain/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.22) project(SofaGTestMain) ## Dependencies -sofa_find_package(Sofa.Simulation.Graph REQUIRED) +sofa_find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(GTest REQUIRED) add_library(${PROJECT_NAME} SofaGTestMain.cpp) -target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.Simulation.Graph) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.Simulation.Common) target_link_libraries(${PROJECT_NAME} PUBLIC GTest::gtest) ## Install rules for the library; CMake package configurations files diff --git a/Sofa/framework/Testing/SofaGTestMain/SofaGTestMain.cpp b/Sofa/framework/Testing/SofaGTestMain/SofaGTestMain.cpp index 2505276d525..114115eb770 100644 --- a/Sofa/framework/Testing/SofaGTestMain/SofaGTestMain.cpp +++ b/Sofa/framework/Testing/SofaGTestMain/SofaGTestMain.cpp @@ -24,17 +24,15 @@ #include #include #include // #defines SOFA_HAVE_DAG -#include - +#include #include SOFA_EXPORT_DYNAMIC_LIBRARY int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); - - sofa::simulation::graph::init(); + sofa::simulation::core::init(); const int ret = RUN_ALL_TESTS(); - sofa::simulation::graph::cleanup(); + sofa::simulation::core::cleanup(); return ret; } diff --git a/Sofa/framework/Testing/SofaGTestMain/SofaGTestMainConfig.cmake.in b/Sofa/framework/Testing/SofaGTestMain/SofaGTestMainConfig.cmake.in index 980a99eaf8d..1392d128ab2 100644 --- a/Sofa/framework/Testing/SofaGTestMain/SofaGTestMainConfig.cmake.in +++ b/Sofa/framework/Testing/SofaGTestMain/SofaGTestMainConfig.cmake.in @@ -2,7 +2,7 @@ @PACKAGE_GUARD@ @PACKAGE_INIT@ -find_package(Sofa.Simulation.Graph QUIET REQUIRED) +find_package(Sofa.Simulation.Common QUIET REQUIRED) find_package(GTest QUIET REQUIRED) if(NOT TARGET SofaGTestMain) diff --git a/Sofa/framework/Testing/src/sofa/testing/BaseSimulationTest.cpp b/Sofa/framework/Testing/src/sofa/testing/BaseSimulationTest.cpp index 1b84586f42a..413cef6ac01 100644 --- a/Sofa/framework/Testing/src/sofa/testing/BaseSimulationTest.cpp +++ b/Sofa/framework/Testing/src/sofa/testing/BaseSimulationTest.cpp @@ -28,7 +28,6 @@ using sofa::core::execparams::defaultInstance; using sofa::simulation::SceneLoaderFactory ; using sofa::simulation::SceneLoader ; -#include #include using sofa::simulation::SceneLoaderXML ; @@ -53,7 +52,7 @@ BaseSimulationTest::SceneInstance::SceneInstance(const std::string& type, const BaseSimulationTest::SceneInstance BaseSimulationTest::SceneInstance::LoadFromFile(const std::string& filename) { BaseSimulationTest::SceneInstance instance ; - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); for(SceneLoader* loader : (*SceneLoaderFactory::getInstance()->getEntries()) ) { @@ -69,7 +68,7 @@ BaseSimulationTest::SceneInstance BaseSimulationTest::SceneInstance::LoadFromFil BaseSimulationTest::SceneInstance::SceneInstance(const std::string& rootname) { - root = simulation::getSimulation()->createNewNode(rootname) ; + root = simulation::MainSimulation::getSimulation()->createNewNode(rootname) ; } void BaseSimulationTest::SceneInstance::loadSceneFile(const std::string& filename) @@ -80,7 +79,6 @@ void BaseSimulationTest::SceneInstance::loadSceneFile(const std::string& filenam msg_error("BaseSimulationTest") << "Unable to find a valid loader for: '" << filename << "'"; } - BaseSimulationTest::SceneInstance::~SceneInstance() { sofa::simulation::node::unload(root) ; @@ -98,7 +96,7 @@ void BaseSimulationTest::SceneInstance::simulate(const double timestep) BaseSimulationTest::BaseSimulationTest() { - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); } } // namespace sofa::testing diff --git a/applications/plugins/Haption/HaptionDriver.cpp b/applications/plugins/Haption/HaptionDriver.cpp index adfbf1be9f9..37014513a6d 100644 --- a/applications/plugins/Haption/HaptionDriver.cpp +++ b/applications/plugins/Haption/HaptionDriver.cpp @@ -160,7 +160,7 @@ void HaptionDriver::init() context = dynamic_cast(this->getContext()); //Haption node - nodeHaptionVisual = sofa::simulation::getSimulation()->createNewGraph("nodeHaptionVisual"); + nodeHaptionVisual = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("nodeHaptionVisual"); if(haptionVisu.getValue()) { sofa::simulation::tree::GNode *parent = dynamic_cast(this->getContext()); @@ -182,7 +182,7 @@ void HaptionDriver::init() nodeHaptionVisual->updateContext(); //Axes node - nodeAxesVisual = sofa::simulation::getSimulation()->createNewGraph("nodeAxesVisual"); + nodeAxesVisual = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("nodeAxesVisual"); //context->addChild(nodeAxesVisual); //nodeAxesVisual->updateContext(); @@ -200,11 +200,11 @@ void HaptionDriver::init() visualAxesDOF->init(); nodeAxesVisual->updateContext(); - visualNode[0].node = sofa::simulation::getSimulation()->createNewGraph("base"); - visualNode[1].node = sofa::simulation::getSimulation()->createNewGraph("avatar"); - visualNode[2].node = sofa::simulation::getSimulation()->createNewGraph("axe X"); - visualNode[3].node = sofa::simulation::getSimulation()->createNewGraph("axe Y"); - visualNode[4].node = sofa::simulation::getSimulation()->createNewGraph("axe Z"); + visualNode[0].node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("base"); + visualNode[1].node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("avatar"); + visualNode[2].node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("axe X"); + visualNode[3].node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("axe Y"); + visualNode[4].node = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("axe Z"); for(int i=0; i<5; i++) { diff --git a/applications/plugins/SceneCreator/CMakeLists.txt b/applications/plugins/SceneCreator/CMakeLists.txt index f715913f119..412ada60624 100644 --- a/applications/plugins/SceneCreator/CMakeLists.txt +++ b/applications/plugins/SceneCreator/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.22) project(SceneCreator VERSION 0.1) -sofa_find_package(Sofa.Simulation.Graph REQUIRED) +sofa_find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(Sofa.SimpleApi REQUIRED) sofa_find_package(Sofa.Component.StateContainer REQUIRED) sofa_find_package(Eigen3 REQUIRED) @@ -22,7 +22,7 @@ set(SOURCE_FILES ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Graph Sofa.SimpleApi Sofa.Component.StateContainer) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Common Sofa.SimpleApi Sofa.Component.StateContainer) target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen) target_compile_definitions(${PROJECT_NAME} PRIVATE "-DSOFA_BUILD_SCENECREATOR") diff --git a/applications/plugins/SceneCreator/SceneCreatorConfig.cmake.in b/applications/plugins/SceneCreator/SceneCreatorConfig.cmake.in index a324e217f0a..078b18c58b6 100644 --- a/applications/plugins/SceneCreator/SceneCreatorConfig.cmake.in +++ b/applications/plugins/SceneCreator/SceneCreatorConfig.cmake.in @@ -3,7 +3,7 @@ @PACKAGE_GUARD@ @PACKAGE_INIT@ -find_package(Sofa.Simulation.Graph QUIET REQUIRED) +find_package(Sofa.Simulation.Common QUIET REQUIRED) find_package(Eigen3 QUIET REQUIRED) if(NOT TARGET SceneCreator) diff --git a/applications/plugins/SceneCreator/sceneCreatorExamples/SceneCreatorBenchmarks.cpp b/applications/plugins/SceneCreator/sceneCreatorExamples/SceneCreatorBenchmarks.cpp index 5b856a67269..80f6adbfea0 100644 --- a/applications/plugins/SceneCreator/sceneCreatorExamples/SceneCreatorBenchmarks.cpp +++ b/applications/plugins/SceneCreator/sceneCreatorExamples/SceneCreatorBenchmarks.cpp @@ -27,10 +27,7 @@ #include #include -#include #include -#include -#include #include @@ -101,8 +98,6 @@ void fallingDrapExample(sofa::simulation::Node::SPtr root) int main(int argc, char** argv) { - sofa::simulation::graph::init(); - bool showHelp = false; unsigned int idExample = 0; auto* argParser = new sofa::gui::common::ArgumentParser(argc, argv); @@ -176,8 +171,5 @@ int main(int argc, char** argv) //======================================= // Run the main loop sofa::gui::common::GUIManager::MainLoop(root); - - sofa::simulation::graph::cleanup(); - return 0; } diff --git a/applications/plugins/SceneCreator/src/SceneCreator/SceneCreator.cpp b/applications/plugins/SceneCreator/src/SceneCreator/SceneCreator.cpp index 0d02ce1b34a..6124db540b6 100644 --- a/applications/plugins/SceneCreator/src/SceneCreator/SceneCreator.cpp +++ b/applications/plugins/SceneCreator/src/SceneCreator/SceneCreator.cpp @@ -24,7 +24,6 @@ #include #include -#include #include "GetVectorVisitor.h" #include "GetAssembledSizeVisitor.h" @@ -50,7 +49,6 @@ using namespace sofa::defaulttype ; using type::vector; -using sofa::simulation::graph::DAGSimulation ; using sofa::simulation::GetAssembledSizeVisitor ; using sofa::simulation::GetVectorVisitor ; using sofa::simulation::Node ; @@ -67,7 +65,7 @@ using sofa::core::objectmodel::BaseObject ; Node::SPtr createRootWithCollisionPipeline(const std::string& responseType) { - root = simulation::getSimulation()->createNewGraph("root"); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); simpleapi::createObject(root, "CollisionPipeline", {{"name","Collision Pipeline"}}) ; simpleapi::createObject(root, "BruteForceBroadPhase", {{"name","Broad Phase Detection"}}) ; simpleapi::createObject(root, "BVHNarrowPhase", {{"name","Narrow Phase Detection"}}) ; @@ -680,8 +678,8 @@ Node::SPtr massSpringString(Node::SPtr parent, Node::SPtr initSofa() { - assert(sofa::simulation::getSimulation()); - root = simulation::getSimulation()->createNewGraph("root"); + assert(sofa::simulation::MainSimulation::getSimulation()); + root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); return root; } @@ -702,7 +700,7 @@ Node::SPtr clearScene() { if( root ) sofa::simulation::node::unload( root ); - root = simulation::getSimulation()->createNewGraph(""); + root = simulation::MainSimulation::getSimulation()->createNewGraph(""); return root; } diff --git a/applications/plugins/SceneCreator/src/SceneCreator/SceneUtils.cpp b/applications/plugins/SceneCreator/src/SceneCreator/SceneUtils.cpp index 991f3a59e40..bdc7092b122 100644 --- a/applications/plugins/SceneCreator/src/SceneCreator/SceneUtils.cpp +++ b/applications/plugins/SceneCreator/src/SceneCreator/SceneUtils.cpp @@ -22,7 +22,6 @@ #include "SceneCreator.h" #include "SceneUtils.h" -#include #include "GetVectorVisitor.h" #include "GetAssembledSizeVisitor.h" @@ -52,12 +51,10 @@ typedef linearalgebra::FullVector FullVector ; using type::vector; -using sofa::simulation::graph::DAGSimulation ; using sofa::simulation::GetAssembledSizeVisitor ; using sofa::simulation::GetVectorVisitor ; using sofa::simulation::Node ; - Vector getVector( core::ConstVecId id, bool indep ) { GetAssembledSizeVisitor getSizeVisitor; diff --git a/applications/plugins/SofaTest/Elasticity_test.h b/applications/plugins/SofaTest/Elasticity_test.h index 5e3d0a619f1..57774419a72 100644 --- a/applications/plugins/SofaTest/Elasticity_test.h +++ b/applications/plugins/SofaTest/Elasticity_test.h @@ -28,7 +28,7 @@ #include //Including Simulation -#include +#include #include #include diff --git a/applications/plugins/SofaTest/Elasticity_test.inl b/applications/plugins/SofaTest/Elasticity_test.inl index 949ca6851cb..09413f5298a 100644 --- a/applications/plugins/SofaTest/Elasticity_test.inl +++ b/applications/plugins/SofaTest/Elasticity_test.inl @@ -37,7 +37,7 @@ // Constraint #include -#include +#include #include #include @@ -73,8 +73,8 @@ typedef component::mapping::nonlinear::RigidMapping SubsetMultiMapping3_to_3; typedef component::mass::UniformMass UniformMassRigid3; typedef component::mass::UniformMass UniformMass3; -typedef component::constraint::projective::FixedConstraint FixedConstraintRigid3; -typedef component::constraint::projective::FixedConstraint FixedConstraint3; +typedef component::constraint::projective::FixedProjectiveConstraint FixedProjectiveConstraintRigid3; +typedef component::constraint::projective::FixedProjectiveConstraint FixedProjectiveConstraint3; /// Create a scene with a regular grid and an affine constraint for patch test @@ -111,8 +111,8 @@ Elasticity_test::createRegularGridScene( // Euler implicit solver and cglinear solver component::odesolver::backward::EulerImplicitSolver::SPtr solver = modeling::addNew(SquareNode,"EulerImplicitSolver"); - solver->f_rayleighStiffness.setValue(0.5); - solver->f_rayleighMass.setValue(0.5); + solver->d_rayleighStiffness.setValue(0.5); + solver->d_rayleighMass.setValue(0.5); CGLinearSolver::SPtr cgLinearSolver = modeling::addNew< CGLinearSolver >(SquareNode,"linearSolver"); cgLinearSolver->d_maxIter.setValue(25); cgLinearSolver->d_tolerance.setValue(1e-5); @@ -145,8 +145,8 @@ Elasticity_test::createRegularGridScene( //Affine constraint patchStruct.affineConstraint = modeling::addNew(SquareNode,"affineConstraint"); - modeling::setDataLink(&boxRoi->d_indices,&patchStruct.affineConstraint->m_meshIndices); - modeling::setDataLink(&pairBoxRoi->f_indices,& patchStruct.affineConstraint->m_indices); + modeling::setDataLink(&boxRoi->d_indices,&patchStruct.affineConstraint->d_meshIndices); + modeling::setDataLink(&pairBoxRoi->f_indices,& patchStruct.affineConstraint->d_indices); patchStruct.SquareNode = SquareNode; return patchStruct; @@ -169,7 +169,7 @@ CylinderTractionStruct Elasticity_test::createCylinderTra CylinderTractionStruct tractionStruct; // Root node - root = sofa::simulation::getSimulation()->createNewGraph("root"); + root = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); tractionStruct.root=root; root->setGravity( Coord(0,0,0) ); @@ -220,8 +220,8 @@ CylinderTractionStruct Elasticity_test::createCylinderTra boxRoi1->d_alignedBoxes.setValue(vecBox); boxRoi1->d_strict.setValue(false); // FixedConstraint - typename component::constraint::projective::FixedConstraint::SPtr fc= - modeling::addNew >(root); + typename component::constraint::projective::FixedProjectiveConstraint::SPtr fc= + modeling::addNew >(root); sofa::modeling::setDataLink(&boxRoi1->d_indices,&fc->d_indices); // FixedPlaneProjectiveConstraint typename component::constraint::projective::FixedPlaneProjectiveConstraint::SPtr fpc= @@ -240,15 +240,15 @@ CylinderTractionStruct Elasticity_test::createCylinderTra typename sofa::component::mechanicalload::TrianglePressureForceField::SPtr tpff= modeling::addNew >(root); tractionStruct.forceField=tpff; - sofa::modeling::setDataLink(&boxRoi2->d_triangleIndices,&tpff->triangleList); + sofa::modeling::setDataLink(&boxRoi2->d_triangleIndices,&tpff->d_triangleList); // LineProjectiveConstraint typename component::constraint::projective::LineProjectiveConstraint::SPtr ptlc= modeling::addNew >(root); - ptlc->f_direction=Coord(1,0,0); - ptlc->f_origin=Coord(0,0,0); + ptlc->d_direction=Coord(1,0,0); + ptlc->d_origin=Coord(0,0,0); sofa::type::vector vArray; vArray.push_back(resolutionCircumferential*(resolutionRadial-1)+1); - ptlc->f_indices.setValue(vArray); + ptlc->d_indices.setValue(vArray); return tractionStruct; } @@ -270,7 +270,7 @@ simulation::Node::SPtr Elasticity_test
::createGridScene( using core::objectmodel::New; // The graph root node - simulation::Node::SPtr root = simulation::getSimulation()->createNewGraph("root"); + simulation::Node::SPtr root = simulation::MainSimulation::getSimulation()->createNewGraph("root"); root->setGravity( Coord(0,-10,0) ); root->setAnimate(false); root->setDt(0.01); @@ -287,7 +287,7 @@ simulation::Node::SPtr Elasticity_test
::createGridScene( simulation::Node::SPtr rigidNode = simulatedScene->createChild("rigidNode"); MechanicalObjectRigid3::SPtr rigid_dof = modeling::addNew(rigidNode, "dof"); UniformMassRigid3::SPtr rigid_mass = modeling::addNew(rigidNode,"mass"); - FixedConstraintRigid3::SPtr rigid_fixedConstraint = modeling::addNew(rigidNode,"fixedConstraint"); + FixedProjectiveConstraintRigid3::SPtr rigid_fixedConstraint = modeling::addNew(rigidNode,"fixedConstraint"); // Particles mapped to the rigid object simulation::Node::SPtr mappedParticles = rigidNode->createChild("mappedParticles"); @@ -435,7 +435,7 @@ simulation::Node::SPtr Elasticity_test::createMassSpringSystem( MechanicalObject3::WriteVecDeriv vdof = FixedPoint->writeVelocities(); copyToData( vdof, vFixedPoint ); - FixedConstraint3::SPtr fixed = modeling::addNew(fixedPointNode,"FixedPointNode"); + FixedProjectiveConstraint3::SPtr fixed = modeling::addNew(fixedPointNode,"FixedPointNode"); fixed->addConstraint(0); // attach particle diff --git a/applications/plugins/SofaTest/ForceField_test.h b/applications/plugins/SofaTest/ForceField_test.h index c22aa3c3a85..aff5b175acb 100644 --- a/applications/plugins/SofaTest/ForceField_test.h +++ b/applications/plugins/SofaTest/ForceField_test.h @@ -25,7 +25,7 @@ #define SOFA_STANDARDTEST_ForceField_test_H #include "Sofa_test.h" -#include +#include #include #include #include @@ -110,7 +110,7 @@ struct ForceField_test : public Sofa_testcreateNewGraph("root"); @@ -131,11 +131,11 @@ struct ForceField_test : public Sofa_testcreateNewGraph("root"); - node = sofa::simulation::getSimulation()->load(filename.c_str()); + node = sofa::simulation::node::load(filename.c_str()); /// Get mechanical object dof = node->get(node->SearchDown); @@ -175,7 +175,7 @@ struct ForceField_test : public Sofa_testinit(this->node.get()); + sofa::simulation::node::init(this->node.get()); core::MechanicalParams mparams; mparams.setKFactor(1.0); MechanicalResetForceVisitor resetForce(&mparams, core::vec_id::write_access::force); diff --git a/applications/plugins/SofaTest/Mapping_test.h b/applications/plugins/SofaTest/Mapping_test.h index df109e30fde..6ddb8a79f20 100644 --- a/applications/plugins/SofaTest/Mapping_test.h +++ b/applications/plugins/SofaTest/Mapping_test.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -128,7 +128,7 @@ struct Mapping_test: public Sofa_test Mapping_test():deltaRange(1,1000),errorMax(10),errorFactorDJ(1),flags(TEST_ASSEMBLY_API | TEST_GEOMETRIC_STIFFNESS) { sofa::component::initSofaComponentAll(); - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(simulation = new sofa::simulation::Simulation()); /// Parent node root = simulation->createNewGraph("root"); @@ -144,11 +144,11 @@ struct Mapping_test: public Sofa_test Mapping_test(std::string fileName):deltaRange(1,1000),errorMax(100),errorFactorDJ(1),flags(TEST_ASSEMBLY_API | TEST_GEOMETRIC_STIFFNESS) { sofa::component::initSofaComponentAll(); - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(simulation = new sofa::simulation::Simulation()); /// Load the scene root = simulation->createNewGraph("root"); - root = sofa::simulation::getSimulation()->load(fileName.c_str(), false); + root = sofa::simulation::MainSimulation::getSimulation()->load(fileName.c_str(), false); // InDofs inDofs = root->get(root->SearchDown); @@ -237,7 +237,7 @@ struct Mapping_test: public Sofa_test copyToData(xout,childInit); /// Init based on parentInit - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::MainSimulation::getSimulation()->init(root.get()); /// Updated to parentNew copyToData(xin,parentNew); @@ -485,7 +485,7 @@ struct Mapping_test: public Sofa_test virtual ~Mapping_test() { if (root!=nullptr) - sofa::simulation::getSimulation()->unload(root); + sofa::simulation::MainSimulation::getSimulation()->unload(root); } protected: diff --git a/applications/plugins/SofaTest/Multi2Mapping_test.h b/applications/plugins/SofaTest/Multi2Mapping_test.h index 70cf3981cc6..8776c92a373 100644 --- a/applications/plugins/SofaTest/Multi2Mapping_test.h +++ b/applications/plugins/SofaTest/Multi2Mapping_test.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -116,14 +116,14 @@ struct Multi2Mapping_test : public Sofa_test /// Constructor Multi2Mapping_test() :deltaRange(1, 1000), errorMax(10) { - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(simulation = new sofa::simulation::Simulation()); } virtual ~Multi2Mapping_test() { if (root!=nullptr) - sofa::simulation::getSimulation()->unload(root); + sofa::simulation::MainSimulation::getSimulation()->unload(root); } /** Returns OutCoord subtraction a-b (should return a OutDeriv, but???) @@ -197,7 +197,7 @@ struct Multi2Mapping_test : public Sofa_test } /// Init - sofa::simulation::getSimulation()->init(root); + sofa::simulation::MainSimulation::getSimulation()->init(root); /// Apply the mapping // --- Use of the method apply diff --git a/applications/plugins/SofaTest/MultiMapping_test.h b/applications/plugins/SofaTest/MultiMapping_test.h index 7c026f9cbde..b02e04a720f 100644 --- a/applications/plugins/SofaTest/MultiMapping_test.h +++ b/applications/plugins/SofaTest/MultiMapping_test.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -90,7 +90,7 @@ struct MultiMapping_test : public Sofa_test MultiMapping_test():deltaRange(1,1000),errorMax(10) { - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(simulation = new sofa::simulation::Simulation()); } @@ -163,7 +163,7 @@ struct MultiMapping_test : public Sofa_test } /// Init - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::MainSimulation::getSimulation()->init(root.get()); /// apply the mapping mapping->apply(&mparams, core::vec_id::write_access::position, core::vec_id::read_access::position); @@ -414,7 +414,7 @@ struct MultiMapping_test : public Sofa_test virtual ~MultiMapping_test() { if (root!=nullptr) - sofa::simulation::getSimulation()->unload(root); + sofa::simulation::MainSimulation::getSimulation()->unload(root); } }; diff --git a/applications/plugins/SofaTest/PrimitiveCreation.cpp b/applications/plugins/SofaTest/PrimitiveCreation.cpp index 3f286aa7c42..5d245583b9a 100644 --- a/applications/plugins/SofaTest/PrimitiveCreation.cpp +++ b/applications/plugins/SofaTest/PrimitiveCreation.cpp @@ -160,11 +160,11 @@ sofa::component::collision::geometry::SphereCollisionModelinit(); - sofa::component::collision::geometry::SphereCollisionModel::VecReal & vecRad = *(sphereCollisionModel->radius.beginEdit()); + sofa::component::collision::geometry::SphereCollisionModel::VecReal & vecRad = *(sphereCollisionModel->d_radius.beginEdit()); vecRad[0] = radius; - sphereCollisionModel->radius.endEdit(); + sphereCollisionModel->d_radius.endEdit(); return sphereCollisionModel; } @@ -203,11 +203,11 @@ sofa::component::collision::geometry::SphereCollisionModelinit(); - sofa::component::collision::geometry::SphereCollisionModel::VecReal & vecRad = *(sphereCollisionModel->radius.beginEdit()); + sofa::component::collision::geometry::SphereCollisionModel::VecReal & vecRad = *(sphereCollisionModel->d_radius.beginEdit()); vecRad[0] = radius; - sphereCollisionModel->radius.endEdit(); + sphereCollisionModel->d_radius.endEdit(); return sphereCollisionModel; } diff --git a/applications/plugins/image/image_test/ImageEngine_test.cpp b/applications/plugins/image/image_test/ImageEngine_test.cpp index dcae5fee3d9..c084dc489ec 100644 --- a/applications/plugins/image/image_test/ImageEngine_test.cpp +++ b/applications/plugins/image/image_test/ImageEngine_test.cpp @@ -22,7 +22,7 @@ #include #include //Including Simulation -#include +#include #include #include @@ -130,7 +130,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest TestImageEngine::SPtr imageEngine; // Create a scene - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); // Root node root = simulation->createNewGraph("root"); @@ -190,7 +190,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest ImageViewer::SPtr imageViewer; // Create a scene - simulation = sofa::simulation::getSimulation(); + simulation = sofa::simulation::MainSimulation::getSimulation(); // Root node root = simulation->createNewGraph("root"); diff --git a/applications/projects/Modeler/exec/Main.cpp b/applications/projects/Modeler/exec/Main.cpp index 864ab669eb3..07f9aadaceb 100644 --- a/applications/projects/Modeler/exec/Main.cpp +++ b/applications/projects/Modeler/exec/Main.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include @@ -53,7 +53,7 @@ int main(int argc, char** argv) QApplication* application = new QApplication(argc, argv); (void)application; - sofa::simulation::setSimulation(new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(new sofa::simulation::Simulation()); Q_INIT_RESOURCE(icons); sofa::qt::SofaModeler* sofaModeler = new sofa::qt::SofaModeler(); diff --git a/applications/projects/Modeler/lib/GraphHistoryManager.cpp b/applications/projects/Modeler/lib/GraphHistoryManager.cpp index f819901efba..3f861294701 100644 --- a/applications/projects/Modeler/lib/GraphHistoryManager.cpp +++ b/applications/projects/Modeler/lib/GraphHistoryManager.cpp @@ -248,7 +248,7 @@ void GraphHistoryManager::clearHistory() else if (historyOperation[i].ID == Operation::DELETE_Node) { Node *n=down_cast(historyOperation[i].sofaComponent->toBaseNode()); - simulation::getSimulation()->unload(n); + simulation::MainSimulation::getSimulation()->unload(n); historyOperation[i].sofaComponent.reset(); } } @@ -267,7 +267,7 @@ void GraphHistoryManager::clearHistoryUndo() else if (historyUndoOperation[i].ID == Operation::DELETE_Node) { Node *n=down_cast(historyUndoOperation[i].sofaComponent->toBaseNode()); - simulation::getSimulation()->unload(n); + simulation::MainSimulation::getSimulation()->unload(n); historyUndoOperation[i].sofaComponent.reset(); } } diff --git a/applications/projects/Modeler/lib/GraphModeler.cpp b/applications/projects/Modeler/lib/GraphModeler.cpp index 247c102af20..94a55892d0e 100644 --- a/applications/projects/Modeler/lib/GraphModeler.cpp +++ b/applications/projects/Modeler/lib/GraphModeler.cpp @@ -97,7 +97,7 @@ GraphModeler::GraphModeler(QWidget* parent, const char* name, Qt::WindowFlags f) GraphModeler::~GraphModeler() { delete historyManager; - simulation::getSimulation()->unload(getRoot()); + simulation::MainSimulation::getSimulation()->unload(getRoot()); //delete getRoot(); graphRoot.reset(); delete graphListener; @@ -913,7 +913,7 @@ bool GraphModeler::getSaveFilename(std::string &filename) void GraphModeler::save(const std::string &filename) { Node *node = getNode(this->topLevelItem(0)); - simulation::getSimulation()->exportXML(node, filename.c_str()); + simulation::MainSimulation::getSimulation()->exportXML(node, filename.c_str()); emit graphClean(); } diff --git a/applications/projects/Modeler/lib/SofaModeler.cpp b/applications/projects/Modeler/lib/SofaModeler.cpp index a0e292de991..23e964b51ce 100644 --- a/applications/projects/Modeler/lib/SofaModeler.cpp +++ b/applications/projects/Modeler/lib/SofaModeler.cpp @@ -613,7 +613,7 @@ bool SofaModeler::closeTab(QWidget *curTab, bool forceClose) else if (response == QMessageBox::Ok) { if (mod->getFilename().empty()) fileSaveAs(); - else simulation::getSimulation()->exportXML(mod->getRoot(), mod->getFilename().c_str()); + else simulation::MainSimulation::getSimulation()->exportXML(mod->getRoot(), mod->getFilename().c_str()); } } //If the scene has been launch in Sofa @@ -680,7 +680,7 @@ void SofaModeler::fileOpen(std::string filename) filename = sofa::helper::system::DataRepository.getFile ( filename ); openPath = sofa::helper::system::SetDirectory::GetParentDir(filename.c_str()); Node::SPtr root = NULL; - root = down_cast( sofa::simulation::getSimulation()->load(filename.c_str()).get() ); + root = down_cast( sofa::simulation::MainSimulation::getSimulation()->load(filename.c_str()).get() ); if (root) { createTab(); @@ -1094,7 +1094,7 @@ void SofaModeler::runInSofa( const std::string &sceneFilename, Node* root) std::string filename=path + std::string("temp") + (++count) + std::string(".scn"); - simulation::getSimulation()->exportXML(root,filename.c_str()); + simulation::MainSimulation::getSimulation()->exportXML(root,filename.c_str()); //Make a copy of the .view if it exists for the current viewer const std::string &extension=sofa::helper::system::SetDirectory::GetExtension(sceneFilename.c_str()); diff --git a/applications/projects/SofaPhysicsAPI/CMakeLists.txt b/applications/projects/SofaPhysicsAPI/CMakeLists.txt index e0271d46ced..45078c7e631 100644 --- a/applications/projects/SofaPhysicsAPI/CMakeLists.txt +++ b/applications/projects/SofaPhysicsAPI/CMakeLists.txt @@ -18,7 +18,7 @@ set(SOURCE_FILES ${SOFAPHYSICSAPI_SRC_DIR}/fakegui.cpp ) -find_package(Sofa.Simulation.Graph REQUIRED) +find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(Sofa.SimpleApi REQUIRED) sofa_find_package(Sofa.Component REQUIRED) sofa_find_package(Sofa.GUI.Common REQUIRED) @@ -39,7 +39,7 @@ else() endif() add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Graph Sofa.GUI.Common Sofa.SimpleApi) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Common Sofa.GUI.Common Sofa.SimpleApi) target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component) if(SofaValidation_FOUND) diff --git a/applications/projects/SofaPhysicsAPI/SofaPhysicsAPIConfig.cmake.in b/applications/projects/SofaPhysicsAPI/SofaPhysicsAPIConfig.cmake.in index 1aafa8f2efa..17318974193 100644 --- a/applications/projects/SofaPhysicsAPI/SofaPhysicsAPIConfig.cmake.in +++ b/applications/projects/SofaPhysicsAPI/SofaPhysicsAPIConfig.cmake.in @@ -4,7 +4,7 @@ set(SOFAPHYSICSAPI_HAVE_SOFAVALIDATION @SOFAPHYSICSAPI_HAVE_SOFAVALIDATION@) -find_package(Sofa.Simulation.Graph QUIET REQUIRED) +find_package(Sofa.Simulation.Common QUIET REQUIRED) find_package(Sofa.Component QUIET REQUIRED) find_package(Sofa.GUI.Common QUIET REQUIRED) diff --git a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.cpp b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.cpp index 200cd84f94b..f1072bb3d84 100644 --- a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.cpp +++ b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include @@ -343,7 +343,7 @@ SofaPhysicsSimulation::SofaPhysicsSimulation(bool useGUI_, int GUIFramerate_) lastH = 0; vparams = sofa::core::visual::VisualParams::defaultInstance(); - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); sofa::component::init(); // force dependency on Sofa.Component @@ -371,7 +371,7 @@ SofaPhysicsSimulation::~SofaPhysicsSimulation() //groot = dynamic_cast( sofa::gui::common::GUIManager::CurrentSimulation() ); //if (groot!=NULL) - // sofa::simulation::getSimulation()->unload(groot); + // sofa::simulation::MainSimulation::getSimulation()->unload(groot); //sofa::gui::common::GUIManager::closeGUI(); @@ -413,7 +413,7 @@ int SofaPhysicsSimulation::load(const char* cfilename) } else { - m_RootNode = sofa::simulation::getSimulation()->createNewGraph(""); + m_RootNode = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); return API_SCENE_FAILED; } initTexturesDone = false; @@ -456,7 +456,7 @@ int SofaPhysicsSimulation::loadPlugin(const char* pluginPath) void SofaPhysicsSimulation::createScene() { - m_RootNode = sofa::simulation::getSimulation()->createNewGraph("root"); + m_RootNode = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); sofa::simpleapi::createObject(m_RootNode, "CollisionPipeline", { {"name","Collision Pipeline"} }); sofa::simpleapi::createObject(m_RootNode, "BruteForceBroadPhase", { {"name","Broad Phase Detection"} }); sofa::simpleapi::createObject(m_RootNode, "BVHNarrowPhase", { {"name","Narrow Phase Detection"} }); diff --git a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.h b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.h index 2f1418c702c..b7b28458f21 100644 --- a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.h +++ b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsSimulation.h @@ -173,7 +173,7 @@ class SOFA_SOFAPHYSICSAPI_API SofaPhysicsSimulation } sofa::simulation::Simulation* getSimulation() const { - return sofa::simulation::getSimulation(); + return sofa::simulation::MainSimulation::getSimulation(); } sofa::simulation::Node* getScene() const { diff --git a/applications/projects/runSofa/CMakeLists.txt b/applications/projects/runSofa/CMakeLists.txt index aeffe5209db..1ab9014aa8d 100644 --- a/applications/projects/runSofa/CMakeLists.txt +++ b/applications/projects/runSofa/CMakeLists.txt @@ -4,7 +4,7 @@ project(runSofa) # Detect if component is compiled outside SOFA if ("${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}") find_package(Sofa.Config REQUIRED) - sofa_find_package(Sofa.Simulation.Graph REQUIRED) + sofa_find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(ZLIB) endif() @@ -40,7 +40,7 @@ install(FILES "${_defaultConfigPluginFilePath}" DESTINATION ${_pluginLocation}/ sofa_find_package(Sofa.Component.Playback QUIET) -sofa_find_package(Sofa.Simulation.Graph REQUIRED) +sofa_find_package(Sofa.Simulation.Common REQUIRED) sofa_find_package(Sofa.GUI.Common REQUIRED) sofa_find_package(Sofa.GUI.Batch REQUIRED) sofa_find_package(SceneChecking REQUIRED) @@ -79,7 +79,7 @@ endif() target_compile_definitions(${PROJECT_NAME} PUBLIC "CONFIG_PLUGIN_FILENAME=${_configPluginFileName}") target_compile_definitions(${PROJECT_NAME} PUBLIC "DEFAULT_CONFIG_PLUGIN_FILENAME=${_defaultConfigPluginFileName}") -target_link_libraries(${PROJECT_NAME} Sofa.Simulation.Graph) +target_link_libraries(${PROJECT_NAME} Sofa.Simulation.Common) target_link_libraries(${PROJECT_NAME} Sofa.GUI.Common) target_link_libraries(${PROJECT_NAME} Sofa.GUI.Batch) target_link_libraries(${PROJECT_NAME} SceneChecking) diff --git a/applications/projects/runSofa/Main.cpp b/applications/projects/runSofa/Main.cpp index a7ac3187b46..e0170831bc8 100644 --- a/applications/projects/runSofa/Main.cpp +++ b/applications/projects/runSofa/Main.cpp @@ -35,8 +35,7 @@ using std::vector; #include #include #include -#include -#include +#include using sofa::simulation::Node; #include #include @@ -59,7 +58,6 @@ using sofa::core::ExecParams ; #include using sofa::helper::Utils; -using sofa::simulation::graph::DAGSimulation; using sofa::helper::system::SetDirectory; using sofa::core::objectmodel::BaseNode ; @@ -309,11 +307,7 @@ int main(int argc, char** argv) exit( EXIT_SUCCESS ); } - // Note that initializations must be done after ArgumentParser that can exit the application (without cleanup) - // even if everything is ok e.g. asking for help - sofa::simulation::graph::init(); - - assert(sofa::simulation::getSimulation()); + assert(sofa::simulation::MainSimulation::getSimulation()); if (colorsStatus == "unset") { // If the parameter is unset, check the environment variable @@ -432,8 +426,6 @@ int main(int argc, char** argv) if (int err = GUIManager::Init(argv[0],gui.c_str())) { sofa::simulation::common::cleanup(); - sofa::simulation::graph::cleanup(); - return err; } @@ -471,7 +463,7 @@ int main(int argc, char** argv) const std::vector sceneArgs = sofa::gui::common::ArgumentParser::extra_args(); Node::SPtr groot = sofa::simulation::node::load(fileName, false, sceneArgs); if( !groot ) - groot = sofa::simulation::getSimulation()->createNewGraph(""); + groot = sofa::simulation::MainSimulation::getSimulation()->createNewGraph(""); if (!verif.empty()) { @@ -529,7 +521,6 @@ int main(int argc, char** argv) GUIManager::closeGUI(); sofa::simulation::common::cleanup(); - sofa::simulation::graph::cleanup(); return 0; } diff --git a/applications/projects/sofaProjectExample/Main.cpp b/applications/projects/sofaProjectExample/Main.cpp index 8c84b8c2b71..e9dfdf93ab0 100644 --- a/applications/projects/sofaProjectExample/Main.cpp +++ b/applications/projects/sofaProjectExample/Main.cpp @@ -47,10 +47,8 @@ #include #include -#include #include -#include -#include +#include #include #include @@ -113,7 +111,6 @@ int main(int argc, char** argv) sofa::glfw::SofaGLFWBaseGUI glfwGUI; - sofa::simulation::graph::init(); sofa::component::initSofaComponentAll(); if (!glfwGUI.init()) @@ -123,9 +120,9 @@ int main(int argc, char** argv) return 0; } - sofa::simulation::setSimulation(new sofa::simulation::graph::DAGSimulation()); + sofa::simulation::setSimulation(new sofa::simulation::Simulation()); // The graph root node : gravity already exists in a GNode by default - Node::SPtr groot = sofa::simulation::getSimulation()->createNewGraph("root"); + Node::SPtr groot = sofa::simulation::MainSimulation::getSimulation()->createNewGraph("root"); groot->setGravity({ 0,0,0 }); groot->setDt(0.02); @@ -160,11 +157,11 @@ int main(int argc, char** argv) /* * Sub nodes: DRE */ - Node::SPtr dreNode = New(); + Node::SPtr dreNode = New(); dreNode->setName("DRE"); - Node::SPtr cylNode = New(); + Node::SPtr cylNode = New(); cylNode->setName("Cylinder"); @@ -240,7 +237,7 @@ int main(int argc, char** argv) // visual node - Node::SPtr cylVisualNode = New(); + Node::SPtr cylVisualNode = New(); cylVisualNode->setName("Cylinder Visual"); OglModel::SPtr cylOglModel = New(); @@ -256,7 +253,7 @@ int main(int argc, char** argv) // collision node - Node::SPtr cylCollisionNode = New(); + Node::SPtr cylCollisionNode = New(); cylCollisionNode->setName("Cylinder Collision"); MeshGmshLoader::SPtr cylSurfMeshLoader = New(); @@ -304,7 +301,7 @@ int main(int argc, char** argv) glfwGUI.createWindow(800, 600, "SofaGLFW"); // Init the scene - sofa::simulation::getSimulation()->init(groot.get()); + sofa::simulation::MainSimulation::getSimulation()->init(groot.get()); groot->setAnimate(true); glfwGUI.initVisual(); @@ -326,6 +323,5 @@ int main(int argc, char** argv) // Run the main loop glfwGUI.runLoop(); - sofa::simulation::graph::cleanup(); return 0; } diff --git a/examples/SimpleAPI/fallingSOFA.cpp b/examples/SimpleAPI/fallingSOFA.cpp index 93d7cc7d367..36fc698ca54 100644 --- a/examples/SimpleAPI/fallingSOFA.cpp +++ b/examples/SimpleAPI/fallingSOFA.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -114,7 +113,6 @@ sofa::simulation::Node::SPtr createScene(const sofa::simpleapi::Simulation::SPtr int main(int /**argc**/, char** argv) { sofa::simulation::common::init(); - sofa::simulation::graph::init(); const sofa::simpleapi::Simulation::SPtr simu = sofa::simpleapi::createSimulation("DAG") ; const auto root = createScene(simu); @@ -144,6 +142,5 @@ int main(int /**argc**/, char** argv) sofa::gui::common::GUIManager::closeGUI(); sofa::simulation::common::cleanup(); - sofa::simulation::graph::cleanup(); return 0; }