NuTo
Numerics Tool
DataArray.h
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
3 #include <iosfwd>
4 
5 namespace NuTo
6 {
7 namespace Visualize
8 {
9 template <typename TDataType>
11 class DataArray
12 {
13 public:
17  DataArray(std::string name, int numComponents, std::vector<TDataType>&& data);
18 
20  std::string VtkTypeString() const;
21 
24  int Offset() const;
25 
28  void WriteCommonHeader(std::ostream& file) const;
29 
32  void WriteAscii(std::ostream& file) const;
33 
39  void WriteBinaryHeader(std::ostream& file, int* offset) const;
40 
43  void WriteBinaryData(std::ofstream& file) const;
44 
45 private:
46  std::string mName;
47  int mNumComponents;
48  std::vector<TDataType> mData;
49 };
50 } /* Visualize */
51 } /* NuTo */
void WriteCommonHeader(std::ostream &file) const
writes the header for both ascii and binary format including "name", "NumberOfComponents" and "type" ...
Definition: DataArray.cpp:58
int Offset() const
Definition: DataArray.cpp:52
void WriteBinaryData(std::ofstream &file) const
writes the data in uncompressed raw binary
Definition: DataArray.cpp:99
std::string VtkTypeString() const
DataArray(std::string name, int numComponents, std::vector< TDataType > &&data)
Definition: DataArray.cpp:9
void WriteAscii(std::ostream &file) const
writes to ascii including the common header, "type" and the actual data
Definition: DataArray.cpp:68
collects data for a vtk <DataArray> and writes it in ascii or raw binary appended format ...
Definition: DataArray.h:11
Definition: Exception.h:6
void WriteBinaryHeader(std::ostream &file, int *offset) const
writes the binary header including the common header, "type", "offset" and calculates the new offset ...
Definition: DataArray.cpp:87
def Visualize(structure, file)
Definition: Truss1D2N.py:63