unstructureddatacollector.hh 1.04 KB
Newer Older
1
2
3
4
5
#pragma once

#include <cstdint>
#include <vector>

6
#include <dune/vtk/datacollectorinterface.hh>
7

8
namespace Dune {
9
10
11
12
13
14
15
16

struct Cells
{
  std::vector<std::uint8_t> types;
  std::vector<std::int64_t> offsets;
  std::vector<std::int64_t> connectivity;
};

17
template <class GridView, class Derived, class Partition>
18
class UnstructuredDataCollectorInterface
19
    : public DataCollectorInterface<GridView, Derived, Partition>
20
{
21
22
23
24
25
  using Super = DataCollectorInterface<GridView, Derived, Partition>;

public:
  using Super::dim;
  using Super::partition;
26
27
28
29
30
31
32
33
34
35
36
37

public:
  UnstructuredDataCollectorInterface (GridView const& gridView)
    : Super(gridView)
  {}

  /// \brief Return cell types, offsets, and connectivity. \see Cells
  Cells cells () const
  {
    return this->asDerived().cellsImpl();
  }

38
39
40
41
42
43
44
45
46
47
48
49
  std::vector<std::uint64_t> pointIds () const
  {
    return this->asDerived().pointIdsImpl();
  }

protected:
  // default implementation
  std::vector<std::uint64_t> pointIdsImpl () const
  {
    return {};
  }

50
51
52
53
protected:
  using Super::gridView_;
};

54
} // end namespace Dune