From 32d5e2960ebb030afe8074203c576fdf0f6916c2 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 27 Dec 2023 16:15:36 +0100 Subject: [PATCH] [Topology.Mapping] Edge2QuadTopologicalMapping: use States directly (#4388) * use directly states for edge2quad * apply to example scene * clean/format includes --- .../mapping/Edge2QuadTopologicalMapping.cpp | 23 ++++++------------- .../mapping/Edge2QuadTopologicalMapping.h | 12 +++------- .../Mapping/Edge2QuadTopologicalMapping.scn | 6 +---- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp index 1ed5049c5cb..2f5bcfe4a2a 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp @@ -20,25 +20,16 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include #include - -#include -#include - #include -#include -#include #include - -#include - -#include - #include +#include +#include + namespace sofa::component::topology::mapping { @@ -112,8 +103,8 @@ void Edge2QuadTopologicalMapping::init() // INITIALISATION of QUADULAR mesh from EDGE mesh : - const core::behavior::MechanicalState* from_mstate = dynamic_cast*>(fromModel->getContext()->getMechanicalState()); - core::behavior::MechanicalState* to_mstate = dynamic_cast*>(toModel->getContext()->getMechanicalState()); + const core::State* from_mstate = dynamic_cast*>(fromModel->getContext()->getState()); + core::State* to_mstate = dynamic_cast*>(toModel->getContext()->getState()); if (fromModel) { @@ -299,8 +290,8 @@ void Edge2QuadTopologicalMapping::init() } else { - // Check type Rigid3 of input mechanical object (required) - msg_error() << "Mechanical object associated with the input is not of type Rigid. Edge2QuadTopologicalMapping only supports Rigid3Types to Vec3Types"; + // Check type Rigid3 of input state object (required) + msg_error() << "State object associated with the input is not of type Rigid. Edge2QuadTopologicalMapping only supports Rigid3Types to Vec3Types"; d_componentState.setValue(sofa::core::objectmodel::ComponentState::Invalid); } } diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.h b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.h index 7d85f56a145..cf838710074 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.h +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.h @@ -22,14 +22,11 @@ #pragma once #include -#include #include -#include -#include +#include +#include -#include -#include namespace sofa::component::topology::container::dynamic @@ -54,10 +51,7 @@ class SOFA_COMPONENT_TOPOLOGY_MAPPING_API Edge2QuadTopologicalMapping : public s { public: SOFA_CLASS(Edge2QuadTopologicalMapping,sofa::core::topology::TopologicalMapping); - - using RigidCoord = sofa::core::State::Coord; - using Vec3Coord = sofa::core::State::Coord; - + using Index = sofa::core::topology::BaseMeshTopology::Index; using Edge = sofa::core::topology::BaseMeshTopology::Edge; using Quad = sofa::core::topology::BaseMeshTopology::Quad; diff --git a/examples/Component/Topology/Mapping/Edge2QuadTopologicalMapping.scn b/examples/Component/Topology/Mapping/Edge2QuadTopologicalMapping.scn index 0c855327e74..d118ca24937 100644 --- a/examples/Component/Topology/Mapping/Edge2QuadTopologicalMapping.scn +++ b/examples/Component/Topology/Mapping/Edge2QuadTopologicalMapping.scn @@ -36,17 +36,13 @@ - + - - - -