From d0ed989aa22ad4fd21185140c3bec16141a2c55a Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 1 Dec 2023 17:27:17 +0100 Subject: [PATCH] [all] Fix warnings (#4291) * [all] Fix warnings * revert change on scenes wrongly committed * Apply suggestions from code review Co-authored-by: Alex Bilger * [all] Fix warnings * Fix runtime error due to useless destructor * take reviews into account: d_nbThreads back to int --------- Co-authored-by: Alex Bilger --- .../tests/FixedPlaneConstraint_test.cpp | 2 +- .../iterative/MatrixLinearSolver.inl | 8 +- .../matrixaccumulators/ConstantLocalMatrix.h | 4 + .../tests/MatrixLinearSystem_test.cpp | 36 ++++- .../mechanicalload/EllipsoidForceField.h | 46 ++---- .../mechanicalload/EllipsoidForceField.inl | 10 +- .../sofa/component/mechanicalload/config.h.in | 6 +- .../elastic/TriangularFEMForceFieldOptim.inl | 2 - .../CompressedRowSparseMatrixGeneric.h | 2 +- .../sofa/simulation/DefaultAnimationLoop.cpp | 1 + .../DefaultCollisionGroupManager_test.cpp | 10 +- .../SofaValidation_test/Monitor_test.cpp | 2 +- .../examples/benchmark_cubes.scn | 144 +++++++++--------- .../src/MultiThreading/TaskSchedulerUser.cpp | 2 +- ...allelCompressedRowSparseMatrixMechanical.h | 8 +- .../examples/SimpleBox-Method2.scn | 2 +- .../image/image_test/ImageEngine_test.cpp | 14 +- .../SofaPhysicsAPI/SofaPhysicsBindings.cpp | 2 +- .../tutorials/chainHybrid/chainHybrid.cpp | 3 +- .../compositeObject/compositeObject.cpp | 6 +- .../tutorials/mixedPendulum/mixedPendulum.cpp | 6 +- .../tutorials/oneParticle/oneParticle.cpp | 3 +- 22 files changed, 163 insertions(+), 156 deletions(-) diff --git a/Sofa/Component/Constraint/Projective/tests/FixedPlaneConstraint_test.cpp b/Sofa/Component/Constraint/Projective/tests/FixedPlaneConstraint_test.cpp index 5ed1c9ca855..b040bfced84 100644 --- a/Sofa/Component/Constraint/Projective/tests/FixedPlaneConstraint_test.cpp +++ b/Sofa/Component/Constraint/Projective/tests/FixedPlaneConstraint_test.cpp @@ -67,7 +67,7 @@ struct FixedPlaneConstraint_test : public BaseSimulationTest /// Scene initialization sofa::simulation::Simulation* simulation; - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + simulation = sofa::simulation::getSimulation(); simulation::Node::SPtr root = simulation->createNewGraph("root"); root->setGravity( type::Vec3(0,0,0) ); diff --git a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixLinearSolver.inl b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixLinearSolver.inl index e4e87e3b355..39297dbb067 100644 --- a/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixLinearSolver.inl +++ b/Sofa/Component/LinearSolver/Iterative/src/sofa/component/linearsolver/iterative/MatrixLinearSolver.inl @@ -45,14 +45,14 @@ using namespace sofa::component::linearsystem; template MatrixLinearSolver::MatrixLinearSolver() : Inherit() + , d_parallelInverseProduct(initData(&d_parallelInverseProduct, false, + "parallelInverseProduct", "Parallelize the computation of the product J*M^{-1}*J^T " + "where M is the matrix of the linear system and J is any " + "matrix with compatible dimensions")) , invertData() , linearSystem() , currentMFactor(), currentBFactor(), currentKFactor() , l_linearSystem(initLink("linearSystem", "The linear system to solve")) - , d_parallelInverseProduct(initData(&d_parallelInverseProduct, false, - "parallelInverseProduct", "Parallelize the computation of the product J*M^{-1}*J^T " - "where M is the matrix of the linear system and J is any " - "matrix with compatible dimensions")) { this->addUpdateCallback("parallelInverseProduct", {&d_parallelInverseProduct}, [this](const core::DataTracker& tracker) -> sofa::core::objectmodel::ComponentState diff --git a/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/matrixaccumulators/ConstantLocalMatrix.h b/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/matrixaccumulators/ConstantLocalMatrix.h index cdb9a88978c..4442e1bd00d 100644 --- a/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/matrixaccumulators/ConstantLocalMatrix.h +++ b/Sofa/Component/LinearSystem/src/sofa/component/linearsystem/matrixaccumulators/ConstantLocalMatrix.h @@ -52,6 +52,8 @@ class ConstantLocalMatrix : public virtual AssemblingMatrixAccumulator template void ConstantLocalMatrix::add(const core::matrixaccumulator::no_check_policy&, sofa::SignedIndex row, sofa::SignedIndex col, float value) { + SOFA_UNUSED(row); + SOFA_UNUSED(col); static_cast(this->m_globalMatrix)->colsValue[insertionOrderList[currentId++]] += this->m_cachedFactor * value; } @@ -59,6 +61,8 @@ void ConstantLocalMatrix::add(const core::matrixaccumulator::no_chec template void ConstantLocalMatrix::add(const core::matrixaccumulator::no_check_policy&, sofa::SignedIndex row, sofa::SignedIndex col, double value) { + SOFA_UNUSED(row); + SOFA_UNUSED(col); static_cast(this->m_globalMatrix)->colsValue[insertionOrderList[currentId++]] += this->m_cachedFactor * value; } diff --git a/Sofa/Component/LinearSystem/tests/MatrixLinearSystem_test.cpp b/Sofa/Component/LinearSystem/tests/MatrixLinearSystem_test.cpp index a1e0825af21..bf951a8e182 100644 --- a/Sofa/Component/LinearSystem/tests/MatrixLinearSystem_test.cpp +++ b/Sofa/Component/LinearSystem/tests/MatrixLinearSystem_test.cpp @@ -250,9 +250,23 @@ template dfdx(10, 20) += 0.; } - void addForce(const sofa::core::MechanicalParams*, typename Inherit1::DataVecDeriv& f, const typename Inherit1::DataVecCoord& x, const typename Inherit1::DataVecDeriv& v) override {} - void addDForce(const sofa::core::MechanicalParams* mparams, typename Inherit1::DataVecDeriv& df, const typename Inherit1::DataVecDeriv& dx ) override {} - SReal getPotentialEnergy(const sofa::core::MechanicalParams*, const typename Inherit1::DataVecCoord& x) const override { return 0._sreal; } + void addForce(const sofa::core::MechanicalParams*, typename Inherit1::DataVecDeriv& f, const typename Inherit1::DataVecCoord& x, const typename Inherit1::DataVecDeriv& v) override + { + SOFA_UNUSED(f); + SOFA_UNUSED(x); + SOFA_UNUSED(v); + } + void addDForce(const sofa::core::MechanicalParams* mparams, typename Inherit1::DataVecDeriv& df, const typename Inherit1::DataVecDeriv& dx ) override + { + SOFA_UNUSED(mparams); + SOFA_UNUSED(df); + SOFA_UNUSED(dx); + } + SReal getPotentialEnergy(const sofa::core::MechanicalParams*, const typename Inherit1::DataVecCoord& x) const override + { + SOFA_UNUSED(x); + return 0._sreal; + } }; /// Empty matrix class with the interface of a BaseMatrix @@ -273,26 +287,42 @@ class EmptyMatrix : public sofa::linearalgebra::BaseMatrix } SReal element(Index i, Index j) const override { + SOFA_UNUSED(i); + SOFA_UNUSED(j); return {}; } void resize(Index nbRow, Index nbCol) override { + SOFA_UNUSED(nbRow); + SOFA_UNUSED(nbCol); } void clear() override { } void set(Index i, Index j, double v) override { + SOFA_UNUSED(i); + SOFA_UNUSED(j); + SOFA_UNUSED(v); } void add(Index row, Index col, double v) override { + SOFA_UNUSED(row); + SOFA_UNUSED(col); + SOFA_UNUSED(v); //add method is empty to prevent crashes in tests } void add(Index row, Index col, const sofa::type::Mat3x3d& _M) override { + SOFA_UNUSED(row); + SOFA_UNUSED(col); + SOFA_UNUSED(_M); } void add(Index row, Index col, const sofa::type::Mat3x3f& _M) override { + SOFA_UNUSED(row); + SOFA_UNUSED(col); + SOFA_UNUSED(_M); } static const char* Name() { return "EmptyMatrix"; } }; diff --git a/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.h b/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.h index 7bf769b9c3a..4cc2bfbae6d 100644 --- a/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.h +++ b/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.h @@ -82,41 +82,27 @@ class EllipsoidForceField : public core::behavior::ForceField }; - union - { - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data > contacts; ///< Contacts - Data > d_contacts; ///< Contacts - }; + Data > d_contacts; ///< Vector of contacts + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved contacts; ///< Contacts EllipsoidForceFieldInternalData data; public: - union - { - Data d_center; ///< ellipsoid center - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data center; ///< ellipsoid center - }; - union - { - Data d_vradius; ///< ellipsoid radius - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data vradius; ///< ellipsoid radius - }; - union - { - Data d_stiffness; ///< force stiffness (positive to repulse outward, negative inward) - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data stiffness; ///< force stiffness (positive to repulse outward, negative inward) - }; - union - { - Data d_damping; ///< force damping - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data damping; ///< force damping - }; - union - { - Data d_color; ///< ellipsoid color. (default=0,0.5,1.0,1.0) - SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DEPRECATED() Data color; ///< ellipsoid color. (default=0,0.5,1.0,1.0) - }; + Data d_center; ///< ellipsoid center + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved center; ///< ellipsoid center + + Data d_vradius; ///< ellipsoid radius + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved vradius; ///< ellipsoid radius + + Data d_stiffness; ///< force stiffness (positive to repulse outward, negative inward) + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved stiffness; ///< force stiffness (positive to repulse outward, negative inward) + + Data d_damping; ///< force damping + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved damping; ///< force damping + + Data d_color; ///< ellipsoid color. (default=0,0.5,1.0,1.0) + SOFA_ELLIPSOIDFORCEFIELD_RENAMEDDATA_DISABLED() DeprecatedAndRemoved color; ///< ellipsoid color. (default=0,0.5,1.0,1.0) protected: EllipsoidForceField(); diff --git a/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.inl b/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.inl index 4459517d8eb..49c6a8c2527 100644 --- a/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.inl +++ b/Sofa/Component/MechanicalLoad/src/sofa/component/mechanicalload/EllipsoidForceField.inl @@ -57,7 +57,7 @@ namespace sofa::component::mechanicalload template EllipsoidForceField::EllipsoidForceField() - : d_contacts(initData(&d_contacts,"contacts", "Contacts")) + : d_contacts(initData(&d_contacts,"contacts", "Vector of contacts")) , d_center(initData(&d_center, "center", "ellipsoid center")) , d_vradius(initData(&d_vradius, "vradius", "ellipsoid radius")) , d_stiffness(initData(&d_stiffness, (Real)500, "stiffness", "force stiffness (positive to repulse outward, negative inward)")) @@ -69,12 +69,6 @@ EllipsoidForceField::EllipsoidForceField() template EllipsoidForceField::~EllipsoidForceField() { - d_contacts.~Data(); - d_center.~Data(); - d_vradius.~Data(); - d_stiffness.~Data(); - d_damping.~Data(); - d_color.~Data(); } template @@ -115,7 +109,7 @@ void EllipsoidForceField::addForce(const sofa::core::MechanicalParams { Coord dp = p1[i] - center; Real norm2 = 0; - for (int j=0; j void TriangularFEMForceFieldOptim::computePrincipalStress() { const VecElement& triangles = m_topology->getTriangles(); - - sofa::helper::ReadAccessor< core::objectmodel::Data< VecTriangleState > > triStates = d_triangleState; sofa::helper::WriteAccessor< core::objectmodel::Data< VecTriangleInfo > > triInfos = d_triangleInfo; Real minStress = 0; diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixGeneric.h b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixGeneric.h index 4647c6f9a1a..31fd33baf5c 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixGeneric.h +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixGeneric.h @@ -263,7 +263,7 @@ public : /// Returns the range of indices from the column indices corresponding to the id-th row Range getRowRange(Index id) const { - if (id + 1 >= rowBegin.size()) + if (id + 1 >= static_cast(rowBegin.size())) { return Range(s_invalidIndex, s_invalidIndex); } diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/DefaultAnimationLoop.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/DefaultAnimationLoop.cpp index 0bf53d191c8..5d54680785b 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/DefaultAnimationLoop.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/DefaultAnimationLoop.cpp @@ -71,6 +71,7 @@ DefaultAnimationLoop::DefaultAnimationLoop(simulation::Node* _m_node) : Inherit() , d_parallelODESolving(initData(&d_parallelODESolving, false, "parallelODESolving", "If true, solves all the ODEs in parallel")) { + SOFA_UNUSED(_m_node); this->addUpdateCallback("parallelODESolving", {&d_parallelODESolving}, [this](const core::DataTracker& tracker) -> sofa::core::objectmodel::ComponentState { diff --git a/applications/collections/deprecated/modules/SofaMiscCollision/SofaMiscCollision_test/DefaultCollisionGroupManager_test.cpp b/applications/collections/deprecated/modules/SofaMiscCollision/SofaMiscCollision_test/DefaultCollisionGroupManager_test.cpp index 8c5514b3658..8df65f4ce69 100644 --- a/applications/collections/deprecated/modules/SofaMiscCollision/SofaMiscCollision_test/DefaultCollisionGroupManager_test.cpp +++ b/applications/collections/deprecated/modules/SofaMiscCollision/SofaMiscCollision_test/DefaultCollisionGroupManager_test.cpp @@ -58,15 +58,15 @@ void DefaultCollisionGroupManager_test::onSetUp() + "/DefaultCollisionGroupManager_singleObject_test.scn"; // Init simulation - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); - root = sofa::simulation::getSimulation()->load(sceneFilename.c_str()); + simulation = sofa::simulation::getSimulation(); + root = sofa::simulation::node::load(sceneFilename.c_str()); } void DefaultCollisionGroupManager_test::onTearDown() { if (root != nullptr) { - sofa::simulation::getSimulation()->unload(root); + sofa::simulation::node::unload(root); } } @@ -75,7 +75,7 @@ bool DefaultCollisionGroupManager_test::combineSingleObject() EXPECT_TRUE(root != nullptr); EXPECT_TRUE(sofa::simulation::getSimulation() != nullptr); - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::node::initRoot(root.get()); // run 200 time steps // objectives: @@ -83,7 +83,7 @@ bool DefaultCollisionGroupManager_test::combineSingleObject() // 2) Collision prevents the cube to fall through the floor for (unsigned int i = 0; i < 200; ++i) { - sofa::simulation::getSimulation()->animate(root.get(), 0.01); + sofa::simulation::node::animate(root.get(), 0.01); } auto* baseObject = root->getTreeNode("Cube1")->getObject("mechanicalObject"); diff --git a/applications/collections/deprecated/modules/SofaValidation/SofaValidation_test/Monitor_test.cpp b/applications/collections/deprecated/modules/SofaValidation/SofaValidation_test/Monitor_test.cpp index 4f71d377d38..5c6024decd5 100644 --- a/applications/collections/deprecated/modules/SofaValidation/SofaValidation_test/Monitor_test.cpp +++ b/applications/collections/deprecated/modules/SofaValidation/SofaValidation_test/Monitor_test.cpp @@ -147,7 +147,7 @@ struct Monitor_test : public BaseSimulationTest // make a few steps before checkinf if values are correctly updated in // Monitor for (int i = 0; i < 10; ++i) - simulation::getSimulation()->animate(root.get(), 1.0); + simulation::node::animate(root.get(), 1.0); monitor->testModif(mo.get()); diff --git a/applications/plugins/CollisionOBBCapsule/examples/benchmark_cubes.scn b/applications/plugins/CollisionOBBCapsule/examples/benchmark_cubes.scn index e3e29fe85d1..bf34abd651d 100644 --- a/applications/plugins/CollisionOBBCapsule/examples/benchmark_cubes.scn +++ b/applications/plugins/CollisionOBBCapsule/examples/benchmark_cubes.scn @@ -43,7 +43,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -163,7 +163,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -187,7 +187,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -203,7 +203,7 @@ - + @@ -211,7 +211,7 @@ - + @@ -219,7 +219,7 @@ - + @@ -227,7 +227,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -243,7 +243,7 @@ - + @@ -251,7 +251,7 @@ - + @@ -259,7 +259,7 @@ - + @@ -267,7 +267,7 @@ - + @@ -275,7 +275,7 @@ - + @@ -283,7 +283,7 @@ - + @@ -291,7 +291,7 @@ - + @@ -299,7 +299,7 @@ - + @@ -307,7 +307,7 @@ - + @@ -315,7 +315,7 @@ - + @@ -323,7 +323,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -339,7 +339,7 @@ - + @@ -347,7 +347,7 @@ - + @@ -355,7 +355,7 @@ - + @@ -363,7 +363,7 @@ - + @@ -371,7 +371,7 @@ - + @@ -379,7 +379,7 @@ - + @@ -387,7 +387,7 @@ - + @@ -395,7 +395,7 @@ - + @@ -403,7 +403,7 @@ - + @@ -411,7 +411,7 @@ - + @@ -419,7 +419,7 @@ - + @@ -427,7 +427,7 @@ - + @@ -435,7 +435,7 @@ - + @@ -443,7 +443,7 @@ - + @@ -451,7 +451,7 @@ - + @@ -459,7 +459,7 @@ - + @@ -467,7 +467,7 @@ - + @@ -475,7 +475,7 @@ - + @@ -483,7 +483,7 @@ - + @@ -491,7 +491,7 @@ - + @@ -499,7 +499,7 @@ - + @@ -507,7 +507,7 @@ - + @@ -515,7 +515,7 @@ - + @@ -523,7 +523,7 @@ - + @@ -531,7 +531,7 @@ - + @@ -539,7 +539,7 @@ - + @@ -547,7 +547,7 @@ - + @@ -555,7 +555,7 @@ - + @@ -563,7 +563,7 @@ - + @@ -571,7 +571,7 @@ - + @@ -579,7 +579,7 @@ - + @@ -587,7 +587,7 @@ - + @@ -595,7 +595,7 @@ - + @@ -603,7 +603,7 @@ - + @@ -611,7 +611,7 @@ - + diff --git a/applications/plugins/MultiThreading/src/MultiThreading/TaskSchedulerUser.cpp b/applications/plugins/MultiThreading/src/MultiThreading/TaskSchedulerUser.cpp index c005b5ee945..a60da64108f 100644 --- a/applications/plugins/MultiThreading/src/MultiThreading/TaskSchedulerUser.cpp +++ b/applications/plugins/MultiThreading/src/MultiThreading/TaskSchedulerUser.cpp @@ -65,7 +65,7 @@ void TaskSchedulerUser::reinitTaskScheduler() if (m_taskScheduler) { const auto nbThreads = d_nbThreads.getValue(); - if ( nbThreads != m_taskScheduler->getThreadCount() ) + if ( nbThreads != static_cast(m_taskScheduler->getThreadCount()) ) { m_taskScheduler->init(nbThreads); sofa::simulation::initThreadLocalData(); diff --git a/applications/plugins/MultiThreading/src/MultiThreading/component/linearsolver/iterative/ParallelCompressedRowSparseMatrixMechanical.h b/applications/plugins/MultiThreading/src/MultiThreading/component/linearsolver/iterative/ParallelCompressedRowSparseMatrixMechanical.h index 2f12e06811d..c246aae0a7c 100644 --- a/applications/plugins/MultiThreading/src/MultiThreading/component/linearsolver/iterative/ParallelCompressedRowSparseMatrixMechanical.h +++ b/applications/plugins/MultiThreading/src/MultiThreading/component/linearsolver/iterative/ParallelCompressedRowSparseMatrixMechanical.h @@ -125,7 +125,7 @@ class ParallelCompressedRowSparseMatrixMechanical : public sofa::linearalgebra:: // transfer a chunk of large vector to a local block-sized vector sofa::type::Vec v; //Index jN = colsIndex[xj] * NC; // scalar column index - for (Index bj = 0; bj < NC; ++bj) + for (sofa::Index bj = 0; bj < NC; ++bj) { v[bj] = vget(vec, m_crs.colsIndex[xj], NC, bj); } @@ -133,9 +133,9 @@ class ParallelCompressedRowSparseMatrixMechanical : public sofa::linearalgebra:: // multiply the block with the local vector const typename Base::Block& b = m_crs.colsValue[xj]; // non-null block has block-indices (rowIndex[xi],colsIndex[xj]) and value colsValue[xj] - for (Index bi = 0; bi < NL; ++bi) + for (sofa::Index bi = 0; bi < NL; ++bi) { - for (Index bj = 0; bj < NC; ++bj) + for (sofa::Index bj = 0; bj < NC; ++bj) { r[bi] += Base::traits::v(b, bi, bj) * v[bj]; } @@ -144,7 +144,7 @@ class ParallelCompressedRowSparseMatrixMechanical : public sofa::linearalgebra:: // transfer the local result to the large result vector //Index iN = rowIndex[xi] * NL; // scalar row index - for (Index bi = 0; bi < NL; ++bi) + for (sofa::Index bi = 0; bi < NL; ++bi) { vset(res, m_crs.rowIndex[xi], NL, bi, r[bi]); } diff --git a/applications/plugins/SensableEmulation/examples/SimpleBox-Method2.scn b/applications/plugins/SensableEmulation/examples/SimpleBox-Method2.scn index f1ad8c485b3..becbb2480b0 100644 --- a/applications/plugins/SensableEmulation/examples/SimpleBox-Method2.scn +++ b/applications/plugins/SensableEmulation/examples/SimpleBox-Method2.scn @@ -53,7 +53,7 @@ - + diff --git a/applications/plugins/image/image_test/ImageEngine_test.cpp b/applications/plugins/image/image_test/ImageEngine_test.cpp index 9549af5a122..50ad94855fa 100644 --- a/applications/plugins/image/image_test/ImageEngine_test.cpp +++ b/applications/plugins/image/image_test/ImageEngine_test.cpp @@ -54,7 +54,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest void TearDown() { if (root!=NULL) - sofa::simulation::getSimulation()->unload(root); + sofa::simulation::node::unload(root); } // Test link @@ -130,7 +130,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest TestImageEngine::SPtr imageEngine; // Create a scene - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + simulation = sofa::simulation::getSimulation(); // Root node root = simulation->createNewGraph("root"); @@ -156,12 +156,12 @@ struct ImageEngine_test : public sofa::testing::BaseTest sofa::modeling::setDataLink(&imageEngine->outputImage,&imageEngine2->inputImage); // Init simulation - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::node::initRoot(root.get()); // do several steps of animation for(int l=0;l<2;++l) { - sofa::simulation::getSimulation()->animate(root.get(),0.5); + sofa::simulation::node::animate(root.get(),0.5); } // Check if pointers of images that should be shared are equal @@ -190,7 +190,7 @@ struct ImageEngine_test : public sofa::testing::BaseTest ImageViewer::SPtr imageViewer; // Create a scene - sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation()); + simulation = sofa::simulation::getSimulation(); // Root node root = simulation->createNewGraph("root"); @@ -221,12 +221,12 @@ struct ImageEngine_test : public sofa::testing::BaseTest //sofa::modeling::setDataLink(&imageContainer->image,&imageViewer->image); // Init simulation - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::node::initRoot(root.get()); // do several steps of animation for(int l=0;l<2;++l) { - sofa::simulation::getSimulation()->animate(root.get(),0.5); + sofa::simulation::node::animate(root.get(),0.5); } diff --git a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsBindings.cpp b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsBindings.cpp index 0e2ae2a3573..c3e83065873 100644 --- a/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsBindings.cpp +++ b/applications/projects/SofaPhysicsAPI/src/SofaPhysicsAPI/SofaPhysicsBindings.cpp @@ -354,7 +354,7 @@ int sofaVisualModel_getNbEdges(void* api_ptr, const char* name) } -int sofaVisualModel_getEdges(void* api_ptr, const char* name, int* buffer) +int sofaVisualModel_getEdges(void* /*api_ptr*/, const char* /*name*/, int* /*buffer*/) { //TODO diff --git a/applications/tutorials/chainHybrid/chainHybrid.cpp b/applications/tutorials/chainHybrid/chainHybrid.cpp index fd5245e43ab..54351897099 100644 --- a/applications/tutorials/chainHybrid/chainHybrid.cpp +++ b/applications/tutorials/chainHybrid/chainHybrid.cpp @@ -244,7 +244,6 @@ int main(int argc, char** argv) sofa::gui::common::GUIManager::Init(argv[0]); auto simulation = sofa::simpleapi::createSimulation(); - sofa::simulation::setSimulation( simulation.get() ); // The graph root node Node::SPtr root = sofa::modeling::createRootWithCollisionPipeline(); @@ -255,7 +254,7 @@ int main(int argc, char** argv) root->setAnimate(false); - sofa::simulation::getSimulation()->init(root.get()); + sofa::simulation::node::initRoot(root.get()); //======================================= diff --git a/applications/tutorials/compositeObject/compositeObject.cpp b/applications/tutorials/compositeObject/compositeObject.cpp index ede322d8a9a..cd9a2cefe61 100644 --- a/applications/tutorials/compositeObject/compositeObject.cpp +++ b/applications/tutorials/compositeObject/compositeObject.cpp @@ -256,13 +256,11 @@ int main(int argc, char** argv) if (int err=sofa::gui::common::GUIManager::createGUI(NULL)) return err; sofa::gui::common::GUIManager::SetDimension(800,600); - sofa::simulation::setSimulation(new sofa::simulation::graph::DAGSimulation()); - //================================================= sofa::simulation::Node::SPtr groot = createGridScene(Vec3(0,0,0), Vec3(5,1,1), 6,2,2, 1.0 ); //================================================= - sofa::simulation::getSimulation()->init(groot.get()); + sofa::simulation::node::initRoot(groot.get()); sofa::gui::common::GUIManager::SetScene(groot); groot->setAnimate(true); @@ -271,7 +269,7 @@ int main(int argc, char** argv) if (int err = sofa::gui::common::GUIManager::MainLoop(groot)) return err; - sofa::simulation::getSimulation()->unload(groot); + sofa::simulation::node::unload(groot); sofa::gui::common::GUIManager::closeGUI(); sofa::simulation::graph::cleanup(); diff --git a/applications/tutorials/mixedPendulum/mixedPendulum.cpp b/applications/tutorials/mixedPendulum/mixedPendulum.cpp index f7084a5ed35..41e2a186ac0 100644 --- a/applications/tutorials/mixedPendulum/mixedPendulum.cpp +++ b/applications/tutorials/mixedPendulum/mixedPendulum.cpp @@ -66,7 +66,6 @@ int main(int argc, char** argv) double splength = 1.; //-------------------- The graph root node - sofa::simulation::setSimulation(new sofa::simulation::graph::DAGSimulation()); auto groot = sofa::simulation::getSimulation()->createNewGraph("root"); groot->setGravity({ 0,-10,0 }); @@ -199,7 +198,7 @@ int main(int argc, char** argv) sofa::gui::common::GUIManager::SetDimension(800, 600); //=========================== Init the scene - sofa::simulation::getSimulation()->init(groot.get()); + sofa::simulation::node::initRoot(groot.get()); sofa::gui::common::GUIManager::SetScene(groot); groot->setAnimate(true); @@ -208,9 +207,8 @@ int main(int argc, char** argv) sofa::gui::common::GUIManager::MainLoop(groot); if (groot != NULL) - sofa::simulation::getSimulation()->unload(groot); + sofa::simulation::node::unload(groot); sofa::simulation::graph::cleanup(); return 0; } - diff --git a/applications/tutorials/oneParticle/oneParticle.cpp b/applications/tutorials/oneParticle/oneParticle.cpp index b8f405609b4..f0697745daa 100644 --- a/applications/tutorials/oneParticle/oneParticle.cpp +++ b/applications/tutorials/oneParticle/oneParticle.cpp @@ -64,7 +64,6 @@ int main(int argc, char** argv) sofa::gui::common::GUIManager::Init(argv[0]); // The graph root node - sofa::simulation::setSimulation(new sofa::simulation::graph::DAGSimulation()); sofa::simulation::Node::SPtr groot = sofa::simulation::getSimulation()->createNewGraph("root"); groot->setGravity({ 0,-10,0 }); @@ -113,7 +112,7 @@ int main(int argc, char** argv) flags.setShowCollisionModels(true); style->displayFlags.endEdit(); - sofa::simulation::graph::getSimulation()->init(groot.get()); + sofa::simulation::node::initRoot(groot.get()); groot->setAnimate(false); //======================================