Skip to content

Commit

Permalink
Merge branch 'master' into xp-refactor-color
Browse files Browse the repository at this point in the history
  • Loading branch information
damienmarchal authored Feb 28, 2024
2 parents 8fd1818 + 251fd89 commit a0cc347
Show file tree
Hide file tree
Showing 124 changed files with 984 additions and 40,436 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ option(SOFA_BUILD_RELEASE_PACKAGE "Run package specific configure" OFF)
# Option to allow some dependencies such as cxxopts to be fetched by cmake if
# the package is not found
option(SOFA_ALLOW_FETCH_DEPENDENCIES "Allow compatible dependencies to be fetched if the package is not found by cmake.
List of dependencies that can be fetched: cxxopts, gtest" ON)
List of dependencies that can be fetched: cxxopts, gtest, metis, CImg" ON)

# Option to accelerate the compilation
# see https://cmake.org/cmake/help/v3.16/command/target_precompile_headers.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void ForceFeedback::init()
context = sofa::simulation::node::getNodeFrom(getContext());
}

void ForceFeedback::setReferencePosition(sofa::defaulttype::SolidTypes<SReal>::Transform& referencePosition)
void ForceFeedback::setReferencePosition(sofa::type::Transform<SReal>& referencePosition)
{
SOFA_UNUSED(referencePosition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <sofa/simulation/fwd.h>
#include <sofa/core/behavior/BaseController.h>
#include <sofa/defaulttype/SolidTypes.h>
#include <sofa/type/Transform.h>
#include <sofa/defaulttype/RigidTypes.h>

namespace sofa::component::haptics
Expand All @@ -48,11 +48,11 @@ class SOFA_COMPONENT_HAPTICS_API ForceFeedback : public virtual core::behavior::
SReal u, SReal v, SReal w,
SReal q, SReal& fx, SReal& fy, SReal& fz) = 0;

virtual void computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &,
const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &,
sofa::defaulttype::SolidTypes<SReal>::SpatialVector & )=0;
virtual void computeWrench(const sofa::type::Transform<SReal> &,
const sofa::type::SpatialVector<SReal> &,
sofa::type::SpatialVector<SReal> & )=0;

virtual void setReferencePosition(sofa::defaulttype::SolidTypes<SReal>::Transform& referencePosition);
virtual void setReferencePosition(sofa::type::Transform<SReal>& referencePosition);
virtual bool isEnabled();

/// Abstract method to lock or unlock the force feedback computation. To be implemented by child class if needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ void LCPForceFeedback< Rigid3Types >::computeForce(SReal x, SReal y, SReal z, SR


template <>
void LCPForceFeedback< Rigid3Types >::computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &world_H_tool,
const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &/*V_tool_world*/,
sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world )
void LCPForceFeedback< Rigid3Types >::computeWrench(const sofa::type::Transform<SReal> &world_H_tool,
const sofa::type::SpatialVector<SReal> &/*V_tool_world*/,
sofa::type::SpatialVector<SReal> &W_tool_world )
{
if (!this->d_activate.getValue())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class LCPForceFeedback : public MechanicalStateForceFeedback<TDataTypes>
void computeForce(SReal x, SReal y, SReal z,
SReal u, SReal v, SReal w,
SReal q, SReal& fx, SReal& fy, SReal& fz) override;
void computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &world_H_tool,
const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &V_tool_world,
sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world ) override;
void computeWrench(const sofa::type::Transform<SReal> &world_H_tool,
const sofa::type::SpatialVector<SReal> &V_tool_world,
sofa::type::SpatialVector<SReal> &W_tool_world ) override;
void computeForce(const VecCoord& state, VecDeriv& forces) override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ void LCPForceFeedback<DataTypes>::computeForce(SReal , SReal, SReal, SReal, SRea


template <typename DataTypes>
void LCPForceFeedback<DataTypes>::computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &,
const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &,
sofa::defaulttype::SolidTypes<SReal>::SpatialVector & )
void LCPForceFeedback<DataTypes>::computeWrench(const sofa::type::Transform<SReal> &,
const sofa::type::SpatialVector<SReal> &,
sofa::type::SpatialVector<SReal> & )
{

}
Expand All @@ -425,9 +425,9 @@ template <>
void SOFA_COMPONENT_HAPTICS_API LCPForceFeedback< sofa::defaulttype::Rigid3Types >::computeForce(SReal x, SReal y, SReal z, SReal, SReal, SReal, SReal, SReal& fx, SReal& fy, SReal& fz);

template <>
void SOFA_COMPONENT_HAPTICS_API LCPForceFeedback< sofa::defaulttype::Rigid3Types >::computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &world_H_tool,
const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &/*V_tool_world*/,
sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world );
void SOFA_COMPONENT_HAPTICS_API LCPForceFeedback< sofa::defaulttype::Rigid3Types >::computeWrench(const sofa::type::Transform<SReal> &world_H_tool,
const sofa::type::SpatialVector<SReal> &/*V_tool_world*/,
sofa::type::SpatialVector<SReal> &W_tool_world );



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class SOFA_COMPONENT_HAPTICS_API MechanicalStateForceFeedback : public ForceFeed

void init() override {context = sofa::simulation::node::getNodeFrom(getContext());}
void computeForce(SReal x, SReal y, SReal z, SReal u, SReal v, SReal w, SReal q, SReal& fx, SReal& fy, SReal& fz) override = 0;
void computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &, const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &, sofa::defaulttype::SolidTypes<SReal>::SpatialVector & ) override = 0;
void setReferencePosition(sofa::defaulttype::SolidTypes<SReal>::Transform& /*referencePosition*/) override {}
void computeWrench(const sofa::type::Transform<SReal> &, const sofa::type::SpatialVector<SReal> &, sofa::type::SpatialVector<SReal> & ) override = 0;
void setReferencePosition(sofa::type::Transform<SReal>& /*referencePosition*/) override {}

protected:
MechanicalStateForceFeedback(void) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void NullForceFeedback::computeForce(SReal /*x*/, SReal /*y*/, SReal /*z*/, SRea
fx = fy = fz = 0.0;
}

void NullForceFeedback::computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &/*world_H_tool*/, const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &/*V_tool_world*/, sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world )
void NullForceFeedback::computeWrench(const sofa::type::Transform<SReal> &/*world_H_tool*/, const sofa::type::SpatialVector<SReal> &/*V_tool_world*/, sofa::type::SpatialVector<SReal> &W_tool_world )
{
W_tool_world.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SOFA_COMPONENT_HAPTICS_API NullForceFeedback : public ForceFeedback
void init() override;

void computeForce(SReal x, SReal y, SReal z, SReal u, SReal v, SReal w, SReal q, SReal& fx, SReal& fy, SReal& fz) override;
void computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &world_H_tool, const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &V_tool_world, sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world ) override;
void computeWrench(const sofa::type::Transform<SReal> &world_H_tool, const sofa::type::SpatialVector<SReal> &V_tool_world, sofa::type::SpatialVector<SReal> &W_tool_world ) override;
};

} // namespace sofa::component::haptics
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SOFA_COMPONENT_HAPTICS_API NullForceFeedbackT : public MechanicalStateForc
fx = fy = fz = 0.0;
}
void computeForce(const VecCoord &, VecDeriv &) override {}
void computeWrench(const sofa::defaulttype::SolidTypes<SReal>::Transform &, const sofa::defaulttype::SolidTypes<SReal>::SpatialVector &, sofa::defaulttype::SolidTypes<SReal>::SpatialVector &W_tool_world ) override {W_tool_world.clear();}
void computeWrench(const sofa::type::Transform<SReal> &, const sofa::type::SpatialVector<SReal> &, sofa::type::SpatialVector<SReal> &W_tool_world ) override {W_tool_world.clear();}
};

} // namespace sofa::component::haptics
20 changes: 14 additions & 6 deletions Sofa/Component/LinearSolver/Direct/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ set(SOURCE_FILES
${SOFACOMPONENTLINEARSOLVERDIRECT_SOURCE_DIR}/TypedMatrixLinearSystem[BTDMatrix].cpp
)

sofa_find_package(metis QUIET) # Unix users can have an installed version of metis
if(NOT metis_FOUND)
message(STATUS "${PROJECT_NAME}: using built-in metis library")
option(METIS-GKLIB_GKRAND "enable GKRAND support" ON) #GKRAND support allows the portability of random number generation across different architectures
add_subdirectory(extlibs/metis-5.1.0)
find_package(metis 5.1.0 EXACT QUIET)
if(NOT metis_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
message("Sofa.Component.LinearSolver.Direct: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is ON, fetching metis...")
include(FetchContent)
FetchContent_Declare(metis
GIT_REPOSITORY https://github.com/sofa-framework/METIS
GIT_TAG v5.1.0-ModernInstall
)
FetchContent_MakeAvailable(metis)
elseif (NOT metis_FOUND)
message(FATAL_ERROR "Sofa.Component.LinearSolver.Direct: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install metis (version=5.1.0), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
endif()

sofa_set_01(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS VALUE TRUE)

# make sure you have threads for AsyncSparseLDLSolver
Expand All @@ -75,8 +82,9 @@ sofa_find_package(Sofa.Component.LinearSolver.Iterative REQUIRED) # Only for Mat
sofa_find_package(Sofa.Component.LinearSolver.Ordering REQUIRED)

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${WRAPPER_FILES})

target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core Sofa.Component.LinearSolver.Iterative Sofa.Component.LinearSolver.Ordering)
target_link_libraries(${PROJECT_NAME} PUBLIC metis)
target_link_libraries(${PROJECT_NAME} PRIVATE metis)
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ find_package(Threads QUIET REQUIRED)

set(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS @SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS@)

if(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS)
find_package(Metis QUIET REQUIRED HINTS "${CMAKE_CURRENT_LIST_DIR}/..")
endif()

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
endif()
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit a0cc347

Please sign in to comment.