OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
24template <typename T> std::string getType()
25{
26 // Create a property string based on the type of the property
27 if (std::is_same<T,float>::value)
28 return "float";
29 else if (std::is_same<T,double>::value)
30 return "double";
31 else if (std::is_same<T,char>::value)
32 return "char";
33 else if (std::is_same<T,unsigned char>::value)
34 return "unsigned_char";
35 else if (std::is_same<T,short>::value)
36 return "short";
37 else if (std::is_same<T,unsigned short>::value)
38 return "unsigned_short";
39 else if (std::is_same<T,int>::value)
40 return "int";
41 else if (std::is_same<T,unsigned int>::value)
42 return "unsigned_int";
43 else if (std::is_same<T,long int>::value)
44 return "int";
45 else if (std::is_same<T,unsigned long int>::value )
46 return "unsigned_int";
47 else if (std::is_same<T,bool>::value )
48 return "bit";
49
50 return "";
51}
52
53
54
61template <typename T> std::string getTypeNew()
62{
63 // Create a property string based on the type of the property
64 if (std::is_same<T,float>::value)
65 return "Float32";
66 else if (std::is_same<T,double>::value)
67 return "Float64";
68 else if (std::is_same<T,char>::value)
69 return "Int8";
70 else if (std::is_same<T,unsigned char>::value)
71 return "UInt8";
72 else if (std::is_same<T,short>::value)
73 return "Int16";
74 else if (std::is_same<T,unsigned short>::value)
75 return "UInt16";
76 else if (std::is_same<T,int>::value)
77 return "Int32";
78 else if (std::is_same<T,unsigned int>::value)
79 return "UInt32";
80 else if (std::is_same<T,long int>::value)
81 return "Int64";
82 else if (std::is_same<T,unsigned long int>::value )
83 return "UInt64";
84 else if (std::is_same<T,bool>::value )
85 return "Int8";
86
87 return "";
88}
89
99template<typename A>
101{
102public:
103 template<typename B> static B to(const A & data)
104 {
105 return static_cast<B>(data);
106 }
107};
108
114template<>
115class convert<std::string>
116{
117public:
118 template<typename B> static B to(const std::string & data)
119 {
120 return atof(data.c_str());
121 }
122};
123
128enum file_type
129{
130 BINARY,
131 ASCII
132};
133
134#define VTK_GRAPH 1
135#define VECTOR_BOX 2
136#define VECTOR_GRIDS 3
137#define VECTOR_ST_GRIDS 4
138#define DIST_GRAPH 5
139#define VECTOR_POINTS 6
140#define VTK_WRITER 0x10000
141#define FORMAT_ASCII 0x0
142#define FORMAT_BINARY 0x10000000
143#define PRINT_GHOST 1
144
145template <typename Object, unsigned int imp>
147{
148
149};
150
151#include "VTKWriter_graph.hpp"
152#include "VTKWriter_vector_box.hpp"
153#include "VTKWriter_grids.hpp"
154#include "VTKWriter_grids_st.hpp"
155
156// This is only active if MPI compiler work
157
158#ifndef DISABLE_MPI_WRITTERS
159#include "VTKWriter_dist_graph.hpp"
160#endif
161
162#include "VTKWriter_point_set.hpp"
163
164#endif /* VTKWRITER_HPP_ */
Set a conversion map between A and B.