Particle Identification and Tracking
particle_base.h
Go to the documentation of this file.
1 //Copyright 2008-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 //standard incldues
26 
27 #ifndef PARTICLE_BASE
28 #define PARTICLE_BASE
29 #include <vector>
30 #include <iostream>
31 #include <set>
32 
33 
34 #include <complex>
35 
36 //local includes
37 #include "part_def.h"
38 
39 
40 
41 #include "enum_utils.h"
42 
43 
44 namespace utilities
45 {
46 class Wrapper_in;
47 }
48 
49 namespace tracking{
50 
51 
52 
63 
64 public:
65 
67  //clean this up/use inline intilization
68  // particle_base(Wrapper_in * i_data, Wrapper_out* o_out,
69  // int i_ind);
70 
75  particle_base(int i_ind,int frame=0);
76 
80  particle_base(int ind, utilities::Tuplef pos,int frame = 0);
81 
82 
86  particle_base(const particle_base &p);
87 
88 
89 
92 
93 
94  //A program generated global unique id, useful for tracking, comparing
95  //particles and that sort of thing that does not depends on
96  //properly parsing the data or the data being handed in behaving in
97  //any sort of nice way, but this does mean that the particle
98  //objects just got 32bits bigger
99  //int unq_id_;
100 
102  void print() const;
103 
104 
111  float get_value(utilities::D_TYPE type,float & val ) const;
118  int get_value(utilities::D_TYPE type,int &val ) const;
125  std::complex<float> get_value(utilities::D_TYPE type,std::complex<float>& val) const;
126 
127 
134  template <class T>
135  T get_wrapper_value(utilities::D_TYPE type,T & val) const;
136 
141  return position_;}
145  int get_ind()const
146  {
147  return ind_;
148  }
152  int get_frame()const
153  {
154  return frame_;
155  }
156 
160  float distancesq(const particle_base* part_in) const;
161 
162 
166  const utilities::Tuplef get_disp(const particle_base * part_in)const;
167 
168 
173  float get_r(const utilities::Tuplef & origin) const;
178  float get_theta(const utilities::Tuplef & origin) const;
179 
180 
184  void sort_neighborhood();
185 
190  bool no_neighborhood_repeats()const;
191 
196  bool add_to_neighborhood(const particle* in);
200  static float get_max_range()
201  {
203 
204  }
205 
206 
211  void fill_phi_6();
219  std::complex<float> compute_phi_6()const;
220 
224  std::complex<float> get_scaler_order_pram()const
225  {
226  return s_order_parameter_;
227  }
232  unsigned int get_neighborhood_size()const
233  {
234  return neighborhood_.size();
235  }
239  const std::vector<const particle*> get_neighborhood() const
240  {
241  return neighborhood_;
242  }
243 
244 
245 
246 
250  static void intialize_wrapper_in(const utilities::Wrapper_in* in);
251 
255  static void clear_wrapper_in();
256 
261  static void set_neighborhood_range(float in)
262  {
264  }
268  static float get_neighborhood_range()
269  {
271  }
272 
273 
274 
275 protected:
276  //A running total of all particles created
277  //static int running_total_;
280 
281 
283  int ind_;
284 
291 
295  int frame_;
296 
297 
302  std::vector<const particle*> neighborhood_;
303 
308 
312  std::complex<float> s_order_parameter_;
313 
314 
315 
316 private:
321  void fill_position();
325  void priv_init();
326 
333  bool lthan(const particle_base* a,const particle_base* b)const;
334 
335 
336 };
337 }
338 #endif
339 
340 
341 /*
342 #ifndef PARTICLE_NEI
343 #define PARTICLE_NEI
344 
345 
346 
347  Class for particles that carry around with them their neighbor
348  information. Implements this list as a vector, this is just here
349  so I don't forget I planned this and try to re implement it a
350  different way.
351 
352 class particle_neighbor : public particle_track{
353 protected:
354  vector <particle_neighbor*> neighbors;
355 public:
356  //getter, setter, etc functions
357 };
358 
359 
360 #endif
361 */