/* * VTKWriter.hpp * * Created on: Dec 15, 2014 * Author: Pietro Incardona */ #ifndef VTKWRITER_HPP_ #define VTKWRITER_HPP_ #include "Graph/map_graph.hpp" #include #include #include #include #include "util/common.hpp" /*! \brief Get the type * * It convert T to a string identify the corrispondent type in VTK format * */ template std::string getType() { // Create a property string based on the type of the property if (typeid(T) == typeid(float)) return "float"; else if (typeid(T) == typeid(double)) return "double"; else if (typeid(T) == typeid(char)) return "char"; else if (typeid(T) == typeid(unsigned char)) return "unsigned_char"; else if (typeid(T) == typeid(short)) return "short"; else if (typeid(T) == typeid(unsigned short)) return "unsigned_short"; else if (typeid(T) == typeid(int)) return "int"; else if (typeid(T) == typeid(unsigned int)) return "unsigned_int"; else if (typeid(T) == typeid(long int)) return "long"; else if (typeid(T) == typeid(unsigned long int)) return "unsigned_long"; else if (typeid(T) == typeid(bool)) return "bit"; return ""; } /*! \brief Set a conversion map between A and B * * Convert A to B * * \tparam B destination type * \tparam A source type * */ template class convert { public: template static B to(const A & data) { return static_cast(data); } }; /*! \brief Partial specialization when A is a string * * */ template<> class convert { public: template static B to(const std::string & data) { return atof(data.c_str()); } }; /*! \brief It specify the VTK output file type * */ enum file_type { BINARY, ASCII }; #define GRAPH 1 #define VECTOR_BOX 2 #define VECTOR_GRIDS 3 #define VECTOR_ST_GRIDS 4 #define DIST_GRAPH 5 template class VTKWriter { }; #include "VTKWriter_graph.hpp" #include "VTKWriter_vector_box.hpp" #include "VTKWriter_grids.hpp" #include "VTKWriter_grids_st.hpp" #include "VTKWriter_dist_graph.hpp" #endif /* VTKWRITER_HPP_ */