OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
VTKWriter.hpp
1 /*
2  * VTKWriter.hpp
3  *
4  * Created on: Dec 15, 2014
5  * Author: Pietro Incardona
6  */
7 
8 #ifndef VTKWRITER_HPP_
9 #define VTKWRITER_HPP_
10 
11 #include "Graph/map_graph.hpp"
12 #include <iostream>
13 #include <boost/fusion/include/mpl.hpp>
14 #include <boost/fusion/include/for_each.hpp>
15 #include <fstream>
16 #include "util/common.hpp"
17 
24 template <typename T> std::string getType()
25 {
26  // Create a property string based on the type of the property
27  if (typeid(T) == typeid(float))
28  return "float";
29  else if (typeid(T) == typeid(double))
30  return "double";
31  else if (typeid(T) == typeid(char))
32  return "char";
33  else if (typeid(T) == typeid(unsigned char))
34  return "unsigned_char";
35  else if (typeid(T) == typeid(short))
36  return "short";
37  else if (typeid(T) == typeid(unsigned short))
38  return "unsigned_short";
39  else if (typeid(T) == typeid(int))
40  return "int";
41  else if (typeid(T) == typeid(unsigned int))
42  return "unsigned_int";
43  else if (typeid(T) == typeid(long int))
44  return "long";
45  else if (typeid(T) == typeid(unsigned long int))
46  return "unsigned_long";
47  else if (typeid(T) == typeid(bool))
48  return "bit";
49 
50  return "";
51 }
52 
62 template<typename A>
63 class convert
64 {
65 public:
66  template<typename B> static B to(const A & data)
67  {
68  return static_cast<B>(data);
69  }
70 };
71 
77 template<>
78 class convert<std::string>
79 {
80 public:
81  template<typename B> static B to(const std::string & data)
82  {
83  return atof(data.c_str());
84  }
85 };
86 
91 enum file_type
92 {
93  BINARY,
94  ASCII
95 };
96 
97 #define VTK_GRAPH 1
98 #define VECTOR_BOX 2
99 #define VECTOR_GRIDS 3
100 #define VECTOR_ST_GRIDS 4
101 #define DIST_GRAPH 5
102 #define VECTOR_POINTS 6
103 #define VTK_WRITER 0x10000
104 #define FORMAT_ASCII 0x0
105 #define FORMAT_BINARY 0x10000000
106 
107 template <typename Object, unsigned int imp>
109 {
110 
111 };
112 
113 #include "VTKWriter_graph.hpp"
114 #include "VTKWriter_vector_box.hpp"
115 #include "VTKWriter_grids.hpp"
116 #include "VTKWriter_grids_st.hpp"
117 #include "VTKWriter_dist_graph.hpp"
118 #include "VTKWriter_point_set.hpp"
119 
120 #endif /* VTKWRITER_HPP_ */
Set a conversion map between A and B.
Definition: VTKWriter.hpp:63