vtktypes.hh 1.44 KB
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#include <cstdint>
#include <map>
#include <string>
#include <vector>

#include <dune/geometry/type.hh>

namespace Dune
{
  namespace Vtk
  {
    enum FormatTypes {
      ASCII      = 1<<0,
      BINARY     = 1<<1,
      COMPRESSED = 1<<2,
      APPENDED = BINARY | COMPRESSED
    };

    enum DataTypes {
      UNKNOWN = 0,
      INT8, UINT8,
      INT16, UINT16,
      INT32, UINT32,
      INT64, UINT64,
      FLOAT32 = 32,
      FLOAT64 = 64
    };

    enum PositionTypes {
      VERTEX_DATA,
      CELL_DATA
    };

    enum ContinuityTypes {
      CONFORMING,
      NONCONFORMING
    };

    struct Map
    {
43
44
      static std::map<std::uint8_t, GeometryType> type; // VTK Cell type -> Dune::GeometryType
      static std::map<std::string, DataTypes> datatype; // String -> DataTypes
Praetorius, Simon's avatar
Praetorius, Simon committed
45
46
47
48
49
50
51
52
53
    };


    /// Mapping of Dune geometry types to VTK cell types
    class CellType
    {
    public:
      CellType (GeometryType const& t);

54
      /// Return VTK Cell type
Praetorius, Simon's avatar
Praetorius, Simon committed
55
56
57
58
59
      std::uint8_t type () const
      {
        return type_;
      }

60
      /// Return a permutation of Dune elemenr vertices to conform to VTK element numbering
61
      int permutation (int idx) const
Praetorius, Simon's avatar
Praetorius, Simon committed
62
63
64
65
      {
        return permutation_[idx];
      }

66
67
68
69
70
      bool noPermutation () const
      {
        return noPermutation_;
      }

Praetorius, Simon's avatar
Praetorius, Simon committed
71
72
73
    private:
      std::uint8_t type_;
      std::vector<int> permutation_;
74
      bool noPermutation_;
Praetorius, Simon's avatar
Praetorius, Simon committed
75
76
77
78
    };

  } // end namespace Vtk
} // end namespace Dune