dune-vtk 2.12
Loading...
Searching...
No Matches
unstructureddatacollector.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
5#include <cstdint>
6#include <vector>
7
10
11namespace Dune::Vtk
12{
19
20 // tag to indicate whether point IDs should be written
21 template <bool = true>
22 struct WritePointIDs {};
23
24
25 template <class GridView, class Derived, class Partition = Partitions::InteriorBorder>
27 : public DataCollectorInterface<GridView, Derived, Partition>
28 {
30
31 public:
32 using Super::dim;
33 using Super::partition;
34
35 public:
39
40 template <bool b>
45
47 Cells cells () const
48 {
49 return this->asDerived().cellsImpl();
50 }
51
54 {
55 if (writePointIDs_)
56 return this->asDerived().pointIdsImpl();
57 else
59 }
60
61 protected:
62 // default implementation
64 {
65 return {};
66 }
67
68 private:
69 bool writePointIDs_ = false;
70 };
71
72} // end namespace Dune::Vtk
Definition datacollector.hh:19
Base class for data collectors in a CRTP style.
Definition datacollectorinterface.hh:20
@ dim
Definition datacollectorinterface.hh:29
static constexpr auto partition
The partitionset to collect data from.
Definition datacollectorinterface.hh:26
Derived & asDerived()
Definition datacollectorinterface.hh:119
GridView const & gridView() const
Return the bound grid view.
Definition datacollectorinterface.hh:41
Implementation of DataCollector for cells, with continuous data.
Definition celltypedatacollector.hh:20
Definition unstructureddatacollector.hh:14
std::vector< std::int64_t > offsets
Definition unstructureddatacollector.hh:16
std::vector< std::int64_t > connectivity
Definition unstructureddatacollector.hh:17
std::vector< std::uint8_t > types
Definition unstructureddatacollector.hh:15
Definition unstructureddatacollector.hh:22
Definition unstructureddatacollector.hh:28
std::vector< std::uint64_t > pointIdsImpl() const
Definition unstructureddatacollector.hh:63
UnstructuredDataCollectorInterface(GridView const &gridView)
Definition unstructureddatacollector.hh:36
Cells cells() const
Return cell types, offsets, and connectivity.
Definition unstructureddatacollector.hh:47
std::vector< std::uint64_t > pointIds() const
Return parallel unique IDs for each point in the grid.
Definition unstructureddatacollector.hh:53
UnstructuredDataCollectorInterface(GridView const &gridView, WritePointIDs< b >)
Definition unstructureddatacollector.hh:41