Particle Identification and Tracking
wrapper_o_hdf.h
Go to the documentation of this file.
1 //Copyright 2009 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 #ifndef WRAPPER_O_HDF
27 #define WRAPPER_O_HDF
28 
29 #include <string>
30 #include <vector>
31 #include <set>
32 
33 
34 #include "enum_utils.h"
35 #include "wrapper_o.h"
36 #include "data_map.h"
37 #include "part_def.h"
38 
39 
40 
41 namespace H5
42 {
43 class H5File;
44 class Group;
45 class DataSet;
46 }
47 
48 
49 namespace utilities{
50 class Wrapper_o_hdf_group;
51 class Md_store;
52 
57 public:
58  typedef enum FILE_T
59  {
64  }FILE_T;
65 
66 
67 
68 
69 
80  Wrapper_o_hdf(const std::string& file_name,
81  const std::set<D_TYPE>& d_add,
82  int comp_number,
83  Wrapper_o_hdf::FILE_T file_type,
84  const std::string & group_prefix="frame");
85 
86 
87  void initialize_wrapper();
88  void open_group(int,int,int);
89 
90 
91 
92  void set_all_values(const tracking::particle *);
93 #ifdef TRACKING_FLG
95 #endif
96  void set_value(D_TYPE,const tracking::particle *);
97 
98  void add_meta_store(const Md_store * md_in);
99 
100 
101  void close_group();
102  void finalize_wrapper();
103 
104  void print()const;
105  int num_entries()const{return 0;};
106 
107  const std::set<D_TYPE>& get_content_tpyes() const;
108 
109 
110 
111 
112 
113 
114 
115 
116  void add_meta_data(const std::string & key, float val);
117  void add_meta_data(const std::string & key, const Tuple<float,2> & val);
118  void add_meta_data(const std::string & key, const Tuple<float,3> & val);
119  void add_meta_data(const std::string & key, const std::string & val);
120  void add_meta_data(const std::string & key, int val);
121 
122 
123  void add_meta_data_root(const std::string & key, float val);
124  void add_meta_data_root(const std::string & key, const Tuple<float,2> & val);
125  void add_meta_data_root(const std::string & key, const Tuple<float,3> & val);
126  void add_meta_data_root(const std::string & key, const std::string & val);
127  void add_meta_data_root(const std::string & key, int val);
128 
129 
130  void add_meta_data_comp(const std::string & key, float val);
131  void add_meta_data_comp(const std::string & key, const Tuple<float,2> & val);
132  void add_meta_data_comp(const std::string & key, const Tuple<float,3> & val);
133  void add_meta_data_comp(const std::string & key, const std::string & val);
134  void add_meta_data_comp(const std::string & key, int val);
135 
136 
137  void add_meta_data(const std::string & key, float val,D_TYPE dset_type);
138  void add_meta_data(const std::string & key, const Tuple<float,2> & val,D_TYPE dset_type);
139  void add_meta_data(const std::string & key, const Tuple<float,3> & val,D_TYPE dset_type);
140  void add_meta_data(const std::string & key, const std::string & val,D_TYPE dset_type);
141  void add_meta_data(const std::string & key, int val,D_TYPE dset_type);
142 
143  void add_meta_data_list(const Read_config & , const std::set<D_TYPE> &);
144  ~Wrapper_o_hdf();
145 
146 private:
147 
150 
153 
158 
163 
168 
173 
177  H5::H5File * file_;
181  std::string file_name_;
185  std::string group_name_;
186 
190  std::set<D_TYPE> d_types_add_;
195  std::set<D_TYPE> d_types_check_;
196 
200  std::set<D_TYPE> d_types_already_;
201 
205  std::string group_prefix_;
206 
210  static const int format_padding_ = 6;
211 
212 
216  std::string format_name_(int in)const;
217 
222 
223 
228 
229 
230  H5::Group * dset_pram_group_;
231 
232 };
233 
234 }
235 
236 #endif