Skip to content

Commit 346459f

Browse files
committed
load plugins once (avoiding registering several times)
1 parent 2650d87 commit 346459f

File tree

1 file changed

+28
-43
lines changed

1 file changed

+28
-43
lines changed

Sofa/framework/Simulation/simutest/parallel_scenes_test.cpp

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ using sofa::simulation::Node ;
2929
#include <sofa/component/sceneutility/InfoComponent.h>
3030
using sofa::component::sceneutility::InfoComponent;
3131

32-
#include <sofa/helper/system/PluginManager.h>
33-
using sofa::helper::system::PluginManager ;
34-
3532
#include <sofa/simulation/common/SceneLoaderXML.h>
3633
using sofa::simulation::SceneLoaderXML ;
3734

@@ -47,10 +44,36 @@ class ParallelScenesTest : public virtual sofa::testing::BaseTest
4744
{
4845
}
4946

47+
void SetUp() override
48+
{
49+
EXPECT_MSG_NOEMIT(Error, Warning);
50+
51+
sofa::simpleapi::importPlugin("Sofa.Component.AnimationLoop");
52+
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Algorithm");
53+
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Detection.Intersection");
54+
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Geometry");
55+
sofa::simpleapi::importPlugin("Sofa.Component.Collision.Response.Contact");
56+
sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Lagrangian.Correction");
57+
sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Lagrangian.Solver");
58+
sofa::simpleapi::importPlugin("Sofa.Component.Constraint.Projective");
59+
sofa::simpleapi::importPlugin("Sofa.Component.IO.Mesh");
60+
sofa::simpleapi::importPlugin("Sofa.Component.LinearSolver.Iterative");
61+
sofa::simpleapi::importPlugin("Sofa.Component.Mapping.Linear");
62+
sofa::simpleapi::importPlugin("Sofa.Component.Mass");
63+
sofa::simpleapi::importPlugin("Sofa.Component.ODESolver.Backward");
64+
sofa::simpleapi::importPlugin("Sofa.Component.SolidMechanics.FEM.Elastic");
65+
sofa::simpleapi::importPlugin("Sofa.Component.StateContainer");
66+
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Constant");
67+
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Dynamic");
68+
sofa::simpleapi::importPlugin("Sofa.Component.Topology.Container.Grid");
69+
sofa::simpleapi::importPlugin("Sofa.Component.Visual");
70+
sofa::simpleapi::importPlugin("Sofa.GL.Component.Rendering3D");
71+
sofa::simpleapi::importPlugin("Sofa.Component.LinearSystem");
72+
}
73+
5074
void executeInParallel(const char* sceneStr, const std::size_t nbScenes, const std::size_t nbSteps)
5175
{
52-
EXPECT_MSG_NOEMIT(Error);
53-
EXPECT_MSG_NOEMIT(Warning);
76+
EXPECT_MSG_NOEMIT(Error, Warning);
5477

5578
std::vector<sofa::simulation::NodeSPtr> groots;
5679
groots.resize(nbScenes);
@@ -104,21 +127,6 @@ class ParallelScenesTest : public virtual sofa::testing::BaseTest
104127
const std::string sceneStr = R"(
105128
<?xml version="1.0" ?>
106129
<Node name="lroot" gravity="0 -9.81 0" dt="0.02">
107-
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
108-
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [DiscreteIntersection] -->
109-
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [SphereCollisionModel] -->
110-
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
111-
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
112-
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader MeshOBJLoader SphereLoader] -->
113-
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
114-
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
115-
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass] -->
116-
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
117-
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedralCorotationalFEMForceField] -->
118-
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
119-
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms TetrahedronSetTopologyContainer] -->
120-
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
121-
122130
<CollisionPipeline name="CollisionPipeline" verbose="0" />
123131
<DefaultAnimationLoop/>
124132
<BruteForceBroadPhase/>
@@ -160,29 +168,6 @@ class ParallelScenesTest : public virtual sofa::testing::BaseTest
160168
const std::string sceneStr = R"(
161169
<?xml version="1.0" ?>
162170
<Node name="root" gravity="0 -1000 0" dt="0.04">
163-
<Node name="RequiredPlugins">
164-
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
165-
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
166-
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
167-
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel PointCollisionModel TriangleCollisionModel] -->
168-
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
169-
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [UncoupledConstraintCorrection] -->
170-
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
171-
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
172-
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
173-
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
174-
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
175-
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
176-
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [HexahedronFEMForceField] -->
177-
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
178-
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
179-
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [SparseGridRamificationTopology] -->
180-
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [InteractiveCamera VisualStyle] -->
181-
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
182-
<RequiredPlugin name="Sofa.GL.Component.Shader"/> <!-- Needed to use components [LightManager SpotLight] -->
183-
<RequiredPlugin name="Sofa.Component.LinearSystem"/> <!-- Needed to use components [MatrixLinearSystem] -->
184-
</Node>
185-
186171
<FreeMotionAnimationLoop parallelCollisionDetectionAndFreeMotion="false" />
187172
<VisualStyle displayFlags="showVisual " /> <!--showBehaviorModels showCollisionModels-->
188173
<LCPConstraintSolver tolerance="1e-3" maxIt="1000" initial_guess="false" build_lcp="false" printLog="0" mu="0.2"/>

0 commit comments

Comments
 (0)