51 ostringstream DataStream;
52 typename vector<T>::const_iterator itData;
53 for (itData = m_Data.begin(); itData != m_Data.end(); ++itData)
55 WriteVTKDataElement(DataStream, *itData) <<
" ";
61 TiXmlElement Element(
"DataArray");
63 Element.SetAttribute(
"type", GetVTKDataType());
64 Element.SetAttribute(
"NumberOfComponents", GetNumberOfComponents());
65 Element.SetAttribute(
"format",
"ascii");
66 Element.SetAttribute(
"Name", m_Name.c_str());
67 Element.InsertEndChild(TiXmlText(DataStream.str()));
69 Parent.InsertEndChild(Element);
94 output << (int)Element;
100 output << (int)Element;
104 #define DEFINE_INT_DATA_TYPE(TYPE) template <> inline string CMeshData<TYPE>::GetVTKDataType() {return "Int" + stringify(sizeof(TYPE)*8);}
105 #define DEFINE_UINT_DATA_TYPE(TYPE) template <> inline string CMeshData<TYPE>::GetVTKDataType() {return "UInt" + stringify(sizeof(TYPE)*8);}
116 #undef DEFINE_INT_DATA_TYPE
117 #undef DEFINE_UINT_DATA_TYPE
140 output << Element.
x <<
" " << Element.
y <<
" " << Element.
z;
158 output << Element.
x <<
" " << Element.
y;
#define DEFINE_UINT_DATA_TYPE(TYPE)
#define DEFINE_INT_DATA_TYPE(TYPE)
virtual void InsertVTKData(TiXmlElement &Parent) const =0
CMeshDataBase(string Name, DATA_TYPE Type)
static int GetNumberOfComponents()
CMeshData(string Name, DATA_TYPE Type)
void InsertVTKData(TiXmlElement &Parent) const
static string GetVTKDataType()
ostream & WriteVTKDataElement(ostream &output, T Element) const
Namespace containing a series of customised math operations not found in the standard c++ library.
std::string stringify(const T &x, int iPrecision=12, bool bScientific=true)
Function to convert a value (e.g. int, double, etc...) to a string.
Struct for representing points in 2D space.
Struct for representing points in 3D space.