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
25 changes: 25 additions & 0 deletions Sofa/framework/Core/src/sofa/core/visual/DrawColoredMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ struct SOFA_CORE_API DrawElementColoredMesh<sofa::geometry::Edge>
const IndicesContainer& elementIndices,
const ColorContainer& nodesColors)
{
SOFA_UNUSED(drawTool);
SOFA_UNUSED(position);
SOFA_UNUSED(topology);
SOFA_UNUSED(elementIndices);
SOFA_UNUSED(nodesColors);
}
};

Expand All @@ -140,6 +145,11 @@ struct SOFA_CORE_API DrawElementColoredMesh<sofa::geometry::Triangle>
const IndicesContainer& elementIndices,
const ColorContainer& nodesColors)
{
SOFA_UNUSED(drawTool);
SOFA_UNUSED(position);
SOFA_UNUSED(topology);
SOFA_UNUSED(elementIndices);
SOFA_UNUSED(nodesColors);
}
};

Expand All @@ -158,6 +168,11 @@ struct SOFA_CORE_API DrawElementColoredMesh<sofa::geometry::Quad>
const IndicesContainer& elementIndices,
const ColorContainer& nodesColors)
{
SOFA_UNUSED(drawTool);
SOFA_UNUSED(position);
SOFA_UNUSED(topology);
SOFA_UNUSED(elementIndices);
SOFA_UNUSED(nodesColors);
}
};

Expand Down Expand Up @@ -295,6 +310,11 @@ struct SOFA_CORE_API DrawElementColoredMesh<sofa::geometry::Prism>
const IndicesContainer& elementIndices,
const ColorContainer& nodesColors)
{
SOFA_UNUSED(drawTool);
SOFA_UNUSED(position);
SOFA_UNUSED(topology);
SOFA_UNUSED(elementIndices);
SOFA_UNUSED(nodesColors);
}
};

Expand All @@ -313,6 +333,11 @@ struct SOFA_CORE_API DrawElementColoredMesh<sofa::geometry::Pyramid>
const IndicesContainer& elementIndices,
const ColorContainer& nodesColors)
{
SOFA_UNUSED(drawTool);
SOFA_UNUSED(position);
SOFA_UNUSED(topology);
SOFA_UNUSED(elementIndices);
SOFA_UNUSED(nodesColors);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SimplePointTopology: public BaseMeshTopology
}
}

virtual void init()
void init() override
{
BaseMeshTopology::init();
m_data.createTopologyHandler(this);
Expand All @@ -53,13 +53,13 @@ class SimplePointTopology: public BaseMeshTopology
const SeqPrisms& getPrisms() override { return m_prisms; }
const SeqPyramids& getPyramids() override { return m_pyramids; }

virtual sofa::geometry::ElementType getTopologyType() const
sofa::geometry::ElementType getTopologyType() const override
{
return sofa::geometry::ElementType::POINT;
}


virtual Size getNbPoints() const { return m_points.size(); }
Size getNbPoints() const override { return m_points.size(); }
void removePoints(const unsigned nb)
{
if(nb >= m_points.size())
Expand Down
2 changes: 1 addition & 1 deletion Sofa/framework/Geometry/test/Proximity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST(GeometryProximity_test, closestPointOnTriangle_degenerateTriangle)
sofa::type::Vec3d closest;

// LCP solver may return false for degenerate triangles
sofa::geometry::proximity::computeClosestPointOnTriangleToPoint(t0, t1, t2, q, closest);
static_cast<void>(sofa::geometry::proximity::computeClosestPointOnTriangleToPoint(t0, t1, t2, q, closest));
// Just verify it doesn't crash; result depends on LCP solver behavior
}

Expand Down
2 changes: 0 additions & 2 deletions Sofa/framework/Geometry/test/Triangle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ TYPED_TEST(GeometryVec3DTriangle_test, isPointInTriangle)

TYPED_TEST(GeometryVec2DTriangle_test, getBarycentricCoordinates)
{
using Scalar = typename TypeParam::value_type;

const TypeParam a{ 0., 0. };
const TypeParam b{ 2., 0. };
Expand Down Expand Up @@ -331,7 +330,6 @@ TYPED_TEST(GeometryVec2DTriangle_test, getBarycentricCoordinates)

TYPED_TEST(GeometryVec3DTriangle_test, getBarycentricCoordinates)
{
using Scalar = typename TypeParam::value_type;

const TypeParam a{ 0., 0., 0. };
const TypeParam b{ 2., 0., 2. };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ MechanicalPropagateOnlyVelocityVisitor::MechanicalPropagateOnlyVelocityVisitor(
SReal time, core::MultiVecDerivId v)
: MechanicalVisitor(mparams), v(v)
{
SOFA_UNUSED(time);
#ifdef SOFA_DUMP_VISITOR_INFO
setReadWriteVectors();
#endif
Expand Down
153 changes: 129 additions & 24 deletions Sofa/framework/Simulation/Core/test/Visitor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TestVisitorWithoutInteractionForceField : public simulation::MechanicalVis

Result fwdMechanicalMapping(simulation::Node* /*node*/, sofa::core::BaseMapping* map) override
{
SOFA_UNUSED(map);
++m_mappingCount;
return Result::RESULT_CONTINUE;
}
Expand Down Expand Up @@ -57,6 +58,7 @@ class TestVisitorWithInteractionForceField : public simulation::MechanicalVisito

Result fwdMechanicalMapping(simulation::Node*, sofa::core::BaseMapping* map) override
{
SOFA_UNUSED(map);
++m_mappingCount;
return Result::RESULT_CONTINUE;
}
Expand Down Expand Up @@ -88,48 +90,151 @@ class TestVisitorWithInteractionForceField : public simulation::MechanicalVisito
class TestForceField : public core::behavior::BaseForceField
{
public:
void addForce(const core::MechanicalParams* mparams, core::MultiVecDerivId fId) override {}
void addDForce(const core::MechanicalParams* mparams, core::MultiVecDerivId dfId) override {}
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override { return {}; }
void addKToMatrix(const core::MechanicalParams* mparams, const sofa::core::behavior::MultiMatrixAccessor* matrix) override {}
void addForce(const core::MechanicalParams* mparams, core::MultiVecDerivId fId) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(fId);
}
void addDForce(const core::MechanicalParams* mparams, core::MultiVecDerivId dfId) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(dfId);
}
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override
{
SOFA_UNUSED(mparams);
return {};
}
void addKToMatrix(const core::MechanicalParams* mparams, const sofa::core::behavior::MultiMatrixAccessor* matrix) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(matrix);
}
};

class TestMass : public core::behavior::BaseMass
{
public:
void addMDx(const core::MechanicalParams* mparams, core::MultiVecDerivId fid, SReal factor) override {}
void accFromF(const core::MechanicalParams* mparams, core::MultiVecDerivId aid) override {}
void addGravityToV(const core::MechanicalParams* mparams, core::MultiVecDerivId vid) override {}
SReal getKineticEnergy(const core::MechanicalParams* mparams) const override { return {}; }
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override { return {}; }
type::Vec6 getMomentum(const core::MechanicalParams* mparams) const override { return {}; }
void addMToMatrix(const core::MechanicalParams* mparams, const sofa::core::behavior::MultiMatrixAccessor* matrix) override {}
void initGnuplot(const std::string path) override {}
void exportGnuplot(const core::MechanicalParams* mparams, SReal time) override {}
SReal getElementMass(sofa::Index index) const override { return {}; }
void getElementMass(sofa::Index index, linearalgebra::BaseMatrix* m) const override {}
void addMDx(const core::MechanicalParams* mparams, core::MultiVecDerivId fid, SReal factor) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(fid);
SOFA_UNUSED(factor);
}
void accFromF(const core::MechanicalParams* mparams, core::MultiVecDerivId aid) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(aid);
}
void addGravityToV(const core::MechanicalParams* mparams, core::MultiVecDerivId vid) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(vid);
}
SReal getKineticEnergy(const core::MechanicalParams* mparams) const override
{
SOFA_UNUSED(mparams);
return {};
}
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override
{
SOFA_UNUSED(mparams);
return {};
}
type::Vec6 getMomentum(const core::MechanicalParams* mparams) const override
{
SOFA_UNUSED(mparams);
return {};
}
void addMToMatrix(const core::MechanicalParams* mparams, const sofa::core::behavior::MultiMatrixAccessor* matrix) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(matrix);
}
void initGnuplot(const std::string path) override
{
SOFA_UNUSED(path);
}
void exportGnuplot(const core::MechanicalParams* mparams, SReal time) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(time);
}
SReal getElementMass(sofa::Index index) const override
{
SOFA_UNUSED(index);
return {};
}
void getElementMass(sofa::Index index, linearalgebra::BaseMatrix* m) const override
{
SOFA_UNUSED(index);
SOFA_UNUSED(m);
}
bool isDiagonal() const override { return {}; }
};

class TestInteractionForceField : public core::behavior::BaseInteractionForceField
{
public:
void addForce(const core::MechanicalParams* mparams, core::MultiVecDerivId fId) override {}
void addDForce(const core::MechanicalParams* mparams, core::MultiVecDerivId dfId) override {}
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override { return {}; }
void addForce(const core::MechanicalParams* mparams, core::MultiVecDerivId fId) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(fId);
}
void addDForce(const core::MechanicalParams* mparams, core::MultiVecDerivId dfId) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(dfId);
}
SReal getPotentialEnergy(const core::MechanicalParams* mparams) const override
{
SOFA_UNUSED(mparams);
return {};
}
};

class TestMapping : public core::BaseMapping
{
public:
void apply(const core::MechanicalParams* mparams, core::MultiVecCoordId outPos, core::ConstMultiVecCoordId inPos) override {}
void applyJ(const core::MechanicalParams* mparams, core::MultiVecDerivId outVel, core::ConstMultiVecDerivId inVel) override {}
void apply(const core::MechanicalParams* mparams, core::MultiVecCoordId outPos, core::ConstMultiVecCoordId inPos) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(outPos);
SOFA_UNUSED(inPos);
}
void applyJ(const core::MechanicalParams* mparams, core::MultiVecDerivId outVel, core::ConstMultiVecDerivId inVel) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(outVel);
SOFA_UNUSED(inVel);
}
type::vector<core::BaseState*> getFrom() override { return {} ;}
type::vector<core::BaseState*> getTo() override { return {} ;}
void applyJT(const core::MechanicalParams* mparams, core::MultiVecDerivId inForce, core::ConstMultiVecDerivId outForce) override {}
void applyDJT(const core::MechanicalParams* mparams, core::MultiVecDerivId inForce, core::ConstMultiVecDerivId outForce) override {}
void applyJT(const core::ConstraintParams* mparams, core::MultiMatrixDerivId inConst, core::ConstMultiMatrixDerivId outConst) override {}
void computeAccFromMapping(const core::MechanicalParams* mparams, core::MultiVecDerivId outAcc, core::ConstMultiVecDerivId inVel, core::ConstMultiVecDerivId inAcc) override {}
void applyJT(const core::MechanicalParams* mparams, core::MultiVecDerivId inForce, core::ConstMultiVecDerivId outForce) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(inForce);
SOFA_UNUSED(outForce);
}
void applyDJT(const core::MechanicalParams* mparams, core::MultiVecDerivId inForce, core::ConstMultiVecDerivId outForce) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(inForce);
SOFA_UNUSED(outForce);
}
void applyJT(const core::ConstraintParams* mparams, core::MultiMatrixDerivId inConst, core::ConstMultiMatrixDerivId outConst) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(inConst);
SOFA_UNUSED(outConst);
}
void computeAccFromMapping(const core::MechanicalParams* mparams, core::MultiVecDerivId outAcc, core::ConstMultiVecDerivId inVel, core::ConstMultiVecDerivId inAcc) override
{
SOFA_UNUSED(mparams);
SOFA_UNUSED(outAcc);
SOFA_UNUSED(inVel);
SOFA_UNUSED(inAcc);
}
type::vector<core::behavior::BaseMechanicalState*> getMechFrom() override { return {} ;}
type::vector<core::behavior::BaseMechanicalState*> getMechTo() override { return {} ;}
void disable() override {}
Expand Down
5 changes: 5 additions & 0 deletions Sofa/framework/Type/src/sofa/type/IdentityMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct ScaledIdentityMatrix
template<sofa::Size N, class real>
constexpr Mat<N, N, real> operator+(const IdentityMatrix& I, const Mat<N, N, real>& M)
{
SOFA_UNUSED(I);
Mat<N, N, real> res(M);
for (sofa::Size i = 0; i < N; ++i)
{
Expand All @@ -34,6 +35,7 @@ constexpr Mat<N, N, real> operator+(const Mat<N, N, real>& M, const IdentityMatr
template<sofa::Size N, class real>
constexpr Mat<N, N, real> operator-(const IdentityMatrix& I, const Mat<N, N, real>& M)
{
SOFA_UNUSED(I);
Mat<N, N, real> res(-M);
for (sofa::Size i = 0; i < N; ++i)
{
Expand All @@ -45,6 +47,7 @@ constexpr Mat<N, N, real> operator-(const IdentityMatrix& I, const Mat<N, N, rea
template<sofa::Size N, class real>
constexpr Mat<N, N, real> operator-(const Mat<N, N, real>& M, const IdentityMatrix& I)
{
SOFA_UNUSED(I);
Mat<N, N, real> res(M);
for (sofa::Size i = 0; i < N; ++i)
{
Expand All @@ -56,12 +59,14 @@ constexpr Mat<N, N, real> operator-(const Mat<N, N, real>& M, const IdentityMatr
template<class real>
constexpr ScaledIdentityMatrix<real> operator*(const IdentityMatrix& I, real s)
{
SOFA_UNUSED(I);
return { s };
}

template<class real>
constexpr ScaledIdentityMatrix<real> operator*(real s, const IdentityMatrix& I)
{
SOFA_UNUSED(I);
return { s };
}

Expand Down
Loading