diff --git a/BeamAdapter_test/component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp b/BeamAdapter_test/component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp index 774f2c25e..1c99e90db 100644 --- a/BeamAdapter_test/component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp +++ b/BeamAdapter_test/component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp @@ -159,7 +159,6 @@ struct AdaptiveBeamForceFieldAndMassTest : public sofa::testing::BaseSimulationT EXPECT_NEAR(positions[id][2], 0, 1e-4); // run some simulation steps - auto simulation = sofa::simulation::getSimulation(); for (int i = 0; i < nbrStep; i++) { sofa::simulation::node::animate(root.get(), 0.01); diff --git a/BeamAdapter_test/component/model/WireRestShape_test.cpp b/BeamAdapter_test/component/model/WireRestShape_test.cpp index c41d9f054..bb896bc90 100644 --- a/BeamAdapter_test/component/model/WireRestShape_test.cpp +++ b/BeamAdapter_test/component/model/WireRestShape_test.cpp @@ -175,7 +175,7 @@ void WireRestShape_test::testParameterInit() EXPECT_EQ(nbP_density.size(), 2); EXPECT_EQ(nbP_density, nbP_density_ref); - Real dx1, dx2, dx3, nbEdgesCol_ref = 20; + Real dx1, dx2, dx3; wire->getCollisionSampling(dx1, 0.0); wire->getCollisionSampling(dx2, fullLength); wire->getCollisionSampling(dx3, 90.0); diff --git a/CMakeLists.txt b/CMakeLists.txt index f940cd090..c757c96c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,7 +182,7 @@ SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "plugins") # Config files and install rules for pythons scripts -sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python") +sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "examples/python3") sofa_add_subdirectory(plugin extensions/CUDA BeamAdapter.CUDA) diff --git a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py index 3bfc94fb9..146416c22 100644 --- a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py +++ b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py @@ -15,7 +15,7 @@ def createScene(rootNode): rootNode.addObject('DefaultVisualManagerLoop') rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', tolerance="1e-3", maxIterations="5000", unbuilt="false") + rootNode.addObject('GenericConstraintSolver', tolerance="1e-3", maxIterations="5000", resolutionMethod="UnbuiltGaussSeidel") rootNode.addObject('CollisionPipeline', depth="6", verbose="0", draw="1") rootNode.addObject('BruteForceBroadPhase', name='N2') rootNode.addObject('BVHNarrowPhase') diff --git a/src/BeamAdapter/component/BeamInterpolation.inl b/src/BeamAdapter/component/BeamInterpolation.inl index d5bd84fc7..0fd175fd5 100644 --- a/src/BeamAdapter/component/BeamInterpolation.inl +++ b/src/BeamAdapter/component/BeamInterpolation.inl @@ -538,14 +538,16 @@ template void BeamInterpolation::getYoungModulusAtX(int beamId, Real& /*x_curv*/, Real& youngModulus, Real& cPoisson) { const auto& defaultYoungModuli = d_defaultYoungModulus.getValue(); - if (beamId < defaultYoungModuli.size()) { + if (beamId < int(defaultYoungModuli.size())) { + youngModulus = defaultYoungModuli[beamId]; } else { youngModulus = m_defaultYoungModulus; } const auto& poissonRatios = d_poissonRatio.getValue(); - if (beamId < poissonRatios.size()) { + if (beamId < int(poissonRatios.size())) { + cPoisson = poissonRatios[beamId]; } else { cPoisson = m_defaultPoissonRatio; diff --git a/src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.inl b/src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.inl index 9d875919b..fa02b9109 100644 --- a/src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.inl +++ b/src/BeamAdapter/component/constraint/AdaptiveBeamLengthConstraint.inl @@ -49,10 +49,12 @@ public: AdaptiveBeamLengthConstraintResolution(SReal* initF=nullptr, bool* active=nullptr) : ConstraintResolution(1) ,m_initF(initF), m_active(active) { } - void init(int line, SReal** w, SReal* force) override; - void resolution(int line, SReal** w, SReal* d, SReal* force); - void store(int line, SReal* force, bool convergence) override; + virtual void init(int line, SReal** w, SReal* force) override; + virtual void store(int line, SReal* force, bool convergence) override; + using sofa::core::behavior::ConstraintResolution::resolution; + void resolution(int line, SReal** w, SReal* d, SReal* force); + protected: SReal* m_initF; bool* m_active; diff --git a/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.inl b/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.inl index 0d24c7736..695d9aaf1 100644 --- a/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.inl +++ b/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.inl @@ -284,7 +284,7 @@ void AdaptiveBeamSlidingConstraint::draw(const VisualParams* vparams) points.reserve(x.size()); colors.reserve(x.size()); - for (auto i = 0; i < x.size(); i++) + for (sofa::Size i = 0; i < x.size(); i++) { point = DataTypes::getCPos(x[i]); points.push_back(point); diff --git a/src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl b/src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl index b1960b416..d3777ad82 100644 --- a/src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl +++ b/src/BeamAdapter/component/constraint/ImplicitSurfaceAdaptiveConstraint.inl @@ -639,7 +639,7 @@ void ImplicitSurfaceAdaptiveConstraint::draw(const core::visual::Visu const auto stateLifeCycle = vparams->drawTool()->makeStateLifeCycle(); vparams->drawTool()->disableLighting(); - std::vector pointsToDraw; + std::vector pointsToDraw; std::vector colors; typename sofa::type::vector::iterator it = m_vecPotentialContact.begin(); @@ -664,7 +664,7 @@ void ImplicitSurfaceAdaptiveConstraint::draw(const core::visual::Visu vparams->drawTool()->drawPoints(pointsToDraw, 2, colors); colors.clear(); - std::vector linesToDraw; + std::vector linesToDraw; for (unsigned int i=0; i::onBeginAnimationStep(const double / else { const type::vector& times = d_timeSteps.getValue(); - if (!times.empty() && m_readStep < times.size()) + if (!times.empty() && m_readStep < int(times.size())) { const Real& time = times[m_readStep]; diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl index 5b96e4748..ab1b876f9 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl @@ -366,10 +366,10 @@ void InterventionalRadiologyController::onBeginAnimationStep(const do template void InterventionalRadiologyController::applyAction(sofa::beamadapter::BeamAdapterAction action) { - int id = d_controlledInstrument.getValue(); - if (id >= m_instrumentsList.size()) + int id = d_controlledInstrument.getValue(); + if (id >= int(m_instrumentsList.size())) { - msg_warning() << "Controlled Instument num " << id << " does not exist (size =" << m_instrumentsList.size() << ")."; + msg_warning() << "Controlled Instrument num " << id << " does not exist (size =" << m_instrumentsList.size() << ")."; return; } @@ -403,7 +403,7 @@ void InterventionalRadiologyController::applyAction(sofa::beamadapter } case BeamAdapterAction::SWITCH_NEXT_TOOL: { - if (id + 1 >= m_instrumentsList.size()) + if (id + 1 >= int(m_instrumentsList.size())) msg_warning() << "Switching to next tool is not possible, no more instrument in list."; else d_controlledInstrument.setValue(id + 1); @@ -455,7 +455,7 @@ void InterventionalRadiologyController::computeInstrumentsCurvAbs(typ // Step 2 => add the beams given the sampling parameters double maxAbsLength=0.0; Real xSampling = 0.0; - for (auto i=0; i xP_noticeable_I; type::vector< int > density_I; diff --git a/src/BeamAdapter/component/engine/WireRestShape.inl b/src/BeamAdapter/component/engine/WireRestShape.inl index 7a2a759fd..650bdcd36 100644 --- a/src/BeamAdapter/component/engine/WireRestShape.inl +++ b/src/BeamAdapter/component/engine/WireRestShape.inl @@ -149,7 +149,7 @@ bool WireRestShape::initTopology() Real prev_length = 0.0; int prev_edges = 0; int startPtId = 0; - for (auto i = 0; i < l_sectionMaterials.size(); ++i) + for (sofa::Size i = 0; i < l_sectionMaterials.size(); ++i) { // Add topology of the material int nbrVisuEdges = l_sectionMaterials.get(i)->getNbVisualEdges(); @@ -212,7 +212,7 @@ void WireRestShape::getCollisionSampling(Real &dx, const Real &x_curv } // Check in which section x_used belongs to and get access to this section material - for (auto i = 1; i< keyPts.size(); ++i) + for (sofa::Size i = 1; i< keyPts.size(); ++i) { if (x_used <= keyPts[i]) { @@ -245,7 +245,7 @@ void WireRestShape::getRestTransformOnX(Transform &global_H_local, co } const type::vector& keyPts = d_keyPoints.getValue(); - for (auto i = 1; i < keyPts.size(); ++i) + for (sofa::Size i = 1; i < keyPts.size(); ++i) { if (x_used <= keyPts[i]) { @@ -264,7 +264,7 @@ void WireRestShape::getYoungModulusAtX(const Real& x_curv, Real& youn const type::vector& keyPts = d_keyPoints.getValue(); // Depending on the position of the beam, determine the corresponding section material and returning its Young modulus - for (auto i = 1; i < keyPts.size(); ++i) + for (sofa::Size i = 1; i < keyPts.size(); ++i) { if (x_used <= keyPts[i]) { @@ -283,7 +283,7 @@ void WireRestShape::getInterpolationParam(const Real& x_curv, Real &_ const type::vector& keyPts = d_keyPoints.getValue(); // Check in which section x_used belongs to and get access to this section material - for (auto i = 1; i < keyPts.size(); ++i) + for (sofa::Size i = 1; i < keyPts.size(); ++i) { if (x_used <= keyPts[i]) { @@ -306,7 +306,7 @@ template void WireRestShape::getNumberOfCollisionSegment(Real &dx, unsigned int &numLines) { numLines = 0; - for (auto i = 0; i < l_sectionMaterials.size(); ++i) + for (sofa::Size i = 0; i < l_sectionMaterials.size(); ++i) { numLines += l_sectionMaterials.get(i)->getNbCollisionEdges(); } diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl index 918d5cf13..474c5fbf5 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.inl @@ -178,6 +178,7 @@ void AdaptiveBeamForceFieldAndMass::computeStiffness(int beamId, Beam template void AdaptiveBeamForceFieldAndMass::computeMass(int beamId, BeamLocalMatrices& beamLocalMatrix) { + SOFA_UNUSED(beamId); Real L2 = (Real) (beamLocalMatrix._L * beamLocalMatrix._L); beamLocalMatrix.m_M00.clear(); beamLocalMatrix.m_M01.clear(); beamLocalMatrix.m_M10.clear(); beamLocalMatrix.m_M11.clear(); diff --git a/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl b/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl index eef8d7c45..b3d8f28cd 100644 --- a/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl +++ b/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl @@ -666,7 +666,6 @@ void AdaptiveBeamMapping< TIn, TOut>::computeDistribution() else { m_pointBeamDistribution.reserve(points.size()); - const bool printLog = this->f_printLog.getValue(); for (unsigned int i=0; i::reset() template void BeamLengthMapping< TIn, TOut>::apply(const MechanicalParams* mparams, Data& dOut, const Data& dIn) { + SOFA_UNUSED(mparams); SCOPED_TIMER("AdaptiveBeamMappingApply"); VecCoord& out = *dOut.beginEdit(); @@ -591,6 +592,7 @@ void BeamLengthMapping< TIn, TOut>::applyDJT(const MechanicalParams* mparams, co template void BeamLengthMapping::updateK(const core::MechanicalParams* mparams, core::ConstMultiVecDerivId childForceId ) { + SOFA_UNUSED(mparams); const unsigned& geometricStiffness = d_geometricStiffness.getValue(); if( !geometricStiffness ) { K_geom.resize(0,0); return; } //helper::ReadAccessor > childForce( *childForceId[(const core::State*)this->getToModels()[0]].read() ); diff --git a/src/BeamAdapter/component/mapping/BeamProjectionDifferenceMultiMapping.inl b/src/BeamAdapter/component/mapping/BeamProjectionDifferenceMultiMapping.inl index ca2a64f27..1b5833e87 100644 --- a/src/BeamAdapter/component/mapping/BeamProjectionDifferenceMultiMapping.inl +++ b/src/BeamAdapter/component/mapping/BeamProjectionDifferenceMultiMapping.inl @@ -62,7 +62,7 @@ BeamProjectionDifferenceMultiMapping::BeamProjectionDifference , m_updateJ(false) { auto directions = sofa::helper::getWriteAccessor(d_directions); - directions.resize(OutDeriv::total_size, true); + directions.resize(OutDeriv::total_size); } @@ -145,7 +145,7 @@ void BeamProjectionDifferenceMultiMapping::computeProjection(c Real distMin = std::numeric_limits::max(); // find the min distance between P and its projection on each edge of xTo - for (int e=0; e