| 1 |
// Copyright (C) 2017 Chris N. Richardson and Garth N. Wells |
| 2 |
// |
| 3 |
// This file is part of DOLFIN. |
| 4 |
// |
| 5 |
// DOLFIN is free software: you can redistribute it and/or modify |
| 6 |
// it under the terms of the GNU Lesser General Public License as published by |
| 7 |
// the Free Software Foundation, either version 3 of the License, or |
| 8 |
// (at your option) any later version. |
| 9 |
// |
| 10 |
// DOLFIN is distributed in the hope that it will be useful, |
| 11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
// GNU Lesser General Public License for more details. |
| 14 |
// |
| 15 |
// You should have received a copy of the GNU Lesser General Public License |
| 16 |
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
#include <iostream> |
| 19 |
#include <pybind11/pybind11.h> |
| 20 |
#include <dolfin/log/log.h> |
| 21 |
|
| 22 |
namespace py = pybind11; |
| 23 |
|
| 24 |
namespace dolfin_wrappers |
| 25 |
{ |
| 26 |
// common |
| 27 |
void common(py::module& m); |
| 28 |
void mpi(py::module& m); |
| 29 |
|
| 30 |
// log |
| 31 |
void log(py::module& m); |
| 32 |
|
| 33 |
void adaptivity(py::module& m); |
| 34 |
void ale(py::module& m); |
| 35 |
|
| 36 |
void function(py::module& m); |
| 37 |
void fem(py::module& m); |
| 38 |
|
| 39 |
void generation(py::module& m); |
| 40 |
void geometry(py::module& m); |
| 41 |
void graph(py::module& m); |
| 42 |
void io(py::module& m); |
| 43 |
void la(py::module& m); |
| 44 |
void math(py::module& m); |
| 45 |
void mesh(py::module& m); |
| 46 |
void multistage(py::module& m); |
| 47 |
void ts(py::module& m); |
| 48 |
void nls(py::module& m); |
| 49 |
void parameter(py::module& m); |
| 50 |
void refinement(py::module& m); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
PYBIND11_MODULE(cpp, m) |
| 55 |
{ |
| 56 |
// Create module for C++ wrappers |
| 57 |
m.doc() = "DOLFIN Python interface"; |
| 58 |
m.attr("__version__") = DOLFIN_VERSION; |
| 59 |
|
| 60 |
// Create common submodule [common] |
| 61 |
py::module common = m.def_submodule("common", "Common module"); |
| 62 |
dolfin_wrappers::common(common); |
| 63 |
|
| 64 |
// Create MPI class [common] |
| 65 |
dolfin_wrappers::mpi(m); |
| 66 |
|
| 67 |
// Create common submodule [log] |
| 68 |
py::module log = m.def_submodule("log", "Logging module"); |
| 69 |
dolfin_wrappers::log(log); |
| 70 |
|
| 71 |
// Create function submodule [function] |
| 72 |
py::module function = m.def_submodule("function", |
| 73 |
"Function module"); |
| 74 |
dolfin_wrappers::function(function); |
| 75 |
|
| 76 |
|
| 77 |
// Create ale submodule [ale] |
| 78 |
py::module ale = m.def_submodule("ale", "ALE (mesh movement) module"); |
| 79 |
dolfin_wrappers::ale(ale); |
| 80 |
|
| 81 |
// Create math submodule [math] |
| 82 |
py::module math = m.def_submodule("math", "Math library module"); |
| 83 |
dolfin_wrappers::math(math); |
| 84 |
|
| 85 |
// Create mesh submodule [mesh] |
| 86 |
py::module mesh = m.def_submodule("mesh", "Mesh library module"); |
| 87 |
dolfin_wrappers::mesh(mesh); |
| 88 |
|
| 89 |
// Create multistage submodule [multistage] |
| 90 |
py::module multistage = m.def_submodule("multistage", "Multistage integrator library module"); |
| 91 |
dolfin_wrappers::multistage(multistage); |
| 92 |
|
| 93 |
// Create multistage submodule [multistage] |
| 94 |
py::module ts = m.def_submodule("ts", "Timestepping library module"); |
| 95 |
dolfin_wrappers::ts(ts); |
| 96 |
|
| 97 |
// Create graph submodule [graph] |
| 98 |
py::module graph = m.def_submodule("graph", "Graph module"); |
| 99 |
dolfin_wrappers::graph(graph); |
| 100 |
|
| 101 |
// Create fem submodule [fem] |
| 102 |
py::module fem = m.def_submodule("fem", "FEM module"); |
| 103 |
dolfin_wrappers::fem(fem); |
| 104 |
|
| 105 |
// Create generation submodule [generation] |
| 106 |
py::module generation = m.def_submodule("generation", |
| 107 |
"Mesh generation module"); |
| 108 |
dolfin_wrappers::generation(generation); |
| 109 |
|
| 110 |
// Create geometry submodule |
| 111 |
py::module geometry = m.def_submodule("geometry", |
| 112 |
"Geometry module"); |
| 113 |
dolfin_wrappers::geometry(geometry); |
| 114 |
|
| 115 |
// Create io submodule |
| 116 |
py::module io = m.def_submodule("io", "I/O module"); |
| 117 |
dolfin_wrappers::io(io); |
| 118 |
|
| 119 |
// Create la submodule |
| 120 |
py::module la = m.def_submodule("la", "Linear algebra module"); |
| 121 |
dolfin_wrappers::la(la); |
| 122 |
|
| 123 |
// Create nls submodule |
| 124 |
py::module nls = m.def_submodule("nls", "Nonlinear solver module"); |
| 125 |
dolfin_wrappers::nls(nls); |
| 126 |
|
| 127 |
// Create parameter submodule |
| 128 |
py::module parameter = m.def_submodule("parameter", "Parameter module"); |
| 129 |
dolfin_wrappers::parameter(parameter); |
| 130 |
|
| 131 |
// Create refinement submodule |
| 132 |
py::module refinement = m.def_submodule("refinement", "Mesh refinement module"); |
| 133 |
dolfin_wrappers::refinement(refinement); |
| 134 |
|
| 135 |
// Create adaptivity submodule [adaptivity] |
| 136 |
py::module adaptivity = m.def_submodule("adaptivity", "Adaptivity module"); |
| 137 |
dolfin_wrappers::adaptivity(adaptivity); |
| 138 |
|
| 139 |
// FIXME: these are just for the transition |
| 140 |
m.def("warning", [](std::string message) { dolfin::warning(message); }); |
| 141 |
|
| 142 |
} |