diff --git a/kratos/python/add_cfd_variables_to_python.cpp b/kratos/python/add_cfd_variables_to_python.cpp index 9e18bd902163..a7577b466690 100644 --- a/kratos/python/add_cfd_variables_to_python.cpp +++ b/kratos/python/add_cfd_variables_to_python.cpp @@ -4,30 +4,23 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Pooyan Dadvand // Riccardo Rossi // - - // System includes // External includes - // Project includes #include "includes/define_python.h" #include "includes/cfd_variables.h" #include "python/add_cfd_variables_to_python.h" -namespace Kratos -{ -//KRATOS_CREATE_FLAG(STRUCTURE, 63); - -namespace Python +namespace Kratos::Python { namespace py = pybind11; @@ -63,6 +56,5 @@ namespace Python KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, CROSS_WIND_STABILIZATION_FACTOR ); } -} // namespace Python. -} // Namespace Kratos +} // namespace Kratos::Python. diff --git a/kratos/python/add_communicator_to_python.cpp b/kratos/python/add_communicator_to_python.cpp index 0f14140bc5ab..9791e3504602 100644 --- a/kratos/python/add_communicator_to_python.cpp +++ b/kratos/python/add_communicator_to_python.cpp @@ -19,43 +19,8 @@ #include "add_communicator_to_python.h" #include "includes/communicator.h" -namespace Kratos { -namespace Python { - -Communicator::MeshType& CommunicatorGetLocalMesh(Communicator& rCommunicator) -{ - return rCommunicator.LocalMesh(); -} - -Communicator::MeshType& CommunicatorGetLocalMeshWithIndex(Communicator& rCommunicator, Communicator::IndexType Index) -{ - return rCommunicator.LocalMesh(Index); -} - -Communicator::MeshType& CommunicatorGetGhostMesh(Communicator& rCommunicator) -{ - return rCommunicator.GhostMesh(); -} - -Communicator::MeshType& CommunicatorGetGhostMeshWithIndex(Communicator& rCommunicator, Communicator::IndexType Index) +namespace Kratos::Python { - return rCommunicator.GhostMesh(Index); -} - -Communicator::MeshType& CommunicatorGetInterfaceMesh(Communicator& rCommunicator) -{ - return rCommunicator.InterfaceMesh(); -} - -Communicator::MeshType& CommunicatorGetInterfaceMeshWithIndex(Communicator& rCommunicator, Communicator::IndexType Index) -{ - return rCommunicator.InterfaceMesh(Index); -} - -Communicator::NeighbourIndicesContainerType const& NeighbourIndicesConst(Communicator& rCommunicator) -{ - return rCommunicator.NeighbourIndices(); -} template bool CommunicatorSynchronizeVariable(Communicator& rCommunicator, Variable const& ThisVariable) @@ -94,18 +59,18 @@ void AddCommunicatorToPython(pybind11::module &m) .def("GlobalNumberOfConditions", &Communicator::GlobalNumberOfConditions) .def("GlobalNumberOfMasterSlaveConstraints", &Communicator::GlobalNumberOfMasterSlaveConstraints) .def("GetNumberOfColors", &Communicator::GetNumberOfColors) - .def("NeighbourIndices", NeighbourIndicesConst, py::return_value_policy::reference_internal) + .def("NeighbourIndices", py::overload_cast<>(&Communicator::NeighbourIndices), py::return_value_policy::reference_internal) .def("SynchronizeNodalSolutionStepsData", &Communicator::SynchronizeNodalSolutionStepsData) .def("SynchronizeNodalFlags", &Communicator::SynchronizeNodalFlags) .def("SynchronizeOrNodalFlags", &Communicator::SynchronizeOrNodalFlags) .def("SynchronizeAndNodalFlags", &Communicator::SynchronizeAndNodalFlags) .def("SynchronizeDofs", &Communicator::SynchronizeDofs) - .def("LocalMesh", CommunicatorGetLocalMesh, py::return_value_policy::reference_internal ) - .def("LocalMesh", CommunicatorGetLocalMeshWithIndex, py::return_value_policy::reference_internal ) - .def("GhostMesh", CommunicatorGetGhostMesh, py::return_value_policy::reference_internal ) - .def("GhostMesh", CommunicatorGetGhostMeshWithIndex, py::return_value_policy::reference_internal ) - .def("InterfaceMesh", CommunicatorGetInterfaceMesh, py::return_value_policy::reference_internal ) - .def("InterfaceMesh", CommunicatorGetInterfaceMeshWithIndex, py::return_value_policy::reference_internal ) + .def("LocalMesh", py::overload_cast<>(&Communicator::LocalMesh), py::return_value_policy::reference_internal) + .def("LocalMesh", py::overload_cast(&Communicator::LocalMesh), py::return_value_policy::reference_internal) + .def("GhostMesh", py::overload_cast<>(&Communicator::GhostMesh), py::return_value_policy::reference_internal) + .def("GhostMesh", py::overload_cast(&Communicator::GhostMesh), py::return_value_policy::reference_internal) + .def("InterfaceMesh", py::overload_cast<>(&Communicator::InterfaceMesh), py::return_value_policy::reference_internal) + .def("InterfaceMesh", py::overload_cast(&Communicator::InterfaceMesh), py::return_value_policy::reference_internal) .def("GetDataCommunicator", &Communicator::GetDataCommunicator, py::return_value_policy::reference_internal ) .def("SynchronizeVariable", CommunicatorSynchronizeVariable ) .def("SynchronizeVariable", CommunicatorSynchronizeVariable ) @@ -131,5 +96,4 @@ void AddCommunicatorToPython(pybind11::module &m) ; } -} // namespace Python. -} // Namespace Kratos +} // namespace Kratos::Python.