Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_COMPONENT_ANIMATIONLOOP_CONSTRAINTANIMATIONLOOP_CPP
#include <sofa/component/animationloop/ConstraintAnimationLoop.h>
#include <sofa/core/visual/VisualParams.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#pragma once
#include <sofa/component/animationloop/config.h>

#if !defined(SOFA_COMPONENT_ANIMATIONLOOP_CONSTRAINTANIMATIONLOOP_CPP)
SOFA_HEADER_DEPRECATED_NOT_REPLACED("v26.06", "v26.12")
#endif


#include <sofa/helper/map.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma once
#include <sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.h>

#include <sofa/core/behavior/Constraint.inl>
#include <sofa/core/behavior/LagrangianConstraint.inl>
#include <sofa/core/objectmodel/Data.h>
#include <sofa/component/constraint/lagrangian/model/BilateralConstraintResolution.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
#include <sofa/core/visual/VisualParams.h>
#include <sofa/helper/AdvancedTimer.h>
#include <sofa/helper/ScopedAdvancedTimer.h>
#include <sofa/simulation/DifferentialOperations.h>
#include <sofa/simulation/MappingGraph.h>
#include <sofa/simulation/MechanicalOperations.h>
#include <sofa/simulation/VectorOperations.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalGetNonDiagonalMassesCountVisitor.h>

using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor;


namespace sofa::component::integrationscheme::backward
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -226,7 +225,7 @@ void StaticEquilibriumIntegrationScheme::integrate(const core::ExecParams* param
if (fabs(alpha - bestalpha )> std::numeric_limits<SReal>::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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
#include <sofa/simulation/MappingGraph.h>
#include <sofa/simulation/MechanicalOperations.h>
#include <sofa/simulation/VectorOperations.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalGetNonDiagonalMassesCountVisitor.h>

#include "sofa/simulation/integrationscheme/ImplicitIntegrationScheme.h"
using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor;

namespace sofa::component::integrationscheme::forward
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
******************************************************************************/
#pragma once

#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>
#include <variant>

namespace sofa::component::solidmechanics::fem::elastic
Expand Down Expand Up @@ -65,7 +65,7 @@ struct RotationMethodsContainer

static constexpr auto NumberOfMethods = std::variant_size_v<decltype(m_rotationComputer)>;

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()))
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#pragma once

#include <sofa/component/solidmechanics/fem/hyperelastic/config.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>

#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_HYPERELASTIC_LINEAR_MECHANICAL_PARAMETERS_CPP)
#include <sofa/defaulttype/VecTypes.h>
Expand All @@ -32,12 +32,12 @@ namespace sofa::component::solidmechanics::fem::hyperelastic
{

template<class DataTypes>
class LinearMechanicalParametersComponent : public virtual sofa::core::objectmodel::BaseObject
class LinearMechanicalParametersComponent : public virtual sofa::core::objectmodel::BaseComponent
{
using Real = sofa::Real_t<DataTypes>;

public:
SOFA_CLASS(LinearMechanicalParametersComponent<DataTypes>, sofa::core::objectmodel::BaseObject);
SOFA_CLASS(LinearMechanicalParametersComponent<DataTypes>, sofa::core::objectmodel::BaseComponent);

sofa::Data<Real> d_poissonRatio;
sofa::Data<Real> d_youngModulus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ auto TriangleSetGeometryAlgorithms< DataTypes >::computeTriangleBarycoefs(
const TriangleID ind_t,
const sofa::type::Vec<3,Real> &p) const -> sofa::type::vector<SReal>
{
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<SReal>{ coefs[0], coefs[1], coefs[2] };
}

template<class DataTypes>
Expand All @@ -506,8 +506,8 @@ auto TriangleSetGeometryAlgorithms< DataTypes >::computeRestTriangleBarycoefs(
const TriangleID ind_t,
const sofa::type::Vec<3, Real>& p) const -> sofa::type::vector<SReal>
{
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<SReal>{ coefs[0], coefs[1], coefs[2] };
}

// barycentric coefficients of point p in triangle whose vertices are indexed by (ind_p1,ind_p2,ind_p3)
Expand Down Expand Up @@ -2730,7 +2730,7 @@ bool TriangleSetGeometryAlgorithms<DataTypes>::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++)
Expand All @@ -2753,7 +2753,7 @@ bool TriangleSetGeometryAlgorithms<DataTypes>::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 )
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<SReal>{ a_baryCoefs[0], a_baryCoefs[1], a_baryCoefs[2] });

acc_nb_points = acc_nb_points + 1;

Expand Down Expand Up @@ -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<SReal>{ b_baryCoefs[0], b_baryCoefs[1], b_baryCoefs[2] });

acc_nb_points = acc_nb_points + 1;

Expand Down Expand Up @@ -4513,7 +4513,13 @@ int TriangleSetGeometryAlgorithms<DataTypes>::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<SReal>{ coefs[0], coefs[1], coefs[2] };
ancestors2Snap[i].push_back((PointID)points2Snap[i][6]);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ void TopologicalChangeProcessor::saveIndices()
sofa::component::topology::container::dynamic::TriangleSetGeometryAlgorithms<Vec3Types>* 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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sofa/GL/src/sofa/gl/DrawToolGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,12 @@ void DrawToolGL::drawTriangleFan(const std::vector<Vec3> &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);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sofa/simulation/MechanicalOperations.h>
#include <sofa/simulation/MechanicalVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalMultiVectorToBaseVectorVisitor.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
#include <sofa/core/visual/VisualParams.h>
#include <sofa/helper/AdvancedTimer.h>
#include <sofa/helper/ScopedAdvancedTimer.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalGetNonDiagonalMassesCountVisitor.h>

using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor;


namespace sofa::simulation::integrationscheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <sofa/core/visual/VisualParams.h>
#include <sofa/helper/AdvancedTimer.h>
#include <sofa/helper/ScopedAdvancedTimer.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalGetNonDiagonalMassesCountVisitor.h>
using sofa::simulation::mechanicalvisitor::MechanicalGetNonDiagonalMassesCountVisitor;

namespace sofa::simulation::integrationscheme
{
Expand Down
Loading