Skip to content

Commit

Permalink
Merge pull request #11586 from KratosMultiphysics/core/some-pythpn-cl…
Browse files Browse the repository at this point in the history
…ean-up-III
  • Loading branch information
loumalouomega authored Sep 22, 2023
2 parents 13b795a + fa29a57 commit 88e74b0
Show file tree
Hide file tree
Showing 28 changed files with 133 additions and 252 deletions.
4 changes: 0 additions & 4 deletions kratos/python/add_constitutive_law_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// Riccardo Rossi
//



// System includes

// External includes
Expand All @@ -26,7 +24,6 @@

#include "containers/variable.h"


namespace Kratos::Python
{
namespace py = pybind11;
Expand Down Expand Up @@ -81,7 +78,6 @@ ConstitutiveLaw::DeformationGradientMatrixType& GetDeformationGradientF2(Constit
ConstitutiveLaw::Pointer CreateWithoutProperties(ConstitutiveLaw& rThisConstitutiveLaw, Kratos::Parameters NewParameters){ return rThisConstitutiveLaw.Create(NewParameters);}
ConstitutiveLaw::Pointer CreateWithProperties(ConstitutiveLaw& rThisConstitutiveLaw, Kratos::Parameters NewParameters, const Properties& rProperties){ return rThisConstitutiveLaw.Create(NewParameters, rProperties);}


void AddConstitutiveLawToPython(pybind11::module& m)
{

Expand Down
8 changes: 4 additions & 4 deletions kratos/python/add_containers_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ template< class TBinderType, typename TContainerType, typename TVariableType > v

void AddContainersToPython(pybind11::module& m)
{
typedef Variable<array_1d<double, 3> > Array1DVariable3;
typedef Variable<array_1d<double, 4> > Array1DVariable4;
typedef Variable<array_1d<double, 6> > Array1DVariable6;
typedef Variable<array_1d<double, 9> > Array1DVariable9;
using Array1DVariable3 = Variable<array_1d<double, 3> >;
using Array1DVariable4 = Variable<array_1d<double, 4> >;
using Array1DVariable6 = Variable<array_1d<double, 6> >;
using Array1DVariable9 = Variable<array_1d<double, 9> >;

py::class_<VariableData>(m, "VariableData" )
.def("Name", &VariableData::Name, py::return_value_policy::copy)
Expand Down
6 changes: 2 additions & 4 deletions kratos/python/add_convergence_accelerators_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "solving_strategies/convergence_accelerators/convergence_accelerator.h"
#include "spaces/ublas_space.h"

namespace Kratos {
namespace Python {
namespace Kratos::Python {

void AddConvergenceAcceleratorsToPython(pybind11::module &m)
{
Expand Down Expand Up @@ -50,5 +49,4 @@ void AddConvergenceAcceleratorsToPython(pybind11::module &m)

}

} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.
8 changes: 2 additions & 6 deletions kratos/python/add_data_communicator_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include "includes/data_communicator.h"
#include "includes/parallel_environment.h"

namespace Kratos {

namespace Python {
namespace Kratos::Python {

template<class TValue>
std::vector<TValue> VectorBroadcastWrapper(
Expand Down Expand Up @@ -172,6 +170,4 @@ void AddDataCommunicatorToPython(pybind11::module &m)
.def("__str__", PrintObject<DataCommunicator>);
}

} // namespace Python.

} // Namespace Kratos
} // namespace Kratos::Python.
12 changes: 4 additions & 8 deletions kratos/python/add_dem_variables_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// 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
Expand All @@ -20,10 +20,7 @@
#include "includes/dem_variables.h"
#include "python/add_dem_variables_to_python.h"

namespace Kratos
{

namespace Python
namespace Kratos::Python
{

void AddDEMVariablesToPython(pybind11::module& m)
Expand Down Expand Up @@ -153,5 +150,4 @@ void AddDEMVariablesToPython(pybind11::module& m)
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, ENTHAPLY_ACTIVATION )

}
} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.
12 changes: 4 additions & 8 deletions kratos/python/add_deprecated_variables_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// 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
Expand All @@ -20,10 +20,7 @@
#include "python/add_deprecated_variables_to_python.h"
#include "includes/deprecated_variables.h"

namespace Kratos
{

namespace Python
namespace Kratos::Python
{

void AddDeprecatedVariablesToPython(pybind11::module& m)
Expand Down Expand Up @@ -130,5 +127,4 @@ void AddDeprecatedVariablesToPython(pybind11::module& m)
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, IS_GRAVITY_FILLING)

}
} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.
33 changes: 14 additions & 19 deletions kratos/python/add_factories_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Riccardo Rossi
// Vicente Mataix Ferrandiz
Expand All @@ -23,23 +23,20 @@
#include "factories/preconditioner_factory.h"
#include "factories/register_factories.h"

namespace Kratos
namespace Kratos::Python
{

namespace Python
{

typedef UblasSpace<double, CompressedMatrix, boost::numeric::ublas::vector<double>> SpaceType;
typedef UblasSpace<double, Matrix, Vector> LocalSpaceType;
typedef LinearSolver<SpaceType, LocalSpaceType> LinearSolverType;
typedef TUblasSparseSpace<std::complex<double>> ComplexSpaceType;
typedef TUblasDenseSpace<std::complex<double>> ComplexLocalSpaceType;
using SpaceType = UblasSpace<double, CompressedMatrix, boost::numeric::ublas::vector<double>>;
using LocalSpaceType = UblasSpace<double, Matrix, Vector>;
using LinearSolverType = LinearSolver<SpaceType, LocalSpaceType>;
using ComplexSpaceType = TUblasSparseSpace<std::complex<double>>;
using ComplexLocalSpaceType = TUblasDenseSpace<std::complex<double>>;

typedef LinearSolverFactory< SpaceType, LocalSpaceType > LinearSolverFactoryType;
typedef LinearSolverFactory< ComplexSpaceType, ComplexLocalSpaceType > ComplexLinearSolverFactoryType;
typedef PreconditionerFactory< SpaceType, LocalSpaceType > PreconditionerFactoryType;
typedef ExplicitBuilder< SpaceType, LocalSpaceType > ExplicitBuilderType;
typedef Factory< ExplicitBuilderType > ExplicitBuilderFactoryType;
using LinearSolverFactoryType = LinearSolverFactory<SpaceType, LocalSpaceType>;
using ComplexLinearSolverFactoryType = LinearSolverFactory<ComplexSpaceType, ComplexLocalSpaceType>;
using PreconditionerFactoryType = PreconditionerFactory<SpaceType, LocalSpaceType>;
using ExplicitBuilderType = ExplicitBuilder<SpaceType, LocalSpaceType>;
using ExplicitBuilderFactoryType = Factory<ExplicitBuilderType>;

void AddFactoriesToPython(pybind11::module& m)
{
Expand Down Expand Up @@ -81,6 +78,4 @@ void AddFactoriesToPython(pybind11::module& m)

}

} // namespace Python.

} // Namespace Kratos
} // namespace Kratos::Python.
11 changes: 3 additions & 8 deletions kratos/python/add_fsi_variables_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// Ruben Zorrilla
//


// System includes

// External includes
Expand All @@ -21,14 +20,11 @@
#include "includes/fsi_variables.h"
#include "python/add_fsi_variables_to_python.h"

namespace Kratos
{

namespace Python
namespace Kratos::Python
{
namespace py = pybind11;

void AddFSIVariablesToPython(pybind11::module& m)
void AddFSIVariablesToPython(pybind11::module& m)
{

//registering variables in python
Expand Down Expand Up @@ -59,5 +55,4 @@ void AddFSIVariablesToPython(pybind11::module& m)
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(m,NEGATIVE_MAPPED_VECTOR_VARIABLE);

}
} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.
9 changes: 2 additions & 7 deletions kratos/python/add_io_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
#include "includes/json_io.h"
#endif

namespace Kratos
{

namespace Python
namespace Kratos::Python
{

void (GidIO<>::*pointer_to_io_read_single_properties)(Properties& rThisProperties ) = &IO::ReadProperties;
Expand Down Expand Up @@ -242,8 +239,6 @@ void AddIOToPython(pybind11::module& m)
vtu_output.attr("CONDITIONS") = VtuOutput::CONDITIONS;
vtu_output.attr("ELEMENTS") = VtuOutput::ELEMENTS;
}
} // namespace Python.

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


11 changes: 4 additions & 7 deletions kratos/python/add_kratos_application_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// 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
Expand All @@ -20,8 +20,7 @@
#include "includes/kratos_application.h"
#include "python/add_kratos_application_to_python.h"

namespace Kratos {
namespace Python {
namespace Kratos::Python {
namespace py = pybind11;

void RegisterToPythonApplicationVariables(std::string ApplicationName)
Expand Down Expand Up @@ -53,6 +52,4 @@ void AddKratosApplicationToPython(pybind11::module& m) {
;
}

} // namespace Python.

} // Namespace Kratos
} // namespace Kratos::Python.
8 changes: 2 additions & 6 deletions kratos/python/add_kratos_parameters_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include "includes/kratos_parameters.h"
#include "add_kratos_parameters_to_python.h"

namespace Kratos {

namespace Python {
namespace Kratos::Python {

pybind11::list items(Parameters const& self)
{
Expand Down Expand Up @@ -146,6 +144,4 @@ void AddKratosParametersToPython(pybind11::module& m)
;
}

} // namespace Python.

} // Namespace Kratos
} // namespace Kratos::Python.
11 changes: 2 additions & 9 deletions kratos/python/add_linear_solvers_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
//
//


// System includes

// External includes


// Project includes
#include "includes/define_python.h"
#include "python/add_linear_solvers_to_python.h"
Expand All @@ -42,10 +40,7 @@
#include "linear_solvers/power_iteration_highest_eigenvalue_solver.h"
#include "linear_solvers/rayleigh_quotient_iteration_eigenvalue_solver.h"

namespace Kratos
{

namespace Python
namespace Kratos::Python
{
template <class TDataType>
using TSpaceType = UblasSpace<TDataType, boost::numeric::ublas::compressed_matrix<TDataType>, boost::numeric::ublas::vector<TDataType>>;
Expand Down Expand Up @@ -244,6 +239,4 @@ void AddLinearSolversToPython(pybind11::module& m)

}

} // namespace Python.

} // Namespace Kratos
} // namespace Kratos::Python.
11 changes: 4 additions & 7 deletions kratos/python/add_logger_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Carlos A. Roig
//
Expand All @@ -20,9 +20,7 @@
#include "input_output/file_logger_output.h"
#include "input_output/logger_table_output.h"


namespace Kratos {
namespace Python {
namespace Kratos::Python {

namespace py = pybind11;

Expand Down Expand Up @@ -208,5 +206,4 @@ void AddLoggerToPython(pybind11::module& m) {
.value("CHECKING", Logger::Category::CHECKING);
}

} // namespace Python.
} // Namespace Kratos
} // namespace Kratos::Python.
10 changes: 4 additions & 6 deletions kratos/python/add_mapper_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Philipp Bucher (https://github.com/philbucher)

Expand All @@ -17,13 +17,11 @@
#include "mappers/mapper_define.h"
#include "add_mapper_to_python.h"

namespace Kratos {
namespace Python {
namespace Kratos::Python {

void AddMapperToPython(pybind11::module& m)
{
AddMappingToPython<MapperDefinitions::SparseSpaceType, MapperDefinitions::DenseSpaceType>(m);
}

} // namespace Python.
} // namespace Kratos.
} // namespace Kratos::Python.
Loading

0 comments on commit 88e74b0

Please sign in to comment.