Debian Codegraph @

python/src/graph.cpp

raw
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 <memory>
19 #include <vector>
20 #include <pybind11/pybind11.h>
21 #include <pybind11/stl.h>
22
23 #include <dolfin/graph/Graph.h>
24 #include <dolfin/graph/GraphBuilder.h>
25 #include <dolfin/mesh/Mesh.h>
26
27 namespace py = pybind11;
28
29 namespace dolfin_wrappers
30 {
31 void graph(py::module& m)
32 {
33 // dolfin::Set
34 py::class_<dolfin::Set<int>>(m, "DOLFINIntSet");
35
36 // dolfin::Graph
37 py::class_<dolfin::Graph>(m, "Graph");
38
39 // dolfin::GraphBuilder
40 py::class_<dolfin::GraphBuilder>(m, "GraphBuilder")
41 .def_static("local_graph", [](const dolfin::Mesh& mesh, const std::vector<std::size_t>& coloring)
42 { return dolfin::GraphBuilder::local_graph(mesh, coloring); })
43 .def_static("local_graph", [](const dolfin::Mesh& mesh, std::size_t dim0, std::size_t dim1)
44 { return dolfin::GraphBuilder::local_graph(mesh, dim0, dim1); });
45 }
46 }