00001 #ifndef FLOWVIS_DATA_H 00002 #define FLOWVIS_DATA_H 00003 00004 #include "vec3.h" 00005 00006 #include <glew.h> 00007 00008 #include <vector> 00009 #include <string> 00010 00013 typedef std::vector<std::vector<vec3> > Grid_T; 00014 typedef std::vector<std::vector<float> > DataVec_T; 00015 typedef std::vector<std::vector<vec3> > VelocityVec_T; 00016 typedef std::vector<GLfloat> VertexData_T; 00017 typedef std::vector<GLfloat> ColorData_T; 00018 typedef std::vector<GLuint> IndexData_T; 00020 00022 struct Time_S 00023 { 00025 VelocityVec_T velocity; 00026 00028 std::vector<DataVec_T> data; 00029 }; 00030 00032 typedef std::vector<Time_S> TimeVec_T; 00033 00035 class FlowVisData 00036 { 00037 public: 00039 FlowVisData(); 00040 00042 ~FlowVisData() { } 00043 00045 void LoadFromFile(const char *filename); 00046 00048 VertexData_T GetVertexData(); 00049 00052 ColorData_T GetColorData(int time, int dataset); 00053 00055 IndexData_T GetIndexData(); 00056 00058 void NormalizeVelocity(); 00059 00061 int GetWidth() { return m_x; } 00063 int GetHeight() { return m_y; }; 00064 00065 vec3 m_grid_min; 00066 vec3 m_grid_max; 00067 00068 vec3 m_grid_cell_min; 00069 00070 float m_grid_cell_min_x; 00071 float m_grid_cell_min_y; 00072 00073 std::vector<float> m_data_min; 00074 std::vector<float> m_data_max; 00075 00077 int GetNrSets() { return m_sets; } 00078 00080 vec3 GetVelocityAt(const float x, const float y); 00081 00083 float m_max_velocity_length; 00084 00085 private: 00087 void LoadGrid(const char*filename); 00088 00090 void LoadData(const char*filename, int time_index); 00091 00093 void BuildGridLookup(); 00094 00096 Grid_T m_grid; 00098 int m_x; 00100 int m_y; 00102 int m_z; 00104 int m_sets; 00106 int m_timestamps; 00108 float m_interval; 00109 00111 std::vector<float> m_grid_x; 00112 00114 std::vector<float> m_grid_y; 00115 00117 bool m_swaped; 00118 00120 TimeVec_T m_time; 00121 }; 00122 00123 #endif // FLOWVIS_DATA_H