diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp index cb098c39..d2861715 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseContext.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -55,8 +56,8 @@ void moduleAddBaseContext(py::module& m) { c.def("getState", &BaseContext::getState, "Mechanical Degrees-of-Freedom"); c.def("getMechanicalState", &BaseContext::getMechanicalState, "Mechanical Degrees-of-Freedom"); c.def("getTopology", &BaseContext::getTopology, "Topology"); - c.def("getMeshTopology", &BaseContext::getMeshTopology, "Mesh Topology (unified interface for both static and dynamic topologies)"); - c.def("getMeshTopologyLink", &BaseContext::getMeshTopologyLink, "Mesh Topology (unified interface for both static and dynamic topologies)"); + c.def("getMeshTopology", &BaseContext::getMeshTopology, py::arg("SearchDirection") = BaseContext::SearchDirection::SearchUp, "Mesh Topology (unified interface for both static and dynamic topologies)"); + c.def("getMeshTopologyLink", &BaseContext::getMeshTopologyLink, py::arg("SearchDirection") = BaseContext::SearchDirection::SearchUp, "Mesh Topology (unified interface for both static and dynamic topologies)"); c.def("getMass", &BaseContext::getMass, "Mass"); c.def("__str__", [](const BaseContext & context) {std::ostringstream s; s << context; return s.str();}, "Get a string representation of the context."); diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp new file mode 100644 index 00000000..a291ca68 --- /dev/null +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2021 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Contact information: contact@sofa-framework.org * +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace py { using namespace pybind11; } + +using namespace sofa::core::objectmodel; +using namespace sofa::core::topology; + +namespace sofapython3 { + +void moduleAddBaseMeshTopology(py::module& m) { + py::class_> c (m, "BaseMeshTopology"); +} + +} // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.h new file mode 100644 index 00000000..db28451e --- /dev/null +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseMeshTopology.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2021 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Contact information: contact@sofa-framework.org * +******************************************************************************/ + +#pragma once + +#include + +namespace sofapython3 { + +void moduleAddBaseMeshTopology(pybind11::module &m); + +} // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.cpp new file mode 100644 index 00000000..984d7932 --- /dev/null +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2021 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Contact information: contact@sofa-framework.org * +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace py { using namespace pybind11; } + +using namespace sofa::core::objectmodel; +using namespace sofa::core::topology; + +namespace sofapython3 { + +void moduleAddTopology(py::module& m) { + py::class_> c (m, "Topology"); +} + +} // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.h new file mode 100644 index 00000000..5f89f0e1 --- /dev/null +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2021 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Contact information: contact@sofa-framework.org * +******************************************************************************/ + +#pragma once + +#include + +namespace sofapython3 { + +void moduleAddTopology(pybind11::module &m); + +} // namespace sofapython3 diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt b/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt index 09d1c956..14b41b24 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt @@ -38,6 +38,8 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseLink_doc.h ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseData_doc.h ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseCamera_doc.h + ${CMAKE_CURRENT_SOURCE_DIR}/Binding_Topology.h + ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseMeshTopology.h ) set(SOURCE_FILES @@ -63,6 +65,8 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Submodule_Core.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Binding_PythonScriptEvent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseLink.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Binding_Topology.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Binding_BaseMeshTopology.cpp ) if (NOT TARGET SofaPython3::Plugin) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp index 5a5ba2b7..2e8d6bac 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Submodule_Core.cpp @@ -39,6 +39,8 @@ using sofa::helper::logging::Message; #include #include #include +#include +#include #include #include @@ -134,6 +136,8 @@ PYBIND11_MODULE(Core, core) moduleAddNodeIterator(core); moduleAddPrefab(core); moduleAddBaseLink(core); + moduleAddTopology(core); + moduleAddBaseMeshTopology(core); } } ///namespace sofapython3