diff --git a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.cpp b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.cpp index 66c5743e5fd..ae7faf39edc 100644 --- a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.cpp +++ b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.cpp @@ -19,6 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#define SOFA_COMPONENT_ANIMATIONLOOP_CONSTRAINTANIMATIONLOOP_CPP #include #include diff --git a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.h b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.h index cef90c2248d..6f4c3351d68 100644 --- a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.h +++ b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/ConstraintAnimationLoop.h @@ -22,7 +22,9 @@ #pragma once #include +#if !defined(SOFA_COMPONENT_ANIMATIONLOOP_CONSTRAINTANIMATIONLOOP_CPP) SOFA_HEADER_DEPRECATED_NOT_REPLACED("v26.06", "v26.12") +#endif #include diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.inl b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.inl index 401e5481c75..2e939fa60bf 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.inl +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.inl @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include #include diff --git a/Sofa/Component/IntegrationScheme/Backward/src/sofa/component/integrationscheme/backward/StaticEquilibriumIntegrationScheme.cpp b/Sofa/Component/IntegrationScheme/Backward/src/sofa/component/integrationscheme/backward/StaticEquilibriumIntegrationScheme.cpp index 6cf3399d02c..934fb2c4acd 100644 --- a/Sofa/Component/IntegrationScheme/Backward/src/sofa/component/integrationscheme/backward/StaticEquilibriumIntegrationScheme.cpp +++ b/Sofa/Component/IntegrationScheme/Backward/src/sofa/component/integrationscheme/backward/StaticEquilibriumIntegrationScheme.cpp @@ -26,12 +26,11 @@ #include #include #include +#include #include #include #include -#include -using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor; namespace sofa::component::integrationscheme::backward @@ -181,7 +180,7 @@ void StaticEquilibriumIntegrationScheme::integrate(const core::ExecParams* param //Already make a full step updateStatesFromLinearSolution(alpha, firstIt); - m_mop->propagateX(xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefield + sofa::simulation::common::DifferentialOperations::pushforwardCoord(m_mappingGraph, m_mop->mparams, xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefield computeRHS(false); newResidue = evaluateResidual(); @@ -209,7 +208,7 @@ void StaticEquilibriumIntegrationScheme::integrate(const core::ExecParams* param alpha -= delta; updateStatesFromLinearSolution(-delta, false); - m_mop->propagateX(xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefield + sofa::simulation::common::DifferentialOperations::pushforwardCoord(m_mappingGraph, m_mop->mparams, xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefield computeRHS(false); newResidue = evaluateResidual(); @@ -226,7 +225,7 @@ void StaticEquilibriumIntegrationScheme::integrate(const core::ExecParams* param if (fabs(alpha - bestalpha )> std::numeric_limits::epsilon() ) { updateStatesFromLinearSolution( bestalpha - alpha, false); - m_mop->propagateX(xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefileld + sofa::simulation::common::DifferentialOperations::pushforwardCoord(m_mappingGraph, m_mop->mparams, xResult); //Need to propagate explicitly to enable recomputation of mapped Forcefileld computeRHS(false); newResidue = evaluateResidual(); diff --git a/Sofa/Component/IntegrationScheme/Forward/src/sofa/component/integrationscheme/forward/EulerExplicitIntegrationScheme.cpp b/Sofa/Component/IntegrationScheme/Forward/src/sofa/component/integrationscheme/forward/EulerExplicitIntegrationScheme.cpp index e82ad8f2fd2..07d86b22c8b 100644 --- a/Sofa/Component/IntegrationScheme/Forward/src/sofa/component/integrationscheme/forward/EulerExplicitIntegrationScheme.cpp +++ b/Sofa/Component/IntegrationScheme/Forward/src/sofa/component/integrationscheme/forward/EulerExplicitIntegrationScheme.cpp @@ -29,10 +29,8 @@ #include #include #include -#include #include "sofa/simulation/integrationscheme/ImplicitIntegrationScheme.h" -using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor; namespace sofa::component::integrationscheme::forward { diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/impl/rotations/RotationMethodsContainer.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/impl/rotations/RotationMethodsContainer.h index ea708f32316..f4f84998014 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/impl/rotations/RotationMethodsContainer.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/impl/rotations/RotationMethodsContainer.h @@ -21,7 +21,7 @@ ******************************************************************************/ #pragma once -#include +#include #include namespace sofa::component::solidmechanics::fem::elastic @@ -65,7 +65,7 @@ struct RotationMethodsContainer static constexpr auto NumberOfMethods = std::variant_size_v; - explicit RotationMethodsContainer(sofa::core::objectmodel::BaseObject* parent) + explicit RotationMethodsContainer(sofa::core::objectmodel::BaseComponent* parent) : d_rotationMethod(parent->initData(&d_rotationMethod, "rotationMethod", ("The method used to compute the element rotations.\n" + RotationMethodsItems::dataDescription()).c_str())) {} diff --git a/Sofa/Component/SolidMechanics/FEM/HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/hyperelasticmaterials/LinearMechanicalParametersComponent.h b/Sofa/Component/SolidMechanics/FEM/HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/hyperelasticmaterials/LinearMechanicalParametersComponent.h index 912e984a1e4..1d5509f6a17 100644 --- a/Sofa/Component/SolidMechanics/FEM/HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/hyperelasticmaterials/LinearMechanicalParametersComponent.h +++ b/Sofa/Component/SolidMechanics/FEM/HyperElastic/src/sofa/component/solidmechanics/fem/hyperelastic/hyperelasticmaterials/LinearMechanicalParametersComponent.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_LINEAR_MECHANICAL_PARAMETERS_CPP) #include @@ -32,12 +32,12 @@ namespace sofa::component::solidmechanics::fem::hyperelastic { template -class LinearMechanicalParametersComponent : public virtual sofa::core::objectmodel::BaseObject +class LinearMechanicalParametersComponent : public virtual sofa::core::objectmodel::BaseComponent { using Real = sofa::Real_t; public: - SOFA_CLASS(LinearMechanicalParametersComponent, sofa::core::objectmodel::BaseObject); + SOFA_CLASS(LinearMechanicalParametersComponent, sofa::core::objectmodel::BaseComponent); sofa::Data d_poissonRatio; sofa::Data d_youngModulus; diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.inl b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.inl index 33b610dee9d..9140ea8d658 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.inl +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.inl @@ -481,8 +481,8 @@ auto TriangleSetGeometryAlgorithms< DataTypes >::computeTriangleBarycoefs( const TriangleID ind_t, const sofa::type::Vec<3,Real> &p) const -> sofa::type::vector { - const Triangle &t=this->m_topology->getTriangle(ind_t); - return compute3PointsBarycoefs(p, t[0], t[1], t[2],false); + const auto coefs = computeTriangleBarycentricCoordinates(ind_t, p, false); + return sofa::type::vector{ coefs[0], coefs[1], coefs[2] }; } template @@ -506,8 +506,8 @@ auto TriangleSetGeometryAlgorithms< DataTypes >::computeRestTriangleBarycoefs( const TriangleID ind_t, const sofa::type::Vec<3, Real>& p) const -> sofa::type::vector { - const Triangle& t = this->m_topology->getTriangle(ind_t); - return compute3PointsBarycoefs(p, t[0], t[1], t[2], true); + const auto coefs = computeTriangleBarycentricCoordinates(ind_t, p, true); + return sofa::type::vector{ coefs[0], coefs[1], coefs[2] }; } // barycentric coefficients of point p in triangle whose vertices are indexed by (ind_p1,ind_p2,ind_p3) @@ -2730,7 +2730,7 @@ bool TriangleSetGeometryAlgorithms::computeIntersectedObjectsList (co } else { - auto coefs_a = computeTriangleBarycoefs (ind_triA, pointA); + auto coefs_a = computeTriangleBarycentricCoordinates(ind_triA, pointA); intersected_topoElements.push_back (sofa::geometry::ElementType::TRIANGLE); intersected_indices.push_back (ind_triA); for (unsigned int i = 0; i<3; i++) @@ -2753,7 +2753,7 @@ bool TriangleSetGeometryAlgorithms::computeIntersectedObjectsList (co } // 3 - Last point b (for the moment: always a point in a triangle) - auto coefs_b = computeTriangleBarycoefs (ind_triB, pointB); + auto coefs_b = computeTriangleBarycentricCoordinates(ind_triB, pointB); bool isOnPoint = false; for (unsigned int i = 0; i<3; i++) if (coefs_b[i] > 0.9999 ) @@ -3201,14 +3201,14 @@ void TriangleSetGeometryAlgorithms< DataTypes >::InciseAlongLinesList( Real epsilon = 0.2; // INFO : epsilon is a threshold in [0,1] to control the snapping of the extremities to the closest vertex auto a_baryCoefs = - computeTriangleBarycoefs(ind_ta, (const sofa::type::Vec<3, Real> &) a); + computeTriangleBarycentricCoordinates(ind_ta, (const sofa::type::Vec<3, Real> &) a); snapping_test_triangle(epsilon, a_baryCoefs[0], a_baryCoefs[1], a_baryCoefs[2], is_snap_a0, is_snap_a1, is_snap_a2); Real is_snapping_a = is_snap_a0 || is_snap_a1 || is_snap_a2; auto b_baryCoefs = - computeTriangleBarycoefs(ind_tb, (const sofa::type::Vec<3, Real> &) b); + computeTriangleBarycentricCoordinates(ind_tb, (const sofa::type::Vec<3, Real> &) b); snapping_test_triangle(epsilon, b_baryCoefs[0], b_baryCoefs[1], b_baryCoefs[2], is_snap_b0, is_snap_b1, is_snap_b2); @@ -3246,7 +3246,7 @@ void TriangleSetGeometryAlgorithms< DataTypes >::InciseAlongLinesList( a_first_ancestors.push_back(ta[1]); a_first_ancestors.push_back(ta[2]); p_ancestors.push_back(a_first_ancestors); - p_baryCoefs.push_back(a_baryCoefs); + p_baryCoefs.push_back(sofa::type::vector{ a_baryCoefs[0], a_baryCoefs[1], a_baryCoefs[2] }); acc_nb_points = acc_nb_points + 1; @@ -3531,7 +3531,7 @@ void TriangleSetGeometryAlgorithms< DataTypes >::InciseAlongLinesList( b_first_ancestors.push_back(tb[1]); b_first_ancestors.push_back(tb[2]); p_ancestors.push_back(b_first_ancestors); - p_baryCoefs.push_back(b_baryCoefs); + p_baryCoefs.push_back(sofa::type::vector{ b_baryCoefs[0], b_baryCoefs[1], b_baryCoefs[2] }); acc_nb_points = acc_nb_points + 1; @@ -4513,7 +4513,13 @@ int TriangleSetGeometryAlgorithms::SplitAlongPath(PointID ind_A, Coor if (points2Snap[i].size() == 7) { - coefs2Snap[i] = compute3PointsBarycoefs(SnapedCoord, firstAncestor, secondAncestor, (PointID)points2Snap[i][6]); + const PointID thirdAncestor = (PointID)points2Snap[i][6]; + const typename DataTypes::VecCoord& positions = this->object->read(core::vec_id::read_access::position)->getValue(); + sofa::type::Vec<3, Real> p0; DataTypes::get(p0[0], p0[1], p0[2], positions[firstAncestor]); + sofa::type::Vec<3, Real> p1; DataTypes::get(p1[0], p1[1], p1[2], positions[secondAncestor]); + sofa::type::Vec<3, Real> p2; DataTypes::get(p2[0], p2[1], p2[2], positions[thirdAncestor]); + const auto coefs = sofa::geometry::Triangle::getBarycentricCoordinates(SnapedCoord, p0, p1, p2); + coefs2Snap[i] = sofa::type::vector{ coefs[0], coefs[1], coefs[2] }; ancestors2Snap[i].push_back((PointID)points2Snap[i][6]); } else diff --git a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp index c8c86d9f5ed..30cc9ce3fcc 100644 --- a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp +++ b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp @@ -892,7 +892,7 @@ void TopologicalChangeProcessor::saveIndices() sofa::component::topology::container::dynamic::TriangleSetGeometryAlgorithms* triangleGeo; m_topology->getContext()->get(triangleGeo); - const auto baryCoef = triangleGeo->computeTriangleBarycoefs( triInd, constCoord); + const auto baryCoef = triangleGeo->computeTriangleBarycentricCoordinates( triInd, constCoord); Vec3 barycentricCoordinates(baryCoef[0], baryCoef[1], baryCoef[2]); Vec3Types::Coord aCoord[3]; @@ -953,7 +953,7 @@ void TopologicalChangeProcessor::saveIndices() triangleIncisionInformation[i].triangleIndices[0] = triIndex; - const auto newBaryCoef = triangleGeo->computeTriangleBarycoefs( triangleIncisionInformation[i].triangleIndices[0], newPosition); + const auto newBaryCoef = triangleGeo->computeTriangleBarycentricCoordinates( triangleIncisionInformation[i].triangleIndices[0], newPosition); for (unsigned int j = 0 ; j < 3 ; j++) triangleIncisionInformation[i].barycentricCoordinates.front()[j] = newBaryCoef[j]; @@ -1366,7 +1366,7 @@ void TopologicalChangeProcessor::updateTriangleIncisionInformation() //update the triangle barycentric coordinates corresponding to the current coordinates const Vec3 constCoord = triangleIncisionInformation[i].coordinates[j]; - const auto baryCoef = triangleGeo->computeTriangleBarycoefs( newTriangleIndexb, constCoord); + const auto baryCoef = triangleGeo->computeTriangleBarycentricCoordinates( newTriangleIndexb, constCoord); triangleIncisionInformation[i].barycentricCoordinates[j] = Vec3(baryCoef[0], baryCoef[1], baryCoef[2]); } } diff --git a/Sofa/GL/src/sofa/gl/DrawToolGL.cpp b/Sofa/GL/src/sofa/gl/DrawToolGL.cpp index 7f2fbd705d4..33b8903f5b9 100644 --- a/Sofa/GL/src/sofa/gl/DrawToolGL.cpp +++ b/Sofa/GL/src/sofa/gl/DrawToolGL.cpp @@ -472,12 +472,12 @@ void DrawToolGL::drawTriangleFan(const std::vector &points, void DrawToolGL::drawFrame(const Vec3& position, const Quaternion &orientation, const Vec<3,float> &size) { setPolygonMode(0,false); - gl::Frame::draw(position, orientation, size, type::RGBAColor::red(), type::RGBAColor::green(), type::RGBAColor::blue()); + gl::Frame::draw(position, orientation, type::Vec3(size[0], size[1], size[2]), type::RGBAColor::red(), type::RGBAColor::green(), type::RGBAColor::blue()); } void DrawToolGL::drawFrame(const Vec3& position, const Quaternion &orientation, const Vec<3,float> &size, const type::RGBAColor &color) { setPolygonMode(0,false); - gl::Frame::draw(position, orientation, size, color, color, color); + gl::Frame::draw(position, orientation, type::Vec3(size[0], size[1], size[2]), color, color, color); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp index 79d700ab702..1c30351943d 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp @@ -19,6 +19,14 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +// These deprecated visitors are still used internally: do not warn about their headers +#define SOFA_SIMULATION_CORE_MECHANICALMULTIVECTORTOBASEVECTORVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALMULTIVECTORFROMBASEVECTORVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALMULTIVECTORPEQBASEVECTORVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALPROPAGATEONLYPOSITIONANDRESETFORCEVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALCOMPUTECONTACTFORCEVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALADDMBK_TOMATRIXVISITOR_CPP +#define SOFA_SIMULATION_CORE_MECHANICALAPPLYPROJECTIVECONSTRAINT_TOMATRIXVISITOR_CPP #include #include #include diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/AccelerationBasedImplicitIntegrationScheme.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/AccelerationBasedImplicitIntegrationScheme.cpp index a3cb39311ae..57e96c38673 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/AccelerationBasedImplicitIntegrationScheme.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/AccelerationBasedImplicitIntegrationScheme.cpp @@ -26,9 +26,7 @@ #include #include #include -#include -using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor; namespace sofa::simulation::integrationscheme diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/VelocityBasedImplicitIntegrationScheme.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/VelocityBasedImplicitIntegrationScheme.cpp index 18ecc22bb96..4427e3e15eb 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/VelocityBasedImplicitIntegrationScheme.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/integrationscheme/VelocityBasedImplicitIntegrationScheme.cpp @@ -26,8 +26,6 @@ #include #include #include -#include -using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor; namespace sofa::simulation::integrationscheme {