Skip to content

Commit

Permalink
Merge pull request #11585 from KratosMultiphysics/core/some-pythpn-cl…
Browse files Browse the repository at this point in the history
…ean-up-II
  • Loading branch information
loumalouomega authored Sep 21, 2023
2 parents 23364c2 + 4d2ad9c commit 1125a16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 57 deletions.
16 changes: 4 additions & 12 deletions kratos/python/add_cfd_variables_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -63,6 +56,5 @@ namespace Python
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, CROSS_WIND_STABILIZATION_FACTOR );

}
} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.

54 changes: 9 additions & 45 deletions kratos/python/add_communicator_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<class TDataType>
bool CommunicatorSynchronizeVariable(Communicator& rCommunicator, Variable<TDataType> const& ThisVariable)
Expand Down Expand Up @@ -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::IndexType>(&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::IndexType>(&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::IndexType>(&Communicator::InterfaceMesh), py::return_value_policy::reference_internal)
.def("GetDataCommunicator", &Communicator::GetDataCommunicator, py::return_value_policy::reference_internal )
.def("SynchronizeVariable", CommunicatorSynchronizeVariable<int> )
.def("SynchronizeVariable", CommunicatorSynchronizeVariable<double> )
Expand All @@ -131,5 +96,4 @@ void AddCommunicatorToPython(pybind11::module &m)
;
}

} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.

0 comments on commit 1125a16

Please sign in to comment.