Skip to content
Snippets Groups Projects
Unverified Commit e17bf7ee authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler Committed by GitHub
Browse files

Merge pull request #111 from dune-community/python-move-to-subdir

[python] move to la/ subdir
parents 97783027 4341096a
No related branches found
No related tags found
No related merge requests found
...@@ -9,4 +9,5 @@ ...@@ -9,4 +9,5 @@
# René Fritze (2018) # René Fritze (2018)
# ~~~ # ~~~
dune_pybindxi_add_module(_la EXCLUDE_FROM_ALL bindings.cc) add_subdirectory(la)
# ~~~
# This file is part of the dune-xt-la project:
# https://github.com/dune-community/dune-xt-la
# Copyright 2009-2018 dune-xt-la developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# René Fritze (2018)
# ~~~
dune_pybindxi_add_module(_la EXCLUDE_FROM_ALL bindings.cc)
...@@ -10,5 +10,10 @@ ...@@ -10,5 +10,10 @@
# René Fritze (2018) # René Fritze (2018)
# ~~~ # ~~~
import dune.xt from dune.xt import guarded_import
from dune.xt._la import *
for mod_name in (
'_la',
):
guarded_import(globals(), 'dune.xt.la', mod_name)
...@@ -40,6 +40,8 @@ PYBIND11_MODULE(_la, m) ...@@ -40,6 +40,8 @@ PYBIND11_MODULE(_la, m)
using namespace pybind11::literals; using namespace pybind11::literals;
namespace LA = Dune::XT::LA; namespace LA = Dune::XT::LA;
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.la", "_la");
py::module::import("dune.xt.common"); py::module::import("dune.xt.common");
LA::bind_Backends(m); LA::bind_Backends(m);
...@@ -86,46 +88,4 @@ PYBIND11_MODULE(_la, m) ...@@ -86,46 +88,4 @@ PYBIND11_MODULE(_la, m)
LA::bind_Solver<LA::EigenDenseMatrix<double>>(m); LA::bind_Solver<LA::EigenDenseMatrix<double>>(m);
LA::bind_Solver<LA::EigenRowMajorSparseMatrix<double>>(m); LA::bind_Solver<LA::EigenRowMajorSparseMatrix<double>>(m);
#endif #endif
} // PYBIND11_MODULE(...)
m.def("_init_mpi",
[](const std::vector<std::string>& args) {
int argc = Dune::XT::Common::numeric_cast<int>(args.size());
char** argv = Dune::XT::Common::vector_to_main_args(args);
Dune::MPIHelper::instance(argc, argv);
},
"args"_a = std::vector<std::string>());
m.def("_init_logger",
[](const ssize_t max_info_level,
const ssize_t max_debug_level,
const bool enable_warnings,
const bool enable_colors,
const std::string& info_color,
const std::string& debug_color,
const std::string& warning_color) {
Dune::XT::Common::TimedLogger().create(
max_info_level, max_debug_level, enable_warnings, enable_colors, info_color, debug_color, warning_color);
},
"max_info_level"_a = std::numeric_limits<ssize_t>::max(),
"max_debug_level"_a = std::numeric_limits<ssize_t>::max(),
"enable_warnings"_a = true,
"enable_colors"_a = true,
"info_color"_a = "blue",
"debug_color"_a = "darkgray",
"warning_color"_a = "red");
m.def("_test_logger",
[](const bool info, const bool debug, const bool warning) {
auto logger = Dune::XT::Common::TimedLogger().get("dune.xt.la");
if (info)
logger.info() << "info logging works!" << std::endl;
if (debug)
logger.debug() << "debug logging works!" << std::endl;
if (warning)
logger.warn() << "warning logging works!" << std::endl;
},
"info"_a = true,
"debug"_a = true,
"warning"_a = true);
} // PYBIND11_PLUGIN(la)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment