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
1 change: 1 addition & 0 deletions Sofa/framework/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-attributes)
endif()

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SOFA_CORE_API BaseForceField : public virtual StateAccessor
ConstMultiVecCoordId xId, ConstMultiVecDerivId vId) = 0;

SOFA_ATTRIBUTE_DEPRECATED__ADDDFORCE_OVERLOAD()
virtual void addDForce(const MechanicalParams* mparams, MultiVecDerivId dfId) final;
void addDForce(const MechanicalParams* mparams, MultiVecDerivId dfId);

/// \brief Accumulate the contribution of M, B, and/or K matrices multiplied
/// by the dx vector with the given coefficients.
Expand Down
4 changes: 2 additions & 2 deletions Sofa/framework/Core/src/sofa/core/behavior/BaseMass.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SOFA_CORE_API BaseMass : public virtual StateAccessor

/// dx = M^-1 f
SOFA_CORE_DEPRECATED_ACCFROMF()
virtual void accFromF(const MechanicalParams* mparams, MultiVecDerivId aid) final;
void accFromF(const MechanicalParams* mparams, MultiVecDerivId aid);

/// Solve M x = b, or x = M^-1 b, where M is the mass matrix
///
Expand All @@ -83,7 +83,7 @@ class SOFA_CORE_API BaseMass : public virtual StateAccessor
virtual SReal getPotentialEnergy(const MechanicalParams* mparams, ConstMultiVecCoordId xId) const = 0;

SOFA_ATTRIBUTE_DEPRECATED__GETPOTENTIALENERGY_OVERLOAD()
virtual SReal getPotentialEnergy(const MechanicalParams* mparams = mechanicalparams::defaultInstance()) const final;
SReal getPotentialEnergy(const MechanicalParams* mparams = mechanicalparams::defaultInstance()) const;

/// (Mv,xMv+Iw) (linear and angular momenta against world origin)
virtual type::Vec6 getMomentum(const MechanicalParams* mparams = mechanicalparams::defaultInstance()) const = 0;
Expand Down
3 changes: 0 additions & 3 deletions Sofa/framework/Core/src/sofa/core/behavior/Mass.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ class Mass : virtual public ForceField<DataTypes>, public BaseMass
void solveLinearSystem(const MechanicalParams* mparams, MultiVecDerivId xId, ConstMultiVecDerivId bId) override;
virtual void doSolveLinearSystem(const MechanicalParams* mparams, DataVecDeriv& x, const DataVecDeriv& b);

/// Mass forces (gravity) often have null derivative
void addDForce(const MechanicalParams* /*mparams*/, DataVecDeriv & /*df*/, const DataVecDeriv & /*dx*/ ) override;

/// Accumulate the contribution of M, B, and/or K matrices multiplied
/// by the dx vector with the given coefficients.
///
Expand Down
7 changes: 0 additions & 7 deletions Sofa/framework/Core/src/sofa/core/behavior/Mass.inl
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ void Mass<DataTypes>::doSolveLinearSystem(const MechanicalParams* mparams,
this->getClassName() << "'. Behavior is undefined. Try using a linear solver.";
}

template <class DataTypes>
void Mass<DataTypes>::addDForce(const MechanicalParams* mparams,
DataVecDeriv & /*df*/, const DataVecDeriv & /*dx*/)
{
SOFA_UNUSED(mparams);
}

template<class DataTypes>
void Mass<DataTypes>::addMBKdx(const MechanicalParams* mparams, MultiVecDerivId dfId)
{
Expand Down
2 changes: 1 addition & 1 deletion Sofa/framework/Core/src/sofa/core/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ SOFA_ATTRIBUTE_DEPRECATED("v26.12", "v27.12", "Use BaseContext instead of Contex
SOFA_ATTRIBUTE_DEPRECATED("v26.12", "v27.12", "Use resetVec instead.")
#endif

#ifdef SOFA_BUILD_SOFA_CORE
#if defined(SOFA_BUILD_SOFA_CORE) || defined(SOFA_BUILD_SOFA_SIMULATION_CORE)
#define SOFA_CORE_DEPRECATED_BEGININTEGRATION()
#else
#define SOFA_CORE_DEPRECATED_BEGININTEGRATION() \
Expand Down
6 changes: 3 additions & 3 deletions Sofa/framework/Core/src/sofa/core/objectmodel/BaseLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ bool BaseLink::readFromSnapshot( const std::string& str )
/// From the link
std::vector<std::string> linkPathsFromLink;

std::string linkPath = this->getValueString();
std::istringstream istrLink(linkPath);
const std::string linkValue = this->getValueString();

std::istringstream istrLink(linkValue);
std::string linkStringBis;

while (istrLink >> linkStringBis)
Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/DefaultType/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.Type Sofa.LinearAlgebra)
target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen)

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ struct FixedArrayTypeInfo
}
return true;
}
return false;
else
{
return false;
}
}

template <typename T>
Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ else()
target_compile_definitions(${PROJECT_NAME} PRIVATE "SOFA_BUILD_MULTI_CONFIGURATION=0")
endif()

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
2 changes: 0 additions & 2 deletions Sofa/framework/Helper/src/sofa/helper/BackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ static std::string SigDescription(int sig)
return "SIGTERM: a termination request was sent to the program";
break;
}

return "Unknown signal";
}

void BackTrace::sig(int sig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void * DynamicLibrary::getSymbolAddress(Handle handle,
return nullptr;
}
# if defined(WIN32)
void *symbolAddress = ::GetProcAddress((HMODULE)handle.m_realHandle,
symbol.c_str());
void *symbolAddress = reinterpret_cast<void*>(::GetProcAddress((HMODULE)handle.m_realHandle,
symbol.c_str()));
# else
void *symbolAddress = ::dlsym(handle.m_realHandle, symbol.c_str());
# endif
Expand Down
2 changes: 0 additions & 2 deletions Sofa/framework/Helper/src/sofa/helper/system/PipeProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ bool PipeProcess::executeProcess(const std::string &command, const std::vector<
if (exit != STILL_ACTIVE)
break;

bool busy = false;
for (int i=0; i<2; ++i)
{
DWORD n = BUFSIZE-nfill[i];
Expand All @@ -203,7 +202,6 @@ bool PipeProcess::executeProcess(const std::string &command, const std::vector<

if (bread>0)
{
busy = true;
ReadFile(fds[i][0], buf[i]+nfill[i], n, &n, nullptr);
nfill[i] += n;
{
Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/LinearAlgebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ if (SOFA_LINEARALGEBRA_HAVE_OPENMP)
target_link_libraries(${PROJECT_NAME} PUBLIC OpenMP::OpenMP_CXX)
endif()

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,49 +716,51 @@ public :

void compressCSR()
{
if constexpr (!Policy::CompressZeros) return;
Index outValues = 0;
Index outRows = 0;
for (Index r = 0; r < static_cast<Index>(rowIndex.size()); ++r)
{
Index row = rowIndex[r];
Index rBegin = rowBegin[r];
Index rEnd = rowBegin[r+1];
Index outRBegin = outValues;
for (Index p = rBegin; p != rEnd; ++p)
if constexpr (Policy::CompressZeros)
{
Index outValues = 0;
Index outRows = 0;
for (Index r = 0; r < static_cast<Index>(rowIndex.size()); ++r)
{
if (!traits::empty(colsValue[p]))
Index row = rowIndex[r];
Index rBegin = rowBegin[r];
Index rEnd = rowBegin[r+1];
Index outRBegin = outValues;
for (Index p = rBegin; p != rEnd; ++p)
{
// keep this value
if (p != outValues)
if (!traits::empty(colsValue[p]))
{
colsValue[outValues] = colsValue[p];
colsIndex[outValues] = colsIndex[p];
// keep this value
if (p != outValues)
{
colsValue[outValues] = colsValue[p];
colsIndex[outValues] = colsIndex[p];
}
++outValues;
}
++outValues;
}
}
if(outValues != outRBegin)
{
// keep this row
if (r != outRows)
{
rowIndex[outRows] = row;
}
if (r != outRows || rBegin != outRBegin)
if(outValues != outRBegin)
{
rowBegin[outRows] = outRBegin;
// keep this row
if (r != outRows)
{
rowIndex[outRows] = row;
}
if (r != outRows || rBegin != outRBegin)
{
rowBegin[outRows] = outRBegin;
}
++outRows;
}
++outRows;
}
}
if (static_cast<Index>(rowIndex.size()) != outRows || static_cast<Index>(colsIndex.size()) != outValues)
{
rowBegin[outRows] = outValues;
rowIndex.resize(outRows);
rowBegin.resize(outRows+1);
colsIndex.resize(outValues);
colsValue.resize(outValues);
if (static_cast<Index>(rowIndex.size()) != outRows || static_cast<Index>(colsIndex.size()) != outValues)
{
rowBegin[outRows] = outValues;
rowIndex.resize(outRows);
rowBegin.resize(outRows+1);
colsIndex.resize(outValues);
colsValue.resize(outValues);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Simulation/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Core Sofa.Simulation.Core)
target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml2::tinyxml2) # Private because not exported in API

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ bool ObjectElement::init()
bool ObjectElement::initNode()
{
core::objectmodel::BaseContext* ctx { nullptr };
if (auto* parent = getParent())
if (auto* parentElement = getParent())
{
if (auto* parentObj = parent->getObject())
if (auto* parentObj = parentElement->getObject())
{
ctx = parentObj->toBaseContext();
}
else
{
msg_error("XML parser") << "Cannot access to a valid component from parent element \'"
<< parent->getName() << "\' (type:\'" << parent->getAttribute("type")
<< parentElement->getName() << "\' (type:\'" << parentElement->getAttribute("type")
<< "\') for the object element \'" << this->getName() << "\'";
}
}
Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Simulation/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
endif()

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <sofa/simulation/SolveVisitor.h>
#include <sofa/simulation/task/TaskScheduler.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalAccumulateMatrixDeriv.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalBeginIntegrationVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalEndIntegrationVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalProjectPositionAndVelocityVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalPropagateOnlyPositionAndVelocityVisitor.h>
Expand Down Expand Up @@ -175,6 +174,7 @@ void DefaultAnimationLoop::propagateAnimateBeginEvent(const core::ExecParams* pa

void DefaultAnimationLoop::beginIntegration(const core::ExecParams* params, SReal dt) const
{
SOFA_UNUSED(dt);
propagateIntegrateBeginEvent(params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#define SOFA_SIMULATION_CORE_MECHANICALCOMPUTECONTACTFORCEVISITOR_CPP
#define SOFA_SIMULATION_CORE_MECHANICALADDMBK_TOMATRIXVISITOR_CPP
#define SOFA_SIMULATION_CORE_MECHANICALAPPLYPROJECTIVECONSTRAINT_TOMATRIXVISITOR_CPP
#define SOFA_SIMULATION_MECHANICALVISITOR_MECHANICALPROPAGATEDXVISITOR_CPP
#define SOFA_SIMULATION_MECHANICALVISITOR_MECHANICALPROPAGATEDXANDRESETFORCEVISITOR_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 @@ -28,7 +28,6 @@
#include <sofa/helper/AdvancedTimer.h>
#include <sofa/helper/ScopedAdvancedTimer.h>
#include <sofa/simulation/DifferentialOperations.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalGetNonDiagonalMassesCountVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalVOpVisitor.h>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SOFA_SIMULATION_CORE_API ImplicitIntegrationScheme :
/// with $r$ being constant in term of $x$ and $k$ the integration factor returned by this function.
///
/// This method is used to compute the compliance for contact corrections.
virtual SReal getVelocityIntegrationFactor() const = 0;
SReal getVelocityIntegrationFactor() const override = 0;

/// The integration scheme solves a linear system. In this linear system the unknown has a unit.
/// It can be the position, velocity or acceleration increase. In any case, this unknown need then
Expand All @@ -131,7 +131,7 @@ class SOFA_SIMULATION_CORE_API ImplicitIntegrationScheme :
/// with $r$ being constant in term of $x$ and $k$ the integration factor returned by this function.
///
/// This method is used to compute the compliance for contact corrections.
virtual SReal getPositionIntegrationFactor() const = 0;
SReal getPositionIntegrationFactor() const override = 0;

Data<SReal> d_rayleighStiffness; ///< Rayleigh damping coefficient related to stiffness, > 0
Data<SReal> d_rayleighMass; ///< Rayleigh damping coefficient related to mass, > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#include <sofa/simulation/mechanicalvisitor/MechanicalVOpVisitor.h>
using sofa::simulation::mechanicalvisitor::MechanicalVOpVisitor;

#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 @@ -19,7 +19,7 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/

#define SOFA_SIMULATION_MECHANICALVISITOR_MECHANICALBEGININTEGRATIONVISITOR_CPP
#include <sofa/simulation/mechanicalvisitor/MechanicalIntegrationVisitor.h>

#include <sofa/core/behavior/BaseIntegrationScheme.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/

#include <sofa/simulation/mechanicalvisitor/MechanicalAccFromFVisitor.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalMassLinearSolveVisitor.h>

#include <sofa/core/behavior/BaseMass.h>

Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Simulation/Graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sofa_find_package(Sofa.Simulation.Common REQUIRED)
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Common)

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ target_compile_options(${PROJECT_NAME} PUBLIC "-DGTEST_LINKED_AS_SHARED_LIBRARY=

set(SOFA_TESTING_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")

sofa_treat_warnings_as_errors(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

sofa_create_package_with_targets(
Expand Down
Loading