Particle Identification and Tracking
wrapper_o_hdf_group.h
Go to the documentation of this file.
1 //Copyright 2010 Thomas A Caswell
2 //tcaswell@uchicago.edu
3 //http://jfi.uchicago.edu/~tcaswell
4 //
5 //This program is free software; you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation; either version 3 of the License, or (at
8 //your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful, but
11 //WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //General Public License for more details.
14 //
15 //You should have received a copy of the GNU General Public License
16 //along with this program; if not, see <http://www.gnu.org/licenses>.
17 //
18 //Additional permission under GNU GPL version 3 section 7
19 //
20 //If you modify this Program, or any covered work, by linking or
21 //combining it with MATLAB (or a modified version of that library),
22 //containing parts covered by the terms of MATLAB User License, the
23 //licensors of this Program grant you additional permission to convey
24 //the resulting work.
25 
26 
27 #ifndef WRAPPER_O_HDF_GRP
28 #define WRAPPER_O_HDF_GRP
29 
30 
31 #include <string>
32 #include <vector>
33 #include <set>
34 
35 
36 #include "part_def.h"
37 #include "data_map.h"
38 
39 
40 
41 
42 
43 
44 namespace H5
45 {
46 class H5File;
47 class Group;
48 class DataSet;
49 class CommonFG;
50 
51 }
52 
53 
54 namespace utilities{
55 class Md_store;
56 
61 
62 public:
63  typedef enum GROUP_T
64  {
65  ERROR = -1,
69  }GROUP_T;
70 
71 
76  static const int format_padding;
77 
89  Wrapper_o_hdf_group(H5::CommonFG * parent, const std::string & g_name,
90  std::set<D_TYPE> dset,
91  int p_count,
92  int size,
93  int comp_num,
94  GROUP_T type);
95 
96 
97 
101  void write_to_disk();
102 
103 
107  void store_particle(const tracking::particle *);
108 
112  void store_particle_pos(const utilities::Tuple<float,3> & cord,float I);
113 
114 
115 
116 
117  // group level
121  bool contains_meta(const std::string & key);
122 
126  template <class T>
127  void set_meta_data(const std::string & key, const T & val);
128 
132  template <class T>
133  T get_meta_data(const std::string & key, T & val) const ;
134 
138  void add_meta_store(const Md_store * md_in);
139 
140 
141  // data set level
145  bool contains_meta(const std::string & key,D_TYPE dtype);
146 
150  template <class T>
151  void set_meta_data(const std::string & key, const T & val, D_TYPE dtype);
155  template <class T>
156  T get_meta_data(const std::string & key, T & val, D_TYPE dtype) ;
157 
162 
163 private:
167  H5::CommonFG * parent_;
168 
172  H5::Group * group_;
173 
177  std::vector<H5::DataSet * > dsets_;
178 
179 
184 
185 
190 
195  int p_count_;
196 
197 
203  int size_;
204 
209 
214 
218  std::set<D_TYPE> d_types_add_;
219 
220 
224  typedef struct complex_t
225  {
226  float re;
227  float im;
228  } complex_t;
229 
233  std::vector<float *> float_data_;
234 
239 
240 
244  std::vector<int *> int_data_;
245 
250 
251 
255  std::vector<complex_t *> complex_data_;
256 
261 
262 
267  static const int csize_;
268 
269 };
270 
271 
272 
273 
274 
275 
276 }
277 
278 #endif