4#ifndef DUNE_PYTHON_VTK_WRITER_HH
5#define DUNE_PYTHON_VTK_WRITER_HH
9#include <dune/python/pybind11/pybind11.h>
10#include <dune/python/pybind11/stl.h>
21 template<
class Writer,
class... options >
23 pybind11::class_< Writer, options... > cls )
25 using GridView =
typename Writer::GridView;
28 cls.def( pybind11::init( [] ( GridView &grid,
32 pybind11::kwargs kwargs) {
33 return new Writer( grid, format, datatype, headertype );
34 }), pybind11::arg(
"grid"),
38 pybind11::keep_alive< 1, 2 >());
41 [] ( Writer &writer,
const std::string &name ) {
44 pybind11::arg(
"name") );
46 [] ( Writer &writer,
const std::string &name,
int number ) {
47 std::stringstream s; s << name << std::setw(5) << std::setfill(
'0') << number;
48 writer.write( s.str());
50 pybind11::arg(
"name"),
51 pybind11::arg(
"number") );
53 cls.def(
"addPointData",
54 [] ( Writer &writer, VirtualizedGF &f,
57 f.setRangeType(range);
59 writer.addPointData(f);
61 pybind11::keep_alive< 1, 2 >(),
66 cls.def(
"addPointData",
67 [] ( Writer &writer, VirtualizedGF &f,
72 f.setRangeType(range);
74 writer.addPointData(f);
76 pybind11::keep_alive< 1, 2 >(),
77 pybind11::arg(
"f"), pybind11::arg(
"name"),
81 cls.def(
"addPointData",
82 [] ( Writer &writer, VirtualizedGF &f,
84 std::vector<int> &components,
88 f.setRangeType(range);
90 f.setComponents(components);
91 writer.addPointData(f);
93 pybind11::keep_alive< 1, 2 >(),
94 pybind11::arg(
"f"), pybind11::arg(
"name"),
95 pybind11::arg(
"components"),
99 cls.def(
"addPointData",
100 [] ( Writer &writer, VirtualizedGF &f,
102 f.setFieldInfo(info);
103 writer.addPointData(f);
105 pybind11::keep_alive< 1, 2 >(),
106 pybind11::arg(
"f"), pybind11::arg(
"info") );
107 cls.def(
"addPointData",
108 [] ( Writer &writer, VirtualizedGF &f,
109 std::vector<int> &components,
FieldInfo &info ) {
110 f.setFieldInfo(info);
111 f.setComponents(components);
112 writer.addPointData(f);
114 pybind11::keep_alive< 1, 2 >(),
115 pybind11::arg(
"f"), pybind11::arg(
"components"), pybind11::arg(
"info") );
117 cls.def(
"addCellData",
118 [] ( Writer &writer, VirtualizedGF &f,
121 f.setRangeType(range);
123 writer.addCellData(f);
125 pybind11::keep_alive< 1, 2 >(),
130 cls.def(
"addCellData",
131 [] ( Writer &writer, VirtualizedGF &f,
136 f.setRangeType(range);
138 writer.addCellData(f);
140 pybind11::keep_alive< 1, 2 >(),
141 pybind11::arg(
"f"), pybind11::arg(
"name"),
145 cls.def(
"addCellData",
146 [] ( Writer &writer, VirtualizedGF &f,
148 std::vector<int> &components,
152 f.setRangeType(range);
154 f.setComponents(components);
155 writer.addCellData(f);
157 pybind11::keep_alive< 1, 2 >(),
158 pybind11::arg(
"f"), pybind11::arg(
"name"),
159 pybind11::arg(
"components"),
163 cls.def(
"addCellData",
164 [] ( Writer &writer, VirtualizedGF &f,
166 f.setFieldInfo(info);
167 writer.addCellData(f);
169 pybind11::keep_alive< 1, 2 >(),
170 pybind11::arg(
"f"), pybind11::arg(
"info") );
171 cls.def(
"addCellData",
172 [] ( Writer &writer, VirtualizedGF &f,
173 std::vector<int> &components,
FieldInfo &info ) {
174 f.setFieldInfo(info);
175 f.setComponents(components);
176 writer.addCellData(f);
178 pybind11::keep_alive< 1, 2 >(),
179 pybind11::arg(
"f"), pybind11::arg(
"components"), pybind11::arg(
"info") );
FormatTypes
Type used for representing the output format.
Definition: types.hh:21
RangeTypes
Type used to determine whether to limit output components to e.g. 3 (vector), or 9 (tensor)
Definition: types.hh:35
DataTypes
Definition: types.hh:52
static void registerVtkWriter(pybind11::handle scope, pybind11::class_< Writer, options... > cls)
Definition: writer.hh:22
Wrapper class for functions allowing local evaluations.
Definition: function.hh:28