Debian Codegraph @

python/src/multistage.cpp

raw
1 // Copyright (C) 2017 Chris 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 <memory>
19 #include <pybind11/pybind11.h>
20 #include <pybind11/stl.h>
21
22 #include <dolfin/fem/DirichletBC.h>
23 #include <dolfin/fem/Form.h>
24 #include <dolfin/fem/GenericDofMap.h>
25 #include <dolfin/function/Constant.h>
26 #include <dolfin/function/Function.h>
27 #include <dolfin/la/GenericVector.h>
28 #include <dolfin/multistage/MultiStageScheme.h>
29 #include <dolfin/multistage/PointIntegralSolver.h>
30 #include <dolfin/multistage/RKSolver.h>
31
32 namespace py = pybind11;
33
34 namespace dolfin_wrappers
35 {
36
37 void multistage(py::module& m)
38 {
39 // dolfin::MultiStageScheme
40 py::class_<dolfin::MultiStageScheme, std::shared_ptr<dolfin::MultiStageScheme>, dolfin::Variable>
41 (m, "MultiStageScheme")
42 .def(py::init<std::vector<std::vector<std::shared_ptr<const dolfin::Form>>>,
43 std::shared_ptr<const dolfin::Form>,
44 std::vector<std::shared_ptr<dolfin::Function>>,
45 std::shared_ptr<dolfin::Function>,
46 std::shared_ptr<dolfin::Constant>,
47 std::shared_ptr<dolfin::Constant>,
48 std::vector<double>,
49 std::vector<int>,
50 unsigned int,
51 const std::string,
52 const std::string,
53 std::vector<std::shared_ptr<const dolfin::DirichletBC>>>())
54 .def("order", &dolfin::MultiStageScheme::order);
55
56 // dolfin::RKSolver
57 py::class_<dolfin::RKSolver, std::shared_ptr<dolfin::RKSolver>>
58 (m, "RKSolver")
59 .def(py::init<std::shared_ptr<dolfin::MultiStageScheme>>())
60 .def("step_interval", &dolfin::RKSolver::step_interval);
61
62 // dolfin::PointIntegralSolver
63 py::class_<dolfin::PointIntegralSolver, std::shared_ptr<dolfin::PointIntegralSolver>, dolfin::Variable>
64 (m, "PointIntegralSolver")
65 .def(py::init<std::shared_ptr<dolfin::MultiStageScheme>>())
66 .def("reset_newton_solver", &dolfin::PointIntegralSolver::reset_newton_solver)
67 .def("reset_stage_solutions", &dolfin::PointIntegralSolver::reset_stage_solutions)
68 .def("step", &dolfin::PointIntegralSolver::step)
69 .def("step_interval", &dolfin::PointIntegralSolver::step_interval)
70 .def("default_parameters", &dolfin::PointIntegralSolver::default_parameters);
71
72 }
73 }