6#ifndef DUNE_GRID_IO_FILE_VTK_COMMON_HH
7#define DUNE_GRID_IO_FILE_VTK_COMMON_HH
14#include <dune/common/exceptions.hh>
15#include <dune/geometry/type.hh>
16#include <dune/common/typetraits.hh>
112 typedef std::conditional<std::numeric_limits<char>::is_signed,
153 if (t.isVertex())
return vertex;
154 if (t.isLine())
return line;
155 if (t.isTriangle())
return triangle;
158 if (t.isPyramid())
return pyramid;
159 if (t.isPrism())
return prism;
164 if( t.dim() == 2 )
return polygon;
168 DUNE_THROW(IOError,
"VTKWriter: unsupported GeometryType " << t);
188 static const int quadRenumbering[4] = {0,1,3,2};
189 static const int cubeRenumbering[8] = {0,1,3,2,4,5,7,6};
190 static const int prismRenumbering[6] = {0,2,1,3,5,4};
191 static const int pyramidRenumbering[5] = {0,1,3,2,4};
193 if (t.isQuadrilateral())
return quadRenumbering[i];
194 if (t.isPyramid())
return pyramidRenumbering[i];
195 if (t.isPrism())
return prismRenumbering[i];
196 if (t.isHexahedron())
return cubeRenumbering[i];
235 if (
reinterpret_cast<char*
>(&i)[1] == 1)
238 return "LittleEndian";
295 DUNE_THROW(Dune::NotImplemented,
"Unknown precision type");
305 return sizeof(float);
307 return sizeof(double);
309 return sizeof(std::uint32_t);
311 return sizeof(std::uint8_t);
313 return sizeof(std::int32_t);
315 DUNE_THROW(Dune::NotImplemented,
"Unknown precision type");
Include standard header files.
Definition: agrid.hh:60
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:271
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:43
@ ascii
Output to the file is in ascii.
Definition: common.hh:45
@ appendedraw
Output is to the file is appended raw binary.
Definition: common.hh:49
@ appendedbase64
Output is to the file is appended base64 binary.
Definition: common.hh:51
@ base64
Output to the file is inline base64 binary.
Definition: common.hh:47
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:186
FileType
which type of VTK file to write
Definition: common.hh:252
@ polyData
for .vtp files (PolyData)
Definition: common.hh:254
@ unstructuredGrid
for .vtu files (UnstructuredGrid)
Definition: common.hh:256
std::string toString(Precision p)
map precision to VTK type name
Definition: common.hh:280
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:67
@ conforming
Output conforming data.
Definition: common.hh:73
@ nonconforming
Output non-conforming data.
Definition: common.hh:81
std::size_t typeSize(Precision p)
map precision to byte size
Definition: common.hh:300
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:151
std::string getEndiannessString()
determine endianness of this C++ implementation
Definition: common.hh:232
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
@ line
Definition: common.hh:134
@ pyramid
Definition: common.hh:141
@ polyhedron
Definition: common.hh:142
@ quadrilateral
Definition: common.hh:137
@ vertex
Definition: common.hh:133
@ tetrahedron
Definition: common.hh:138
@ prism
Definition: common.hh:140
@ hexahedron
Definition: common.hh:139
@ triangle
Definition: common.hh:135
@ polygon
Definition: common.hh:136
determine a type to safely put another type into a stream
Definition: common.hh:95
T Type
type to convert T to before putting it into a stream with <<
Definition: common.hh:97
unsigned Type
Definition: common.hh:102
int Type
Definition: common.hh:107
std::conditional< std::numeric_limits< char >::is_signed, int, unsigned >::type Type
Definition: common.hh:114
Descriptor struct for VTK fields.
Definition: common.hh:328
std::size_t size() const
The number of components in the data field.
Definition: common.hh:364
Precision precision() const
The precision used for the output of the data field.
Definition: common.hh:370
Type
VTK data type.
Definition: common.hh:333
FieldInfo(std::string name, Type type, std::size_t size, Precision prec=Precision::float32)
Create a FieldInfo instance with the given name, type and size.
Definition: common.hh:344
Type type() const
The type of the data field.
Definition: common.hh:358
std::string name() const
The name of the data field.
Definition: common.hh:352