dune-vtk 2.12
Loading...
Searching...
No Matches
datacollector.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
3#pragma once
4
8#include <dune/python/pybind11/pytypes.h>
9#include <dune/vtk/types.hh>
18
19namespace Dune::Vtk::Impl {
20
21// Construct a data collector with additional optional arguments given via pybind11::args
22
23template< class DataCollector, class GridView >
24DataCollector pyMakeDataCollector(MetaType<DataCollector>, const GridView& gv, pybind11::args args)
25{
26 return DataCollector(gv);
27}
28
29template< class GridView >
31pyMakeDataCollector(MetaType<CellTypeDataCollector<GridView>>, const GridView& gv, pybind11::args args)
32{
33 if (args.size() == 0)
35 else if (args.size() == 1)
37 else {
38 DUNE_THROW(Dune::Exception, "Cannot constructor CellTypeDataCollector with the passed arguments");
39 }
40}
41
42template< class GridView, class P >
44pyMakeDataCollector(MetaType<CodimDataCollector<GridView,P>>, const GridView& gv, pybind11::args args)
45{
46 if (args.size() == 0)
48 else if (args.size() == 1)
50 else {
51 DUNE_THROW(Dune::Exception, "Cannot constructor CodimDataCollector with the passed arguments");
52 }
53}
54
55template< class GridView, int O >
57pyMakeDataCollector(MetaType<LagrangeDataCollector<GridView,O>>, const GridView& gv, pybind11::args args)
58{
59 if (args.size() == 0)
61 else if (args.size() == 1)
63 else {
64 DUNE_THROW(Dune::Exception, "Cannot constructor LagrangeDataCollector with the passed arguments");
65 }
66}
67
68template< class GridView, int O >
70pyMakeDataCollector(MetaType<DiscontinuousLagrangeDataCollector<GridView,O>>, const GridView& gv, pybind11::args args)
71{
72 if (args.size() == 0)
74 else if (args.size() == 1)
76 else {
77 DUNE_THROW(Dune::Exception, "Cannot constructor DiscontinuousLagrangeDataCollector with the passed arguments");
78 }
79}
80
81template< class GridView >
83pyMakeDataCollector(MetaType<SubdivisionDataCollector<GridView>>, const GridView& gv, pybind11::args args)
84{
85 if (args.size() == 0)
87 else if (args.size() == 3) {
88 int intervals = args[0].cast<int>();
89 int levels = args[1].cast<int>();
91 if (intervals > 0)
93 else if (levels > 0)
95 else
97 }
98 DUNE_THROW(Dune::Exception, "Cannot constructor SubdivisionDataCollector with the passed arguments: " << args);
100}
101
102} // end namespace Dune::Vtk
Subdivision
Definition subdivisiondatacollector.hh:21
std::size_t levels()
RefinementIntervals refinementIntervals(int intervals)
RefinementIntervals refinementLevels(int levels)
#define DUNE_THROW(E,...)
Implementation of DataCollector for cells, with continuous data.
Definition celltypedatacollector.hh:20