From cbc1ce24e40306907d8050cbadafd74d90ea56d3 Mon Sep 17 00:00:00 2001 From: Jean-Nicolas Brunet Date: Tue, 9 May 2023 23:01:31 -0400 Subject: [PATCH 1/5] Compatibility with SOFA 23.06 --- src/SofaCaribou/CMakeLists.txt | 4 +- .../Forcefield/CaribouForcefield.h | 2 +- .../Forcefield/CaribouForcefield.inl | 4 +- .../CaribouForcefield[Hexahedron20].cpp | 2 +- .../CaribouForcefield[Hexahedron20].h | 2 +- .../CaribouForcefield[Hexahedron].cpp | 2 +- .../CaribouForcefield[Hexahedron].h | 2 +- .../Forcefield/CaribouForcefield[Quad8].cpp | 4 +- .../Forcefield/CaribouForcefield[Quad8].h | 4 +- .../Forcefield/CaribouForcefield[Quad].cpp | 4 +- .../Forcefield/CaribouForcefield[Quad].h | 4 +- .../CaribouForcefield[Tetrahedron10].cpp | 2 +- .../CaribouForcefield[Tetrahedron10].h | 2 +- .../CaribouForcefield[Tetrahedron].cpp | 2 +- .../CaribouForcefield[Tetrahedron].h | 2 +- .../CaribouForcefield[Triangle6].cpp | 2 +- .../Forcefield/CaribouForcefield[Triangle6].h | 4 +- .../Forcefield/CaribouForcefield[Triangle].h | 4 +- .../Forcefield/HexahedronElasticForce.cpp | 4 +- .../Mapping/CaribouBarycentricMapping.inl | 2 +- .../Ode/BackwardEulerODESolver.cpp | 2 +- src/SofaCaribou/Ode/BackwardEulerODESolver.h | 4 +- src/SofaCaribou/Ode/NewtonRaphsonSolver.cpp | 8 +-- src/SofaCaribou/Ode/NewtonRaphsonSolver.h | 4 +- src/SofaCaribou/Ode/StaticODESolver.cpp | 2 +- src/SofaCaribou/Ode/StaticODESolver.h | 4 +- .../Solver/ConjugateGradientSolver.h | 1 - src/SofaCaribou/Solver/EigenSolver.h | 15 ++--- src/SofaCaribou/Solver/EigenSolver.inl | 6 +- .../CaribouTopology[Hexahedron20].cpp | 2 +- .../Topology/CaribouTopology[Hexahedron].cpp | 3 +- .../Topology/CaribouTopology[Quad8].cpp | 2 +- .../Topology/CaribouTopology[Quad].cpp | 3 +- .../CaribouTopology[Tetrahedron10].cpp | 2 +- .../Topology/CaribouTopology[Tetrahedron].cpp | 3 +- .../Topology/CaribouTopology[Triangle6].cpp | 2 +- .../Topology/CaribouTopology[Triangle].cpp | 3 +- src/SofaCaribou/Topology/FictitiousGrid.h | 8 +-- src/SofaCaribou/Topology/FictitiousGrid.inl | 4 +- .../Algebra/test_base_vector_operations.cpp | 11 ---- .../Algebra/test_eigen_matrix_wrapper.cpp | 9 --- unittest/SofaCaribou/CMakeLists.txt | 4 +- .../test_hyperelasticforcefield.cpp | 22 +------ .../Forcefield/test_tractionforce.cpp | 13 +--- .../SofaCaribou/Mass/test_cariboumass.cpp | 59 +++---------------- .../SofaCaribou/ODE/test_backward_euler.cpp | 38 ++---------- unittest/SofaCaribou/ODE/test_static.cpp | 28 ++------- .../Topology/test_cariboutopology.cpp | 40 +++++-------- .../Topology/test_fictitiousgrid.cpp | 15 +---- unittest/SofaCaribou/main.cpp | 18 ++---- 50 files changed, 107 insertions(+), 286 deletions(-) diff --git a/src/SofaCaribou/CMakeLists.txt b/src/SofaCaribou/CMakeLists.txt index 7b22406c..2e516ada 100644 --- a/src/SofaCaribou/CMakeLists.txt +++ b/src/SofaCaribou/CMakeLists.txt @@ -146,7 +146,7 @@ if (NOT TARGET Caribou::Algebra) endif() # Sofa's packages -find_package(SOFA COMPONENTS SofaFramework SofaBaseLinearSolver SofaBaseTopology SofaEigen2Solver QUIET REQUIRED) +find_package(SOFA COMPONENTS SofaFramework Sofa.Component.LinearSolver.Iterative Sofa.Component.Topology.Container.Grid Sofa.Component.Topology.Container.Constant Sofa.Component.Topology.Container.Dynamic Sofa.LinearAlgebra QUIET REQUIRED) # Optional packages find_package(Eigen3 QUIET REQUIRED) @@ -159,7 +159,7 @@ endif() add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${TEMPLATE_FILES} ${HEADER_FILES}) add_library(Caribou::Plugin ALIAS ${PROJECT_NAME}) -target_link_libraries(${PROJECT_NAME} PUBLIC SofaCore SofaBaseTopology SofaBaseLinearSolver SofaEigen2Solver) +target_link_libraries(${PROJECT_NAME} PUBLIC SofaCore Sofa.Component.Topology.Container.Grid Sofa.Component.Topology.Container.Constant Sofa.Component.Topology.Container.Dynamic Sofa.Component.LinearSolver.Iterative Sofa.LinearAlgebra) target_link_libraries(${PROJECT_NAME} PUBLIC Caribou::Algebra Caribou::Geometry Caribou::Topology Caribou::Mechanics) target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield.h b/src/SofaCaribou/Forcefield/CaribouForcefield.h index aeb546ea..0ca80c25 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield.h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield.h @@ -102,7 +102,7 @@ class CaribouForcefield : public sofa::core::behavior::ForceField & triangles_nodes); + void triangulate_face(const Element & e, const std::size_t & face_id, std::vector & triangles_nodes); // Data members /// This link is specifically set to point towards a very general BaseObject since it can be either a diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield.inl b/src/SofaCaribou/Forcefield/CaribouForcefield.inl index 5a3bd51c..987e9ba5 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield.inl +++ b/src/SofaCaribou/Forcefield/CaribouForcefield.inl @@ -242,7 +242,7 @@ void CaribouForcefield::draw(const sofa::core::visual::VisualParams *vp const Eigen::Map> X (sofa_x.data()->data(), sofa_x.size(), Dimension); // For 1D, we draw edges. - std::vector edges; + std::vector edges; if constexpr(CanonicalDimension == 1) { std::size_t nnodes = (NumberOfNodesPerElement==caribou::Dynamic ? 1 : NumberOfNodesPerElement); edges.reserve(nb_elements * nnodes); @@ -252,7 +252,7 @@ void CaribouForcefield::draw(const sofa::core::visual::VisualParams *vp // We create groups of faces to draw. Each group will be assigned with a color. // For 2D, there is only one group (one "visible" face per element...). // For 3D, each face of an element is assigned to a group, hence will have a different color. - std::vector> triangle_groups; + std::vector> triangle_groups; if constexpr(CanonicalDimension == 2) { triangle_groups.resize(1); auto nnodes = (NumberOfNodesPerElement==caribou::Dynamic ? 1 : NumberOfNodesPerElement); diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].cpp index 0b21a4bb..2e497bd3 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].cpp @@ -22,7 +22,7 @@ auto CaribouForcefield::templateName(const CaribouForcefield -void CaribouForcefield::triangulate_face(const Hexahedron20 & e, const std::size_t & face_id, std::vector & triangles_nodes) { +void CaribouForcefield::triangulate_face(const Hexahedron20 & e, const std::size_t & face_id, std::vector & triangles_nodes) { const auto face_indices = e.boundary_elements_node_indices(); auto triangle_1 = std::vector {e.node(face_indices[face_id][0]), e.node(face_indices[face_id][1]), e.node(face_indices[face_id][2])}; auto triangle_2 = std::vector {e.node(face_indices[face_id][2]), e.node(face_indices[face_id][3]), e.node(face_indices[face_id][0])}; diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].h index 46e7a8f3..7dba25d0 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron20].h @@ -7,7 +7,7 @@ namespace SofaCaribou::forcefield { // Hexahedron quadratic specialization template <> auto CaribouForcefield::templateName(const CaribouForcefield *) -> std::string; -template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Hexahedron20 & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Hexahedron20 & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].cpp index a2206778..ec2b3c4d 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].cpp @@ -22,7 +22,7 @@ auto CaribouForcefield::templateName(const CaribouForcefield -void CaribouForcefield::triangulate_face(const Hexahedron & e, const std::size_t & face_id, std::vector & triangles_nodes) { +void CaribouForcefield::triangulate_face(const Hexahedron & e, const std::size_t & face_id, std::vector & triangles_nodes) { const auto face_indices = e.boundary_elements_node_indices(); auto triangle_1 = std::vector {e.node(face_indices[face_id][0]), e.node(face_indices[face_id][1]), e.node(face_indices[face_id][2])}; auto triangle_2 = std::vector {e.node(face_indices[face_id][2]), e.node(face_indices[face_id][3]), e.node(face_indices[face_id][0])}; diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].h index a1d156f6..e3b04c96 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Hexahedron].h @@ -7,7 +7,7 @@ namespace SofaCaribou::forcefield { // Hexahedron linear specialization template <> auto CaribouForcefield::templateName(const CaribouForcefield *) -> std::string; -template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Hexahedron & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Hexahedron & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].cpp index 0649b708..cc86cac9 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].cpp @@ -25,7 +25,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Quad8<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Quad8<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle_1 = std::vector {e.node(0), e.node(1), e.node(2)}; auto triangle_2 = std::vector {e.node(2), e.node(3), e.node(0)}; for (const auto &n : triangle_1) { @@ -47,7 +47,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Quad8<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Quad8<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle_1 = std::vector {e.node(0), e.node(1), e.node(2)}; auto triangle_2 = std::vector {e.node(2), e.node(3), e.node(0)}; for (const auto &n : triangle_1) { diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].h index c9733e27..e928a4ec 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad8].h @@ -8,12 +8,12 @@ namespace SofaCaribou::forcefield { // Quad linear specialization // 2D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad8 & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad8 & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; // 3D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad8 & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad8 & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].cpp index ab5c4287..2db5b42a 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].cpp @@ -25,7 +25,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Quad<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Quad<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle_1 = std::vector {e.node(0), e.node(1), e.node(2)}; auto triangle_2 = std::vector {e.node(2), e.node(3), e.node(0)}; for (const auto &n : triangle_1) { @@ -47,7 +47,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Quad<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Quad<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle_1 = std::vector {e.node(0), e.node(1), e.node(2)}; auto triangle_2 = std::vector {e.node(2), e.node(3), e.node(0)}; for (const auto &n : triangle_1) { diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].h index ec859003..fd90158f 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Quad].h @@ -8,12 +8,12 @@ namespace SofaCaribou::forcefield { // Quad linear specialization // 2D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; // 3D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Quad & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].cpp index 237715cc..f1aa3a9c 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].cpp @@ -22,7 +22,7 @@ auto CaribouForcefield::templateName(const CaribouForcefield -void CaribouForcefield::triangulate_face(const Tetrahedron10 &e, const std::size_t &face_id, std::vector &triangles_nodes) { +void CaribouForcefield::triangulate_face(const Tetrahedron10 &e, const std::size_t &face_id, std::vector &triangles_nodes) { const auto face_indices = e.boundary_elements_node_indices(); auto triangle_1 = std::array{e.node(face_indices[face_id][0]), e.node(face_indices[face_id][1]), e.node(face_indices[face_id][2])}; for (const auto &n : triangle_1) { diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].h index efc06f71..af863fc6 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron10].h @@ -7,7 +7,7 @@ namespace SofaCaribou::forcefield { // Tetrahedron quadratic specialization template <> auto CaribouForcefield::templateName(const CaribouForcefield *) -> std::string; -template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Tetrahedron10 & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Tetrahedron10 & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].cpp index 6e86be44..359df9b9 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].cpp @@ -21,7 +21,7 @@ auto CaribouForcefield::templateName(const CaribouForcefield -void CaribouForcefield::triangulate_face(const Tetrahedron &e, const std::size_t &face_id, std::vector &triangles_nodes) { +void CaribouForcefield::triangulate_face(const Tetrahedron &e, const std::size_t &face_id, std::vector &triangles_nodes) { const auto face_indices = e.boundary_elements_node_indices(); auto triangle_1 = std::array{e.node(face_indices[face_id][0]), e.node(face_indices[face_id][1]), e.node(face_indices[face_id][2])}; for (const auto &n : triangle_1) { diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].h index 99a5bd8c..39737ba7 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Tetrahedron].h @@ -7,7 +7,7 @@ namespace SofaCaribou::forcefield { // Tetrahedron linear specialization template <> auto CaribouForcefield::templateName(const CaribouForcefield *) -> std::string; -template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Tetrahedron & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield::triangulate_face(const caribou::geometry::Tetrahedron & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp index 1a149ad5..02a48bec 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp @@ -43,7 +43,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Triangle6<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Triangle6<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle = std::vector {e.node(0), e.node(1), e.node(2)}; for (const auto &n : triangle) { triangles_nodes.emplace_back(n[0], n[1], n[2]); diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].h index d46a7f4b..fa11b849 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].h @@ -9,12 +9,12 @@ namespace SofaCaribou::forcefield { // 2D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; // 3D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].h b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].h index c428960c..38c2de0a 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].h +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].h @@ -8,12 +8,12 @@ namespace SofaCaribou::forcefield { // Triangle linear specialization // 2D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; // 3D template <> auto CaribouForcefield>::templateName(const CaribouForcefield> *) -> std::string; -template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); +template <> void CaribouForcefield>::triangulate_face(const caribou::geometry::Triangle & e, const std::size_t & face_id, std::vector & triangles_nodes); extern template class CaribouForcefield>; } \ No newline at end of file diff --git a/src/SofaCaribou/Forcefield/HexahedronElasticForce.cpp b/src/SofaCaribou/Forcefield/HexahedronElasticForce.cpp index ce1186ca..ea4b22e9 100644 --- a/src/SofaCaribou/Forcefield/HexahedronElasticForce.cpp +++ b/src/SofaCaribou/Forcefield/HexahedronElasticForce.cpp @@ -616,7 +616,7 @@ void HexahedronElasticForce::draw(const sofa::core::visual::VisualParams* vparam const VecCoord& x = this->mstate->read(sofa::core::ConstVecCoordId::position())->getValue(); - std::vector< sofa::type::Vector3 > points[6]; + std::vector< sofa::type::Vec3 > points[6]; const auto number_of_elements = topology->getNbHexahedra(); for (std::size_t hexa_id = 0; hexa_id < number_of_elements; ++hexa_id) { const auto & node_indices = topology->getHexahedron(static_cast(hexa_id)); @@ -695,7 +695,7 @@ void HexahedronElasticForce::draw(const sofa::core::visual::VisualParams* vparam vparams->drawTool()->drawTriangles(points[5], sofa::type::RGBAColor(0.7f,0.1f,0.7f,1.0f)); - std::vector< sofa::type::Vector3 > ignored_points[6]; + std::vector< sofa::type::Vec3 > ignored_points[6]; for (std::size_t hexa_id = 0; hexa_id < number_of_elements; ++hexa_id) { const auto & node_indices = topology->getHexahedron(static_cast(hexa_id)); diff --git a/src/SofaCaribou/Mapping/CaribouBarycentricMapping.inl b/src/SofaCaribou/Mapping/CaribouBarycentricMapping.inl index c5456fc7..59b1739a 100644 --- a/src/SofaCaribou/Mapping/CaribouBarycentricMapping.inl +++ b/src/SofaCaribou/Mapping/CaribouBarycentricMapping.inl @@ -285,7 +285,7 @@ void CaribouBarycentricMapping::draw(const sofa::core: if (not p_barycentric_container->outside_nodes().empty()) { const auto mapped_rest_positions = this->getToModel()->readRestPositions(); const auto & outside_nodes = p_barycentric_container->outside_nodes(); - std::vector outside_nodes_positions (outside_nodes.size()); + std::vector outside_nodes_positions (outside_nodes.size()); for (std::size_t i = 0; i < outside_nodes.size(); ++i) { const auto & node_index = outside_nodes[i]; for (std::size_t j = 0; j < MappedDimension; ++j) { diff --git a/src/SofaCaribou/Ode/BackwardEulerODESolver.cpp b/src/SofaCaribou/Ode/BackwardEulerODESolver.cpp index 58d134d2..74784133 100644 --- a/src/SofaCaribou/Ode/BackwardEulerODESolver.cpp +++ b/src/SofaCaribou/Ode/BackwardEulerODESolver.cpp @@ -35,7 +35,7 @@ using sofa::core::behavior::MultiMatrixAccessor; using sofa::core::MechanicalParams; using sofa::core::MultiVecCoordId; using sofa::core::MultiVecDerivId; -using sofa::component::linearsolver::DefaultMultiMatrixAccessor; +using sofa::core::behavior::DefaultMultiMatrixAccessor; using Timer = sofa::helper::AdvancedTimer; // Constructor diff --git a/src/SofaCaribou/Ode/BackwardEulerODESolver.h b/src/SofaCaribou/Ode/BackwardEulerODESolver.h index c722133f..6b32bfed 100644 --- a/src/SofaCaribou/Ode/BackwardEulerODESolver.h +++ b/src/SofaCaribou/Ode/BackwardEulerODESolver.h @@ -4,7 +4,7 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include +#include #include DISABLE_ALL_WARNINGS_END @@ -118,7 +118,7 @@ class BackwardEulerODESolver : public NewtonRaphsonSolver { /** @see NewtonRaphsonSolver::assemble_system_matrix */ void assemble_system_matrix(const sofa::core::MechanicalParams & mechanical_parameters, - sofa::component::linearsolver::DefaultMultiMatrixAccessor & matrix_accessor, + sofa::core::behavior::DefaultMultiMatrixAccessor & matrix_accessor, SofaCaribou::Algebra::BaseMatrix * A) final; /** @see NewtonRaphsonSolver::propagate_position_increment */ diff --git a/src/SofaCaribou/Ode/NewtonRaphsonSolver.cpp b/src/SofaCaribou/Ode/NewtonRaphsonSolver.cpp index 34b52f1b..717d00e6 100644 --- a/src/SofaCaribou/Ode/NewtonRaphsonSolver.cpp +++ b/src/SofaCaribou/Ode/NewtonRaphsonSolver.cpp @@ -6,9 +6,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include #include -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 210600) #include -#endif #include #include #include @@ -17,10 +15,6 @@ DISABLE_ALL_WARNINGS_BEGIN #include #include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 201200) -namespace sofa { using Size = int; } -#endif - namespace SofaCaribou::ode { using sofa::core::ExecParams; @@ -190,7 +184,7 @@ void NewtonRaphsonSolver::solve(const ExecParams *params, SReal dt, MultiVecCoor // accumulate the mechanical objects and mappings. This one will not really // compute the mechanical graph (not explicitly at least). Hence the following // @todo (jnbrunet2000@gmail.com) Create a CaribouMultiMatrixAccessor for that. - sofa::component::linearsolver::DefaultMultiMatrixAccessor accessor; + sofa::core::behavior::DefaultMultiMatrixAccessor accessor; // Step 1 Get dimension of each top level mechanical states using // BaseMechanicalState::getMatrixSize(), and accumulate mechanical diff --git a/src/SofaCaribou/Ode/NewtonRaphsonSolver.h b/src/SofaCaribou/Ode/NewtonRaphsonSolver.h index 680a3daa..a2d87601 100644 --- a/src/SofaCaribou/Ode/NewtonRaphsonSolver.h +++ b/src/SofaCaribou/Ode/NewtonRaphsonSolver.h @@ -10,7 +10,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include #include #include -#include +#include DISABLE_ALL_WARNINGS_END #include @@ -136,7 +136,7 @@ class NewtonRaphsonSolver : public sofa::core::behavior::OdeSolver { * matrix accessor. */ virtual void assemble_system_matrix(const sofa::core::MechanicalParams & mechanical_parameters, - sofa::component::linearsolver::DefaultMultiMatrixAccessor & matrix_accessor, + sofa::core::behavior::DefaultMultiMatrixAccessor & matrix_accessor, SofaCaribou::Algebra::BaseMatrix * A) = 0; /** diff --git a/src/SofaCaribou/Ode/StaticODESolver.cpp b/src/SofaCaribou/Ode/StaticODESolver.cpp index 644a42a3..3cbf2ee8 100644 --- a/src/SofaCaribou/Ode/StaticODESolver.cpp +++ b/src/SofaCaribou/Ode/StaticODESolver.cpp @@ -60,7 +60,7 @@ void StaticODESolver::assemble_rhs_vector(const sofa::core::MechanicalParams &me // Assemble A in A [dx] = F void StaticODESolver::assemble_system_matrix(const sofa::core::MechanicalParams &mechanical_parameters, - sofa::component::linearsolver::DefaultMultiMatrixAccessor & matrix_accessor, + sofa::core::behavior::DefaultMultiMatrixAccessor & matrix_accessor, SofaCaribou::Algebra::BaseMatrix *A) { // Step 1. Building stage: // Here we go down on the current context sub-graph and call : diff --git a/src/SofaCaribou/Ode/StaticODESolver.h b/src/SofaCaribou/Ode/StaticODESolver.h index 47d990e2..033c362c 100644 --- a/src/SofaCaribou/Ode/StaticODESolver.h +++ b/src/SofaCaribou/Ode/StaticODESolver.h @@ -4,7 +4,7 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include +#include #include DISABLE_ALL_WARNINGS_BEGIN @@ -54,7 +54,7 @@ class StaticODESolver : public NewtonRaphsonSolver { /** @see NewtonRaphsonSolver::assemble_system_matrix */ void assemble_system_matrix(const sofa::core::MechanicalParams & mechanical_parameters, - sofa::component::linearsolver::DefaultMultiMatrixAccessor & matrix_accessor, + sofa::core::behavior::DefaultMultiMatrixAccessor & matrix_accessor, SofaCaribou::Algebra::BaseMatrix * A) final; /** @see NewtonRaphsonSolver::propagate_solution_increment */ diff --git a/src/SofaCaribou/Solver/ConjugateGradientSolver.h b/src/SofaCaribou/Solver/ConjugateGradientSolver.h index c13dc868..7e7d01c9 100644 --- a/src/SofaCaribou/Solver/ConjugateGradientSolver.h +++ b/src/SofaCaribou/Solver/ConjugateGradientSolver.h @@ -15,7 +15,6 @@ DISABLE_ALL_WARNINGS_END namespace SofaCaribou::solver { using sofa::core::objectmodel::Data; -using namespace sofa::component::linearsolver; using namespace sofa::core::behavior; /** diff --git a/src/SofaCaribou/Solver/EigenSolver.h b/src/SofaCaribou/Solver/EigenSolver.h index ec5e7e7c..40287430 100644 --- a/src/SofaCaribou/Solver/EigenSolver.h +++ b/src/SofaCaribou/Solver/EigenSolver.h @@ -9,16 +9,9 @@ DISABLE_ALL_WARNINGS_BEGIN #include #include #include -#include +#include DISABLE_ALL_WARNINGS_END -#if (defined(SOFA_VERSION) && SOFA_VERSION < 201200) -namespace sofa { -using Size = unsigned int; -using Index = unsigned int; -} -#endif - namespace SofaCaribou::solver { /** @@ -47,7 +40,7 @@ class EigenSolver : public sofa::core::behavior::LinearSolver, public SofaCaribo * @return The matrix accessor containing the lists of top level mechanical objects, a pointer for * their matrix and a vector of mappings for mapped mechanical objects. */ - auto assemble (const sofa::core::MechanicalParams* mparams) -> sofa::component::linearsolver::DefaultMultiMatrixAccessor; + auto assemble (const sofa::core::MechanicalParams* mparams) -> sofa::core::behavior::DefaultMultiMatrixAccessor; /** * Reset the complete system (A, x and b are cleared). @@ -104,7 +97,7 @@ class EigenSolver : public sofa::core::behavior::LinearSolver, public SofaCaribo * * Use the EigenSparseSolver::matrix() method to get a reference to the global system matrix. */ - auto matrix_accessor() const -> const sofa::component::linearsolver::DefaultMultiMatrixAccessor & { return p_accessor; } + auto matrix_accessor() const -> const sofa::core::behavior::DefaultMultiMatrixAccessor & { return p_accessor; } /** Get a readonly reference to the global assembled system matrix. */ auto A() const -> const SofaCaribou::Algebra::EigenMatrix * { return p_A_ptr; } @@ -172,7 +165,7 @@ class EigenSolver : public sofa::core::behavior::LinearSolver, public SofaCaribo sofa::core::MechanicalParams p_mechanical_params; /// Accessor used to determine the index of each mechanical object matrix and vector in the global system. - sofa::component::linearsolver::DefaultMultiMatrixAccessor p_accessor; + sofa::core::behavior::DefaultMultiMatrixAccessor p_accessor; /// The identifier of the b vector sofa::core::MultiVecDerivId p_b_id; diff --git a/src/SofaCaribou/Solver/EigenSolver.inl b/src/SofaCaribou/Solver/EigenSolver.inl index dcd6b646..99833b49 100644 --- a/src/SofaCaribou/Solver/EigenSolver.inl +++ b/src/SofaCaribou/Solver/EigenSolver.inl @@ -9,7 +9,6 @@ DISABLE_ALL_WARNINGS_BEGIN #include #include #include -//#include DISABLE_ALL_WARNINGS_END #ifndef _WIN32 @@ -28,10 +27,10 @@ void EigenSolver::resetSystem() { } template -auto EigenSolver::assemble (const sofa::core::MechanicalParams* mparams) -> sofa::component::linearsolver::DefaultMultiMatrixAccessor +auto EigenSolver::assemble (const sofa::core::MechanicalParams* mparams) -> sofa::core::behavior::DefaultMultiMatrixAccessor { using Timer = sofa::helper::AdvancedTimer; - sofa::component::linearsolver::DefaultMultiMatrixAccessor accessor; + sofa::core::behavior::DefaultMultiMatrixAccessor accessor; // Step 1. Preparation stage // This stage go down on the sub-graph and gather the top-level mechanical objects (mechanical objects that @@ -189,7 +188,6 @@ void EigenSolver::setSystemLHVector(sofa::core::MultiVecDerivId x template void EigenSolver::solveSystem() { using Timer = sofa::helper::AdvancedTimer; - using namespace sofa::component::linearsolver; using namespace sofa::core::behavior; sofa::simulation::common::MechanicalOperations mop( &p_mechanical_params, this->getContext() ); diff --git a/src/SofaCaribou/Topology/CaribouTopology[Hexahedron20].cpp b/src/SofaCaribou/Topology/CaribouTopology[Hexahedron20].cpp index 6b49a22a..da6c7604 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Hexahedron20].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Hexahedron20].cpp @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; diff --git a/src/SofaCaribou/Topology/CaribouTopology[Hexahedron].cpp b/src/SofaCaribou/Topology/CaribouTopology[Hexahedron].cpp index b3b4dd54..b8c0f10d 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Hexahedron].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Hexahedron].cpp @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; @@ -12,6 +12,7 @@ using namespace caribou::geometry; using namespace sofa::component::topology; using namespace sofa::core::objectmodel; using namespace sofa::core::topology; +using namespace sofa::component::topology::container::dynamic; using namespace caribou; namespace SofaCaribou::topology { diff --git a/src/SofaCaribou/Topology/CaribouTopology[Quad8].cpp b/src/SofaCaribou/Topology/CaribouTopology[Quad8].cpp index 66eef25d..20f5bfe7 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Quad8].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Quad8].cpp @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; diff --git a/src/SofaCaribou/Topology/CaribouTopology[Quad].cpp b/src/SofaCaribou/Topology/CaribouTopology[Quad].cpp index b9c1fb84..9e9ab19d 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Quad].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Quad].cpp @@ -4,13 +4,14 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; using namespace caribou::geometry; using namespace sofa::component::topology; using namespace sofa::core::topology; +using namespace sofa::component::topology::container::dynamic; using namespace caribou; namespace SofaCaribou::topology { diff --git a/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron10].cpp b/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron10].cpp index 58a69cad..cce61183 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron10].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron10].cpp @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; diff --git a/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron].cpp b/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron].cpp index a6fe735b..88609430 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Tetrahedron].cpp @@ -4,13 +4,14 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; using namespace caribou::geometry; using namespace sofa::component::topology; using namespace sofa::core::topology; +using namespace sofa::component::topology::container::dynamic; using namespace caribou; namespace SofaCaribou::topology { diff --git a/src/SofaCaribou/Topology/CaribouTopology[Triangle6].cpp b/src/SofaCaribou/Topology/CaribouTopology[Triangle6].cpp index 189688da..a30cb327 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Triangle6].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Triangle6].cpp @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; diff --git a/src/SofaCaribou/Topology/CaribouTopology[Triangle].cpp b/src/SofaCaribou/Topology/CaribouTopology[Triangle].cpp index 5809c7c7..232537e5 100644 --- a/src/SofaCaribou/Topology/CaribouTopology[Triangle].cpp +++ b/src/SofaCaribou/Topology/CaribouTopology[Triangle].cpp @@ -4,13 +4,14 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include DISABLE_ALL_WARNINGS_END using sofa::core::RegisterObject; using namespace caribou::geometry; using namespace sofa::component::topology; using namespace sofa::core::topology; +using namespace sofa::component::topology::container::dynamic; using namespace caribou; namespace SofaCaribou::topology { diff --git a/src/SofaCaribou/Topology/FictitiousGrid.h b/src/SofaCaribou/Topology/FictitiousGrid.h index bb65dcb5..e5919fd1 100644 --- a/src/SofaCaribou/Topology/FictitiousGrid.h +++ b/src/SofaCaribou/Topology/FictitiousGrid.h @@ -370,16 +370,16 @@ class FictitiousGrid : public virtual BaseObject std::vector p_cell_index_in_grid; ///< Contains the grid's nodes to be draw - std::vector p_drawing_nodes_vector; + std::vector p_drawing_nodes_vector; ///< Contains the grid's edges to be draw - std::vector p_drawing_edges_vector; + std::vector p_drawing_edges_vector; ///< Contains the edges of subdivided cells for each region to be draw - std::vector> p_drawing_subdivided_edges_vector; + std::vector> p_drawing_subdivided_edges_vector; ///< Contains the cells for each region to be draw - std::vector> p_drawing_cells_vector; + std::vector> p_drawing_cells_vector; // ---------------------- // Private static members diff --git a/src/SofaCaribou/Topology/FictitiousGrid.inl b/src/SofaCaribou/Topology/FictitiousGrid.inl index ab37f010..bd202fb2 100644 --- a/src/SofaCaribou/Topology/FictitiousGrid.inl +++ b/src/SofaCaribou/Topology/FictitiousGrid.inl @@ -4,7 +4,7 @@ DISABLE_ALL_WARNINGS_BEGIN #include -#include +#include #include #include DISABLE_ALL_WARNINGS_END @@ -204,7 +204,7 @@ void FictitiousGrid::init() { << "', but this one does not contain any positions."; return; } else { - auto mesh_topology = (topology) ? dynamic_cast(topology) : nullptr; + auto mesh_topology = (topology) ? dynamic_cast(topology) : nullptr; if (mesh_topology) { d_surface_positions.setParent(&(mesh_topology->seqPoints)); msg_info() << "Automatically found the positions vector at '" diff --git a/unittest/SofaCaribou/Algebra/test_base_vector_operations.cpp b/unittest/SofaCaribou/Algebra/test_base_vector_operations.cpp index 95e2fde2..7daaf8fc 100644 --- a/unittest/SofaCaribou/Algebra/test_base_vector_operations.cpp +++ b/unittest/SofaCaribou/Algebra/test_base_vector_operations.cpp @@ -3,26 +3,15 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include #include - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211299) -#include -using namespace sofa::component::linearsolver; -#else #include using namespace sofa::linearalgebra; -#endif // (defined(SOFA_VERSION) && SOFA_VERSION < 211299) DISABLE_ALL_WARNINGS_END #include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 201200) -namespace sofa { using Index = unsigned int; } -#endif - TEST(Algebra, SofaFullDFullDDotProduct) { const auto n = 100; const Eigen::VectorXd v1 = Eigen::VectorXd::Random(n); diff --git a/unittest/SofaCaribou/Algebra/test_eigen_matrix_wrapper.cpp b/unittest/SofaCaribou/Algebra/test_eigen_matrix_wrapper.cpp index c70142bd..40042b29 100644 --- a/unittest/SofaCaribou/Algebra/test_eigen_matrix_wrapper.cpp +++ b/unittest/SofaCaribou/Algebra/test_eigen_matrix_wrapper.cpp @@ -4,20 +4,11 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 201299) -#include -using Mat2x2f = sofa::type::Mat2x2f; -using Mat2x2d = sofa::type::Mat2x2d; -using Mat3x3f = sofa::type::Mat3x3f; -using Mat3x3d = sofa::type::Mat3x3d; -#else #include using Mat2x2f = sofa::type::Mat2x2f; using Mat2x2d = sofa::type::Mat2x2d; using Mat3x3f = sofa::type::Mat3x3f; using Mat3x3d = sofa::type::Mat3x3d; -#endif DISABLE_ALL_WARNINGS_END #include diff --git a/unittest/SofaCaribou/CMakeLists.txt b/unittest/SofaCaribou/CMakeLists.txt index 2d53df4e..0ab493de 100644 --- a/unittest/SofaCaribou/CMakeLists.txt +++ b/unittest/SofaCaribou/CMakeLists.txt @@ -15,7 +15,7 @@ set(SOURCE_FILES enable_testing() -find_package(SOFA COMPONENTS SofaFramework Sofa.Simulation.Graph SofaBaseMechanics SofaBaseUtils SofaBaseLinearSolver SofaMiscForceField QUIET REQUIRED) +find_package(SOFA COMPONENTS SofaFramework Sofa.Simulation.Graph Sofa.Component.StateContainer Sofa.Component.Mass Sofa.Component.SceneUtility Sofa.Component.LinearSolver.Iterative Sofa.Component.Mass Sofa.Component.SolidMechanics.FEM.Elastic QUIET REQUIRED) find_package(Caribou COMPONENTS Topology REQUIRED) find_package(Threads REQUIRED) @@ -31,7 +31,7 @@ endif() target_link_libraries(${PROJECT_NAME} PUBLIC gtest) target_link_libraries(${PROJECT_NAME} PUBLIC SofaCaribou) -target_link_libraries(${PROJECT_NAME} PUBLIC SofaHelper SofaBaseMechanics SofaBaseUtils SofaBaseLinearSolver SofaMiscForceField) +target_link_libraries(${PROJECT_NAME} PUBLIC SofaHelper Sofa.Component.StateContainer Sofa.Component.Mass Sofa.Component.SceneUtility Sofa.Component.LinearSolver.Iterative Sofa.Component.SolidMechanics.FEM.Elastic) target_link_libraries(${PROJECT_NAME} PUBLIC $<$,$,8.0>>:stdc++fs> $<$,$,9.0>>:c++fs>) diff --git a/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp b/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp index 3b783aae..fa4d2408 100644 --- a/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp +++ b/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp @@ -1,16 +1,11 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include -#include +#include +#include +#include #include DISABLE_ALL_WARNINGS_END @@ -21,12 +16,7 @@ using sofa::helper::system::PluginManager ; using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace sofa::helper::logging; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif TEST(HyperelasticForcefield, Hexahedron_from_SOFA) { MessageDispatcher::addHandler( MainGtestMessageHandler::getInstance() ) ; @@ -36,14 +26,8 @@ TEST(HyperelasticForcefield, Hexahedron_from_SOFA) { auto root = getSimulation()->createNewNode("root"); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); -#else - createObject(root, "RequiredPlugin", {{"pluginName", "SofaComponentAll"}}); -#endif -#if (defined(SOFA_VERSION) && SOFA_VERSION > 201299) createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); -#endif createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); auto meca = createChild(root, "meca"); diff --git a/unittest/SofaCaribou/Forcefield/test_tractionforce.cpp b/unittest/SofaCaribou/Forcefield/test_tractionforce.cpp index 1b5c9ab5..d008793b 100644 --- a/unittest/SofaCaribou/Forcefield/test_tractionforce.cpp +++ b/unittest/SofaCaribou/Forcefield/test_tractionforce.cpp @@ -3,14 +3,10 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include +#include +#include #include DISABLE_ALL_WARNINGS_END @@ -19,12 +15,7 @@ using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace caribou; using namespace caribou::geometry; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif class TractionForcefield : public BaseTest { void SetUp() override { diff --git a/unittest/SofaCaribou/Mass/test_cariboumass.cpp b/unittest/SofaCaribou/Mass/test_cariboumass.cpp index 49aaebc3..2aedf6f8 100644 --- a/unittest/SofaCaribou/Mass/test_cariboumass.cpp +++ b/unittest/SofaCaribou/Mass/test_cariboumass.cpp @@ -1,19 +1,14 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include DISABLE_ALL_WARNINGS_END #include @@ -27,12 +22,7 @@ using namespace sofa::helper::logging; using namespace SofaCaribou::mass; using namespace caribou::geometry; using namespace caribou; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif TEST(CaribouMass, LinearTetrahedron) { using namespace sofa::core::objectmodel; @@ -41,11 +31,7 @@ TEST(CaribouMass, LinearTetrahedron) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine SofaTopologyMapping"}}); -#else - createObject(root, "RequiredPlugin", {{"pluginName", "SofaComponentAll"}}); -#endif // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); @@ -53,7 +39,7 @@ TEST(CaribouMass, LinearTetrahedron) { createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"src", "@grid"}}).get() ); createObject(root, "TetrahedronSetTopologyContainer", {{"name", "topology"}}); @@ -63,15 +49,6 @@ TEST(CaribouMass, LinearTetrahedron) { auto caribou_mass = dynamic_cast *> ( createObject(root, "CaribouMass", {{"name", "caribou_mass"}, {"topology", "@topology"}, {"density", "2"}}).get() ); -#if (defined(SOFA_VERSION) && SOFA_VERSION < 220600) - auto sofa_mass = dynamic_cast *> ( - createObject(root, "MeshMatrixMass", {{"name", "sofa_mass"}, {"topology", "@topology"}, {"massDensity", "2"}, {"lumping", "false"}}).get() - ); - - auto sofa_mass_diagonal = dynamic_cast *> ( - createObject(root, "MeshMatrixMass", {{"name", "sofa_mass_diagonal"}, {"topology", "@topology"}, {"massDensity", "2"}, {"lumping", "true"}}).get() - ); -#else // version is >= v22.06 auto sofa_mass = dynamic_cast *> ( createObject(root, "MeshMatrixMass", {{"name", "sofa_mass"}, {"topology", "@topology"}, {"massDensity", "2"}, {"lumping", "false"}}).get() ); @@ -79,7 +56,6 @@ TEST(CaribouMass, LinearTetrahedron) { auto sofa_mass_diagonal = dynamic_cast *> ( createObject(root, "MeshMatrixMass", {{"name", "sofa_mass_diagonal"}, {"topology", "@topology"}, {"massDensity", "2"}, {"lumping", "true"}}).get() ); -#endif getSimulation()->init(root.get()); // Get M from caribou @@ -88,7 +64,7 @@ TEST(CaribouMass, LinearTetrahedron) { // Get M from caribou using SOFA API SofaCaribou::Algebra::EigenMatrix> M2; - sofa::component::linearsolver::DefaultMultiMatrixAccessor accessor; + sofa::core::behavior::DefaultMultiMatrixAccessor accessor; M2.resize((signed) mo->getSize()*3, (signed) mo->getSize()*3); accessor.setGlobalMatrix(&M2); accessor.addMechanicalState(mo); @@ -132,17 +108,10 @@ TEST(CaribouMass, LinearTetrahedron) { using Real = CaribouMass::Real; using VecDeriv = CaribouMass::VecDeriv; using DataVecDeriv = CaribouMass::DataVecDeriv; -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) - DataVecDeriv d_f_caribou (VecDeriv(static_cast(mo->getSize()), {0, 0, 0})); - DataVecDeriv d_f_caribou_dia (VecDeriv(static_cast(mo->getSize()), {0, 0, 0})); - DataVecDeriv d_f_sofa (VecDeriv(static_cast(mo->getSize()), {0, 0, 0})); - DataVecDeriv d_f_sofa_dia (VecDeriv(static_cast(mo->getSize()), {0, 0, 0})); -#else DataVecDeriv d_f_caribou (VecDeriv(mo->getSize(), {0, 0, 0})); DataVecDeriv d_f_caribou_dia (VecDeriv(mo->getSize(), {0, 0, 0})); DataVecDeriv d_f_sofa (VecDeriv(mo->getSize(), {0, 0, 0})); DataVecDeriv d_f_sofa_dia (VecDeriv(mo->getSize(), {0, 0, 0})); -#endif caribou_mass->findData("lumped")->read("false"); caribou_mass->addForce(&mechanical_parameters, d_f_caribou, mo->x, mo->v); @@ -169,11 +138,7 @@ TEST(CaribouMass, LinearHexahedron) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine SofaTopologyMapping"}}); -#else - createObject(root, "RequiredPlugin", {{"pluginName", "SofaComponentAll"}}); -#endif // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); @@ -181,7 +146,7 @@ TEST(CaribouMass, LinearHexahedron) { createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"src", "@grid"}}).get() ); createObject(root, "HexahedronSetTopologyContainer", {{"name", "topology"}, {"src", "@grid"}}); @@ -190,15 +155,9 @@ TEST(CaribouMass, LinearHexahedron) { createObject(root, "CaribouMass", {{"name", "caribou_mass"}, {"topology", "@topology"}, {"density", "2"}}).get() ); -#if (defined(SOFA_VERSION) && SOFA_VERSION < 220600) - auto sofa_mass = dynamic_cast *> ( - createObject(root, "MeshMatrixMass", {{"name", "sofa_mass"}, {"topology", "@topology"}, {"massDensity", "2"}}).get() - ); -#else // version is >= v22.06 auto sofa_mass = dynamic_cast *> ( createObject(root, "MeshMatrixMass", {{"name", "sofa_mass"}, {"topology", "@topology"}, {"massDensity", "2"}}).get() ); -#endif getSimulation()->init(root.get()); @@ -207,7 +166,7 @@ TEST(CaribouMass, LinearHexahedron) { // Get M from SOFA SofaCaribou::Algebra::EigenMatrix> SofaM; - sofa::component::linearsolver::DefaultMultiMatrixAccessor accessor; + sofa::core::behavior::DefaultMultiMatrixAccessor accessor; SofaM.resize((signed) mo->getSize()*3, (signed) mo->getSize()*3); accessor.setGlobalMatrix(&SofaM); accessor.addMechanicalState(mo); diff --git a/unittest/SofaCaribou/ODE/test_backward_euler.cpp b/unittest/SofaCaribou/ODE/test_backward_euler.cpp index 88db3da2..855e90d1 100644 --- a/unittest/SofaCaribou/ODE/test_backward_euler.cpp +++ b/unittest/SofaCaribou/ODE/test_backward_euler.cpp @@ -4,41 +4,17 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include -#include +#include +#include +#include DISABLE_ALL_WARNINGS_END using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace sofa::helper::logging; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 201200) -namespace sofa { using Size = unsigned int; } -#endif - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -namespace sofa::type { -using Vec3 = ::sofa::defaulttype::Vec3; -template -using Mat = ::sofa::defaulttype::Mat; -template -using Vec = ::sofa::defaulttype::Vec; -} -#endif /** Make sure residual norms at each newton steps remains the same */ TEST(BackwardEulerODESolver, Beam) { @@ -47,14 +23,8 @@ TEST(BackwardEulerODESolver, Beam) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); -#else - createObject(root, "RequiredPlugin", {{"pluginName", "SofaComponentAll"}}); -#endif -#if (defined(SOFA_VERSION) && SOFA_VERSION > 201299) createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); -#endif // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); @@ -69,7 +39,7 @@ TEST(BackwardEulerODESolver, Beam) { ); SOFA_UNUSED(solver); createObject(meca, "LLTSolver", {{"Backend", "Pardiso"}}); - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(meca, "MechanicalObject", {{"name", "mo"}, {"src", "@../grid"}}).get() ); diff --git a/unittest/SofaCaribou/ODE/test_static.cpp b/unittest/SofaCaribou/ODE/test_static.cpp index 70d7f54f..6ca14956 100644 --- a/unittest/SofaCaribou/ODE/test_static.cpp +++ b/unittest/SofaCaribou/ODE/test_static.cpp @@ -4,27 +4,17 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include -#include +#include +#include +#include DISABLE_ALL_WARNINGS_END using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace sofa::helper::logging; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif /** Initialization without any linear solver (expecting an error) */ TEST(StaticODESolver, InitWithoutSolver) { @@ -47,9 +37,7 @@ TEST(StaticODESolver, InitSofaSolver) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBaseLinearSolver"}}); -#endif createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); createObject(root, "StaticODESolver", {{"printLog", "true"}}); @@ -67,9 +55,7 @@ TEST(StaticODESolver, InitCaribouSolver) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBaseLinearSolver"}}); -#endif createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); createObject(root, "StaticODESolver", {{"printLog", "true"}}); @@ -105,14 +91,8 @@ TEST(StaticODESolver, Beam) { auto root = getSimulation()->createNewNode("root"); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); -#else - createObject(root, "RequiredPlugin", {{"pluginName", "SofaComponentAll"}}); -#endif -#if (defined(SOFA_VERSION) && SOFA_VERSION > 201299) createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); -#endif createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); auto meca = createChild(root, "meca"); @@ -121,7 +101,7 @@ TEST(StaticODESolver, Beam) { createObject(meca, "StaticODESolver", {{"newton_iterations", "10"}, {"correction_tolerance_threshold", "1e-5"}, {"residual_tolerance_threshold", "1e-5"}}).get() ); createObject(meca, "LDLTSolver"); - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(meca, "MechanicalObject", {{"name", "mo"}, {"src", "@../grid"}}).get() ); diff --git a/unittest/SofaCaribou/Topology/test_cariboutopology.cpp b/unittest/SofaCaribou/Topology/test_cariboutopology.cpp index 6abf37a4..71a2ae7f 100644 --- a/unittest/SofaCaribou/Topology/test_cariboutopology.cpp +++ b/unittest/SofaCaribou/Topology/test_cariboutopology.cpp @@ -1,15 +1,10 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif -#include -#include -#include +#include +#include +#include #include #include DISABLE_ALL_WARNINGS_BEGIN @@ -31,12 +26,7 @@ using sofa::helper::system::PluginManager ; using namespace sofa::simulation; using namespace sofa::simpleapi; using namespace sofa::helper::logging; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif TEST(CaribouTopology, QuadLinear2DAttachDomain) { using namespace caribou; @@ -117,7 +107,7 @@ TEST(CaribouTopology, QuadLinear2DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec2d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -244,7 +234,7 @@ TEST(CaribouTopology, QuadQuadratic2DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec2d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -371,7 +361,7 @@ TEST(CaribouTopology, QuadLinear3DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec3d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -499,7 +489,7 @@ TEST(CaribouTopology, QuadQuadratic3DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec3d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -627,7 +617,7 @@ TEST(CaribouTopology, TriangleLinear2DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec2d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -754,7 +744,7 @@ TEST(CaribouTopology, TriangleQuadratic2DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}, {"template", "Vec2d"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -881,7 +871,7 @@ TEST(CaribouTopology, TriangleLinear3DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -1009,7 +999,7 @@ TEST(CaribouTopology, TriangleQuadratic3DFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -1137,7 +1127,7 @@ TEST(CaribouTopology, TetrahedronLinearFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -1268,7 +1258,7 @@ TEST(CaribouTopology, TetrahedronQuadraticFromIndices) { auto root = getSimulation()->createNewNode("root"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -1403,7 +1393,7 @@ TEST(CaribouTopology, HexahedronLinearFromIndices) { createObject(root, "DefaultVisualManagerLoop"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); @@ -1536,7 +1526,7 @@ TEST(CaribouTopology, HexahedronQuadraticFromIndices) { createObject(root, "DefaultVisualManagerLoop"); // Add a mechanical object required for the creation of an internal mesh - auto mo = dynamic_cast *>( + auto mo = dynamic_cast *>( createObject(root, "MechanicalObject", {{"name", "mo"}}).get() ); mo->resize(mesh.number_of_nodes()); diff --git a/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp b/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp index 10070428..1aa53de2 100644 --- a/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp +++ b/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp @@ -2,14 +2,10 @@ #include DISABLE_ALL_WARNINGS_BEGIN -#if (defined(SOFA_VERSION) && SOFA_VERSION < 211200) -#include -#else #include -#endif #include -#include -#include +#include +#include #include DISABLE_ALL_WARNINGS_END @@ -18,20 +14,13 @@ DISABLE_ALL_WARNINGS_END using sofa::helper::system::PluginManager ; using namespace sofa::simulation; using namespace sofa::simpleapi; - -#if (defined(SOFA_VERSION) && SOFA_VERSION < 210600) -using namespace sofa::helper::testing; -#else using namespace sofa::testing; -#endif class FictitiousGrid : public BaseTest { void SetUp() override { setSimulation(new sofa::simulation::graph::DAGSimulation()) ; root = getSimulation()->createNewNode("root"); -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) createObject(root, "RequiredPlugin", {{"pluginName", "SofaGeneralLoader"}}); -#endif createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); } diff --git a/unittest/SofaCaribou/main.cpp b/unittest/SofaCaribou/main.cpp index 7feff4d3..cd499b3a 100644 --- a/unittest/SofaCaribou/main.cpp +++ b/unittest/SofaCaribou/main.cpp @@ -11,19 +11,9 @@ namespace fs = ::std::filesystem; #include DISABLE_ALL_WARNINGS_BEGIN -#include -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 220600) #include -#else -#include -#endif -#if (defined(SOFA_VERSION) && SOFA_VERSION >= 201200) -#include -#include -#else -#include -#include -#endif +#include +#include DISABLE_ALL_WARNINGS_END #include "sofacaribou_test.h" @@ -42,8 +32,8 @@ int main(int argc, char **argv) { sofa::component::initSofaBaseMechanics(); sofa::component::initSofaBaseUtils(); #else - sofa::component::initBaseMechanics(); - sofa::component::initBaseUtils(); + sofa::component::mass::init(); + sofa::component::statecontainer::init(); #endif int ret = RUN_ALL_TESTS(); From bcb46dbc7ebd33d5a3665ab4c91c2147ff468271 Mon Sep 17 00:00:00 2001 From: Jean-Nicolas Brunet Date: Tue, 9 May 2023 23:05:01 -0400 Subject: [PATCH 2/5] Remove CI for older SOFA version --- .github/workflows/macos.yml | 30 +--------------------------- .github/workflows/ubuntu.yml | 38 +++--------------------------------- 2 files changed, 4 insertions(+), 64 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index c8040e7f..b11b2ca2 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - sofa_version: [ v20.06.01, v20.12.03, v21.06.03, v21.12.00, master ] + sofa_version: [ master ] include: - sofa_version: master SOFA_VERSION_I: 999999 @@ -24,34 +24,6 @@ jobs: BOOST_VERSION: 1.76.0 BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz QT_VERSION: 5.12.6 - - sofa_version: v21.12.00 - SOFA_VERSION_I: 211200 - PYTHON_VERSION: 3.9 - PYBIND11_VERSION: 2.6 - BOOST_VERSION: 1.76.0 - BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz - QT_VERSION: 5.12.6 - - sofa_version: v21.06.03 - SOFA_VERSION_I: 210603 - PYTHON_VERSION: 3.9 - PYBIND11_VERSION: 2.6 - BOOST_VERSION: 1.76.0 - BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz - QT_VERSION: 5.12.6 - - sofa_version: v20.12.03 - SOFA_VERSION_I: 201203 - PYTHON_VERSION: 3.7 - PYBIND11_VERSION: 2.6 - BOOST_VERSION: 1.67.0 - BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.67.0/source/boost_1_67_0.tar.gz - QT_VERSION: 5.12.6 - - sofa_version: v20.06.01 - SOFA_VERSION_I: 200601 - PYTHON_VERSION: 2.7 - PYBIND11_VERSION: 2.6 - BOOST_VERSION: 1.67.0 - BOOST_LINK: https://boostorg.jfrog.io/artifactory/main/release/1.67.0/source/boost_1_67_0.tar.gz - QT_VERSION: 5.11.1 env: SOFA_VERSION: ${{ matrix.sofa_version }} SOFA_ROOT: /opt/sofa diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 978c7fef..87ab0ed8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -16,33 +16,13 @@ jobs: strategy: fail-fast: false matrix: - sofa_version: [ v20.06.01, v20.12.03, v21.06.03, v21.12.00, master ] + sofa_version: [ master ] include: - sofa_version: master SOFA_VERSION_I: 999999 CONTAINER: jnbrunet/caribou-ubuntu-2004-builder:latest PYTHON_VERSION: 3.8 PYBIND11_VERSION: 2.6 - - sofa_version: v21.12.00 - SOFA_VERSION_I: 211200 - CONTAINER: jnbrunet/caribou-ubuntu-2004-builder:latest - PYTHON_VERSION: 3.8 - PYBIND11_VERSION: 2.4 - - sofa_version: v21.06.03 - SOFA_VERSION_I: 210603 - CONTAINER: jnbrunet/caribou-ubuntu-1804-builder:latest - PYTHON_VERSION: 3.7 - PYBIND11_VERSION: 2.4 - - sofa_version: v20.12.03 - SOFA_VERSION_I: 201203 - CONTAINER: jnbrunet/caribou-ubuntu-1804-builder:latest - PYTHON_VERSION: 3.7 - PYBIND11_VERSION: 2.4 - - sofa_version: v20.06.01 - SOFA_VERSION_I: 200601 - CONTAINER: jnbrunet/caribou-ubuntu-1804-builder:latest - PYTHON_VERSION: 3.7 - PYBIND11_VERSION: 2.4 env: SOFA_VERSION: ${{ matrix.sofa_version }} SOFA_ROOT: /opt/sofa @@ -136,23 +116,11 @@ jobs: strategy: fail-fast: false matrix: - sofa_version: [ v20.06.01, v20.12.03, v21.06.03, v21.12.00, master ] + sofa_version: [ master ] include: - sofa_version: master PYTHON_VERSION: 3.8 sofa_version_int: 211200 - - sofa_version: v21.12.00 - PYTHON_VERSION: 3.8 - sofa_version_int: 211200 - - sofa_version: v21.06.03 - PYTHON_VERSION: 3.7 - sofa_version_int: 210603 - - sofa_version: v20.12.03 - PYTHON_VERSION: 3.7 - sofa_version_int: 201203 - - sofa_version: v20.06.01 - PYTHON_VERSION: 3.7 - sofa_version_int: 200601 env: SOFA_VERSION: ${{ matrix.sofa_version }} SOFA_ROOT: /opt/sofa @@ -249,7 +217,7 @@ jobs: if: github.event_name == 'schedule' strategy: matrix: - sofa_version: [ v20.06.01, v20.12.03, v21.06.03, v21.12.00, master ] + sofa_version: [ master ] env: SOFA_VERSION: ${{ matrix.sofa_version }} From b18a4150dc80f1762bf858345b504fecd404c913 Mon Sep 17 00:00:00 2001 From: Jean-Nicolas Brunet Date: Wed, 10 May 2023 20:43:01 -0400 Subject: [PATCH 3/5] Compatibility with SOFA 23.06 (scene files) --- scenes/CG_solver.py | 21 ++++++++++++------- scenes/HexahedronLinearElasticForce.py | 16 ++++++++++---- scenes/HyperelasticForcefield.py | 17 ++++++++++++--- scenes/LDLT_solver.py | 17 +++++++++------ scenes/LLT_solver.py | 17 +++++++++------ scenes/LU_solver.py | 17 +++++++++------ scenes/TetrahedronLinearElasticForce.py | 17 +++++++++++---- scenes/TractionForcefield.py | 16 ++++++++++---- scenes/backward_euler.py | 12 +++++++++-- scenes/barycentric_mappings.py | 14 ++++++++++--- scenes/caribou_mass.py | 12 ++++++++++- scenes/fictitious_grid_2d.py | 7 ++++++- scenes/fictitious_grid_3d.py | 7 +++++-- scenes/multiple_materials.py | 14 ++++++------- scenes/quadratic_elements.py | 12 +++++++++-- .../CaribouForcefield[Triangle6].cpp | 2 +- .../CaribouForcefield[Triangle].cpp | 4 ++-- .../test_hyperelasticforcefield.cpp | 5 +++-- .../SofaCaribou/Mass/test_cariboumass.cpp | 6 ++++-- .../SofaCaribou/ODE/test_backward_euler.cpp | 4 ++-- unittest/SofaCaribou/ODE/test_static.cpp | 7 +++---- .../Topology/test_fictitiousgrid.cpp | 2 +- 22 files changed, 173 insertions(+), 73 deletions(-) diff --git a/scenes/CG_solver.py b/scenes/CG_solver.py index d1be1388..9511a9f4 100644 --- a/scenes/CG_solver.py +++ b/scenes/CG_solver.py @@ -10,16 +10,21 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') - root.addObject('RequiredPlugin', name='SofaSparseSolver') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.LinearSolver.Iterative', # CGLinearSolver + 'Sofa.Component.ODESolver.Backward', # StaticSolver + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual' # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') - root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[3, 3, 7]) - # Caribou ODE solver - Caribou CG solver - No preconditioner i = 0 tx = 20*i diff --git a/scenes/HexahedronLinearElasticForce.py b/scenes/HexahedronLinearElasticForce.py index 90fa7189..83d3e9ab 100644 --- a/scenes/HexahedronLinearElasticForce.py +++ b/scenes/HexahedronLinearElasticForce.py @@ -20,11 +20,19 @@ l = youngModulus * poissonRatio / ((1.0 + poissonRatio) * (1.0 - 2.0 * poissonRatio)) def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.SolidMechanics.FEM.Elastic', # HexahedronFEMForceField + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') + root.addObject('DefaultAnimationLoop') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/HyperelasticForcefield.py b/scenes/HyperelasticForcefield.py index 14dc2333..074ed8fe 100644 --- a/scenes/HyperelasticForcefield.py +++ b/scenes/HyperelasticForcefield.py @@ -21,11 +21,22 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.SolidMechanics.FEM.Elastic', # HexahedronFEMForceField + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.SolidMechanics.FEM.HyperElastic', # TetrahedronHyperelasticityFEMForceField, QuadSetTopologyContainer + 'Sofa.Component.Topology.Mapping', # Hexa2TetraTopologicalMapping + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') + root.addObject('DefaultAnimationLoop') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/LDLT_solver.py b/scenes/LDLT_solver.py index be01faeb..479b50af 100644 --- a/scenes/LDLT_solver.py +++ b/scenes/LDLT_solver.py @@ -9,12 +9,17 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') - root.addObject('RequiredPlugin', name='SofaSparseSolver') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/LLT_solver.py b/scenes/LLT_solver.py index 920fa900..1da062f6 100644 --- a/scenes/LLT_solver.py +++ b/scenes/LLT_solver.py @@ -8,12 +8,17 @@ youngModulus = 3000 def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') - root.addObject('RequiredPlugin', name='SofaSparseSolver') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/LU_solver.py b/scenes/LU_solver.py index 7a24dd65..f7644788 100644 --- a/scenes/LU_solver.py +++ b/scenes/LU_solver.py @@ -8,12 +8,17 @@ youngModulus = 3000 def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') - root.addObject('RequiredPlugin', name='SofaSparseSolver') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/TetrahedronLinearElasticForce.py b/scenes/TetrahedronLinearElasticForce.py index b0b24789..c165a812 100644 --- a/scenes/TetrahedronLinearElasticForce.py +++ b/scenes/TetrahedronLinearElasticForce.py @@ -20,10 +20,19 @@ l = youngModulus * poissonRatio / ((1.0 + poissonRatio) * (1.0 - 2.0 * poissonRatio)) def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.SolidMechanics.FEM.Elastic', # TetrahedronFEMForceField + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # TetrahedronSetTopologyContainer, TetrahedronSetTopologyModifier, TriangleSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Topology.Mapping', # Hexa2TetraTopologicalMapping + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/TractionForcefield.py b/scenes/TractionForcefield.py index 8fa4775e..89c43c94 100644 --- a/scenes/TractionForcefield.py +++ b/scenes/TractionForcefield.py @@ -19,10 +19,18 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - - root.addObject('RequiredPlugin', name='SofaComponentAll') - root.addObject('RequiredPlugin', name='SofaOpenglVisual') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetTopologyContainer, QuadSetTopologyContainer, TetrahedronSetTopologyContainer, TetrahedronSetTopologyModifier, TriangleSetTopologyContainer + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Topology.Mapping', # Hexa2TetraTopologicalMapping + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('RegularGridTopology', name='mesh', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/backward_euler.py b/scenes/backward_euler.py index da3f052c..c665d9dd 100644 --- a/scenes/backward_euler.py +++ b/scenes/backward_euler.py @@ -7,9 +7,17 @@ def createScene(root): root.dt = 1 root.addObject('RequiredPlugin', pluginName=[ - 'SofaSparseSolver', 'SofaTopologyMapping', 'SofaBoundaryCondition', 'SofaEngine', 'SofaImplicitOdeSolver' + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.Topology.Container.Dynamic', # HexahedronSetGeometryAlgorithms, HexahedronSetTopologyContainer + 'Sofa.Component.Mass', # DiagonalMass + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual' # VisualStyle ]) - + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showForceFields') root.addObject('RegularGridTopology', name='grid', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[3, 3, 9]) diff --git a/scenes/barycentric_mappings.py b/scenes/barycentric_mappings.py index 7b91059f..dd99caf4 100644 --- a/scenes/barycentric_mappings.py +++ b/scenes/barycentric_mappings.py @@ -32,12 +32,20 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - root.addObject('RequiredPlugin', pluginName='SofaBoundaryCondition SofaEngine SofaOpenglVisual SofaGeneralVisual') + + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Visual' # Visual3DText, VisualStyle + # 'Sofa.GL.Component.Rendering3D' # OglModel + ]) + root.addObject('APIVersion', level='23.06.99') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels') root.addObject('StaticODESolver', newton_iterations=10, residual_tolerance_threshold=1e-5, pattern_analysis_strategy="BEGINNING_OF_THE_TIME_STEP") - root.addObject('LDLTSolver', backend="Pardiso") + root.addObject('LDLTSolver', backend="Eigen") # Change to backend="Pardiso" if using Caribou with pardiso for name, mesh, p, caribou_type, meshio_type in meshes: n = root.addChild(name) diff --git a/scenes/caribou_mass.py b/scenes/caribou_mass.py index d642420a..c15a68dc 100644 --- a/scenes/caribou_mass.py +++ b/scenes/caribou_mass.py @@ -13,9 +13,19 @@ def createScene(root): root.dt = 0.001 + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.ODESolver.Forward', # CentralDifferenceSolver + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual' # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showForceFields') - root.addObject('RequiredPlugin', pluginName=['SofaBaseMechanics', 'SofaEngine', 'SofaTopologyMapping', 'SofaBoundaryCondition', 'SofaGeneralExplicitOdeSolver']) root.addObject('RegularGridTopology', name='grid', min=[-length/2, -radius, -radius], max=[length/2, radius, radius], n=[nz, nx, nx]) + root.addObject('DefaultAnimationLoop') # Caribou lumped mass root.addChild('caribou_lumped') diff --git a/scenes/fictitious_grid_2d.py b/scenes/fictitious_grid_2d.py index 1344defb..3f3afae3 100644 --- a/scenes/fictitious_grid_2d.py +++ b/scenes/fictitious_grid_2d.py @@ -18,7 +18,12 @@ def createScene(root): root.bbox = " ".join([str(a) for a in [-radius, -radius, -1, radius, radius, 1]]) - root.addObject('APIVersion', level='21.06') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Visual', # InteractiveCamera + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('InteractiveCamera', position=[0, 0, 1], lookAt=[0, 0, 0], projectionType=1, printLog=True) root.addObject('CircleIsoSurface', radius=radius, center=[0, 0]) diff --git a/scenes/fictitious_grid_3d.py b/scenes/fictitious_grid_3d.py index e7b4ef7b..0bd659d3 100644 --- a/scenes/fictitious_grid_3d.py +++ b/scenes/fictitious_grid_3d.py @@ -12,8 +12,11 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('SphereIsoSurface', radius=radius, center=[0, 0, 0]) root.addObject('FictitiousGrid', diff --git a/scenes/multiple_materials.py b/scenes/multiple_materials.py index 580bf155..67066294 100644 --- a/scenes/multiple_materials.py +++ b/scenes/multiple_materials.py @@ -4,14 +4,14 @@ def createScene(root): - root.addObject('APIVersion', level='17.06') - - root.addObject('RequiredPlugin', name='SofaOpenglVisual') - root.addObject('RequiredPlugin', name='SofaSparseSolver') - root.addObject('RequiredPlugin', name='SofaBoundaryCondition') - root.addObject('RequiredPlugin', name='SofaEngine') - + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Topology.Container.Grid', # RegularGridTopology + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showForceFields') + root.addObject('DefaultAnimationLoop') root.addObject('RegularGridTopology', name='grid', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21]) diff --git a/scenes/quadratic_elements.py b/scenes/quadratic_elements.py index 2e263625..7c07df6a 100644 --- a/scenes/quadratic_elements.py +++ b/scenes/quadratic_elements.py @@ -17,8 +17,16 @@ def createScene(root): - root.addObject('APIVersion', level='21.06') - root.addObject('RequiredPlugin', pluginName='SofaBoundaryCondition SofaEngine') + root.addObject('RequiredPlugin', pluginName=[ + 'Sofa.Component.SceneUtility', # APIVersion + 'Sofa.Component.Constraint.Projective', # FixedConstraint + 'Sofa.Component.Engine.Select', # BoxROI + 'Sofa.Component.Mass', # UniformMass + 'Sofa.Component.StateContainer', # MechanicalObject + 'Sofa.Component.Visual', # VisualStyle + ]) + root.addObject('APIVersion', level='23.06.99') + root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels showCollisionModels hideMappings showForceFields') root.addObject('BackwardEulerODESolver', newton_iterations=10, rayleigh_stiffness=0, rayleigh_mass=0, residual_tolerance_threshold=1e-5, pattern_analysis_strategy="ALWAYS", printLog=True) diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp index 02a48bec..c4250df8 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle6].cpp @@ -25,7 +25,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Triangle6<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Triangle6<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle = std::vector {e.node(0), e.node(1), e.node(2)}; for (const auto &n : triangle) { triangles_nodes.emplace_back(n[0], n[1], 0); diff --git a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].cpp b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].cpp index b4687e37..8355edfc 100644 --- a/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].cpp +++ b/src/SofaCaribou/Forcefield/CaribouForcefield[Triangle].cpp @@ -25,7 +25,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Triangle<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Triangle<_2D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle = std::vector {e.node(0), e.node(1), e.node(2)}; for (const auto &n : triangle) { triangles_nodes.emplace_back(n[0], n[1], 0); @@ -43,7 +43,7 @@ auto CaribouForcefield>::templateName(const CaribouForcefield -void CaribouForcefield>::triangulate_face(const Triangle<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { +void CaribouForcefield>::triangulate_face(const Triangle<_3D> & e, const std::size_t & /*face_id*/, std::vector & triangles_nodes) { auto triangle = std::vector {e.node(0), e.node(1), e.node(2)}; for (const auto &n : triangle) { triangles_nodes.emplace_back(n[0], n[1], n[2]); diff --git a/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp b/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp index fa4d2408..525b6149 100644 --- a/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp +++ b/unittest/SofaCaribou/Forcefield/test_hyperelasticforcefield.cpp @@ -26,8 +26,9 @@ TEST(HyperelasticForcefield, Hexahedron_from_SOFA) { auto root = getSimulation()->createNewNode("root"); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Constraint.Projective"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Engine.Select"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Topology.Container.Grid"}}); createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); auto meca = createChild(root, "meca"); diff --git a/unittest/SofaCaribou/Mass/test_cariboumass.cpp b/unittest/SofaCaribou/Mass/test_cariboumass.cpp index 2aedf6f8..2c11b0bc 100644 --- a/unittest/SofaCaribou/Mass/test_cariboumass.cpp +++ b/unittest/SofaCaribou/Mass/test_cariboumass.cpp @@ -31,7 +31,8 @@ TEST(CaribouMass, LinearTetrahedron) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine SofaTopologyMapping"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Engine.Select"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Topology.Mapping"}}); // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); @@ -138,7 +139,8 @@ TEST(CaribouMass, LinearHexahedron) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine SofaTopologyMapping"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Engine.Select"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Topology.Mapping"}}); // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); diff --git a/unittest/SofaCaribou/ODE/test_backward_euler.cpp b/unittest/SofaCaribou/ODE/test_backward_euler.cpp index 855e90d1..5cfbf249 100644 --- a/unittest/SofaCaribou/ODE/test_backward_euler.cpp +++ b/unittest/SofaCaribou/ODE/test_backward_euler.cpp @@ -23,8 +23,8 @@ TEST(BackwardEulerODESolver, Beam) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Constraint.Projective"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Engine.Select"}}); // Some component to avoid warnings createObject(root, "DefaultAnimationLoop"); diff --git a/unittest/SofaCaribou/ODE/test_static.cpp b/unittest/SofaCaribou/ODE/test_static.cpp index 6ca14956..c05499cc 100644 --- a/unittest/SofaCaribou/ODE/test_static.cpp +++ b/unittest/SofaCaribou/ODE/test_static.cpp @@ -37,7 +37,7 @@ TEST(StaticODESolver, InitSofaSolver) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBaseLinearSolver"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.LinearSolver.Iterative"}}); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); createObject(root, "StaticODESolver", {{"printLog", "true"}}); @@ -55,7 +55,7 @@ TEST(StaticODESolver, InitCaribouSolver) { setSimulation(new sofa::simulation::graph::DAGSimulation()); auto root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBaseLinearSolver"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.LinearSolver.Iterative"}}); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); createObject(root, "StaticODESolver", {{"printLog", "true"}}); @@ -91,8 +91,7 @@ TEST(StaticODESolver, Beam) { auto root = getSimulation()->createNewNode("root"); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaBoundaryCondition SofaEngine"}}); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaTopologyMapping"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.Engine.Select"}}); createObject(root, "RegularGridTopology", {{"name", "grid"}, {"min", "-7.5 -7.5 0"}, {"max", "7.5 7.5 80"}, {"n", "3 3 9"}}); auto meca = createChild(root, "meca"); diff --git a/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp b/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp index 1aa53de2..0585e12d 100644 --- a/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp +++ b/unittest/SofaCaribou/Topology/test_fictitiousgrid.cpp @@ -20,7 +20,7 @@ class FictitiousGrid : public BaseTest { void SetUp() override { setSimulation(new sofa::simulation::graph::DAGSimulation()) ; root = getSimulation()->createNewNode("root"); - createObject(root, "RequiredPlugin", {{"pluginName", "SofaGeneralLoader"}}); + createObject(root, "RequiredPlugin", {{"pluginName", "Sofa.Component.IO.Mesh"}}); createObject(root, "DefaultAnimationLoop"); createObject(root, "DefaultVisualManagerLoop"); } From 06e736aadedfd5f8d0332acc0dba1faa3ec1a25b Mon Sep 17 00:00:00 2001 From: Jean-Nicolas Brunet Date: Wed, 10 May 2023 21:03:36 -0400 Subject: [PATCH 4/5] Update CI to macos-12 --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b11b2ca2..e37244e3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -11,7 +11,7 @@ on: jobs: build: name: Building with ${{ matrix.sofa_version }} - runs-on: macos-10.15 + runs-on: macos-12 strategy: fail-fast: false matrix: From fbeeba9bf3cb14546c64556e96468e13dbad03f6 Mon Sep 17 00:00:00 2001 From: Jean-Nicolas Brunet Date: Wed, 10 May 2023 21:38:19 -0400 Subject: [PATCH 5/5] Deactivate macos workflow until we fix the build --- .github/workflows/macos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e37244e3..1ff9c1eb 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -12,6 +12,7 @@ jobs: build: name: Building with ${{ matrix.sofa_version }} runs-on: macos-12 + if: ${{ false }} strategy: fail-fast: false matrix: