4 #ifndef DUNE_GRID_IO_FILE_VTK_COMMON_HH 5 #define DUNE_GRID_IO_FILE_VTK_COMMON_HH 11 #include <dune/common/exceptions.hh> 12 #include <dune/geometry/type.hh> 13 #include <dune/common/typetraits.hh> 109 typedef std::conditional<std::numeric_limits<char>::is_signed,
125 static std::string getString() {
126 static const unsigned int_sizes[] = { 8, 16, 32, 64, 0 };
127 static const unsigned float_sizes[] = { 32, 64, 0 };
128 const unsigned* sizes;
130 std::ostringstream s;
131 if(std::numeric_limits<T>::is_integer) {
132 if(std::numeric_limits<T>::is_signed)
144 static const unsigned size = 8*
sizeof(T);
145 while(*sizes != 0 && *sizes <= size) ++sizes;
158 static const std::string s = getString();
199 if (t.isVertex())
return vertex;
200 if (t.isLine())
return line;
201 if (t.isTriangle())
return triangle;
204 if (t.isPyramid())
return pyramid;
205 if (t.isPrism())
return prism;
210 if( t.dim() == 2 )
return polygon;
214 DUNE_THROW(IOError,
"VTKWriter: unsupported GeometryType " << t);
234 static const int quadRenumbering[4] = {0,1,3,2};
235 static const int cubeRenumbering[8] = {0,1,3,2,4,5,7,6};
236 static const int prismRenumbering[6] = {0,2,1,3,5,4};
237 static const int pyramidRenumbering[5] = {0,1,3,2,4};
239 if (t.isQuadrilateral())
return quadRenumbering[i];
240 if (t.isPyramid())
return pyramidRenumbering[i];
241 if (t.isPrism())
return prismRenumbering[i];
242 if (t.isHexahedron())
return cubeRenumbering[i];
281 if (reinterpret_cast<char*>(&i)[1] == 1)
284 return "LittleEndian";
370 #endif // DUNE_GRID_IO_FILE_VTK_COMMON_HH Output to the file is inline base64 binary.
Definition: common.hh:44
const std::string & operator()() const
return VTK name of the type
Definition: common.hh:157
Definition: common.hh:180
Definition: common.hh:187
Type type() const
The type of the data field.
Definition: common.hh:344
Output non-conforming data.
Definition: common.hh:78
DataMode
Whether to produce conforming or non-conforming output.
Definition: common.hh:64
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:197
int Type
Definition: common.hh:104
Output is to the file is appended raw binary.
Definition: common.hh:46
determine a type to safely put another type into a stream
Definition: common.hh:92
Definition: common.hh:188
Descriptor struct for VTK fields.
Definition: common.hh:314
Definition: common.hh:184
FieldInfo(std::string name, Type type, std::size_t size)
Create a FieldInfo instance with the given name, type and size.
Definition: common.hh:331
Output is to the file is appended base64 binary.
Definition: common.hh:48
std::string name() const
The name of the data field.
Definition: common.hh:338
Type
VTK data type.
Definition: common.hh:320
Output conforming data.
Definition: common.hh:70
Definition: common.hh:186
for .vtp files (PolyData)
Definition: common.hh:300
unsigned Type
Definition: common.hh:99
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
map type to its VTK name in data array
Definition: common.hh:124
Definition: common.hh:182
Definition: common.hh:181
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:232
Output to the file is in ascii.
Definition: common.hh:42
FileType
which type of VTK file to write
Definition: common.hh:298
for .vtu files (UnstructuredGrid)
Definition: common.hh:302
Definition: common.hh:179
std::string getEndiannessString()
determine endianness of this C++ implementation
Definition: common.hh:278
Definition: common.hh:185
T Type
type to convert T to before putting it into a stream with <<
Definition: common.hh:94
std::size_t size() const
The number of components in the data field.
Definition: common.hh:350
std::conditional< std::numeric_limits< char >::is_signed, int, unsigned >::type Type
Definition: common.hh:111
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:40
Include standard header files.
Definition: agrid.hh:58
Definition: common.hh:183