Free Electron
Splat.h
Go to the documentation of this file.
1 /** @file */
2 
3 #ifndef __solve_Splat_h__
4 #define __solve_Splat_h__
5 
6 namespace fe
7 {
8 namespace ext
9 {
10 
11 inline void zero(t_solve_real &a_value)
12 {
13  a_value = 0.0;
14 }
15 
16 inline void zero(t_solve_v2 &a_value)
17 {
18  a_value = t_solve_v2(0.0, 0.0);
19 }
20 
21 inline void zero(t_solve_v3 &a_value)
22 {
23  a_value = t_solve_v3(0.0, 0.0, 0.0);
24 }
25 
26 /// @brief N dimensional state buffer
27 template<typename T, unsigned int D>
28 class Splat : public Counted
29 {
30  public:
31  typedef Vector<D,int> t_index;
32  typedef t_solve_real t_span[D];
33 
34  class c_gradient
35  {
36  public:
37  c_gradient(void)
38  {
39  m_gradient.resize(D);
40  for(unsigned int d = 0; d < D; d++)
41  {
42  zero(m_gradient[d]);
43  }
44  }
45  std::vector<T> m_gradient;
46  };
47  typedef enum
48  {
49  e_pivot_none = -1,
50  e_pivot_within = 0,
51  e_pivot_under,
52  e_pivot_over,
53  e_pivot_count
54  } t_pivot_e;
55  typedef t_pivot_e t_pivot[D];
56  typedef c_gradient t_gradient;
57  typedef std::vector<t_gradient> t_gradients;
58  typedef std::vector<T> t_cells;
59  typedef std::vector<t_solve_real> t_mass;
60  struct t_bnd
61  {
62  Real m_lo;
63  Real m_hi;
64  };
65 
66  void setAll(t_span &a_span, t_solve_real a_value)
67  {
68  for(unsigned int d = 0; d < D; d++)
69  {
70  a_span[d] = a_value;
71  }
72  }
73 
74 
75  Splat(void)
76  {
77  setAll(m_root, 0.0);
78  setAll(m_scale, 1.0);
79  }
80 virtual ~Splat(void)
81  {
82  }
83  T sample(const typename Splat<T,D>::t_span &a_location);
84  void splat(const t_solve_real &a_mass, const typename Splat<T,D>::t_span &a_location, const T &a_value);
85  void unitSplat(const t_solve_real &a_mass, const typename Splat<T,D>::t_span &a_location, const T &a_value);
86  void massSplat(const t_solve_real &a_mass, const t_index &a_index, const T &a_value);
87  void gradientSplat(const t_solve_real &a_mass, const t_index &a_index, const T &a_value, const t_span &a_direction);
88  void rSplat(unsigned int a_d, typename Splat<T,D>::t_index &a_index, typename Splat<T,D>::t_index &a_lower, float a_mult, t_bnd *a_bnd, const t_solve_real &a_mass, const T &a_value);
89 
90  void create( const t_index &a_count,
91  const T &a_init);
92 
93  const T &get(const t_index &a_index) const;
94  const T &direct(const t_index &a_index) const;
95  const t_solve_real &getMass(const t_index &a_index) const;
96  void set(const t_index &a_index, const T &a_value);
97  void setMass(const t_index &a_index, const t_solve_real &a_value);
98 
99  void spanize(t_span &a_span, const t_index &a_index);
100  t_solve_real magnitude(const t_span &a_span);
101 
102  void blur(t_solve_real a_factor);
103  void fill(void);
104  void oldstrut(void);
105  void strut(void);
106  void gradient(void);
107  void fillSolve(unsigned int a_aspect);
108  void resplat(Splat<T,D> *a_other_splat);
109  void pull(Splat<T,D> *a_other_splat);
110  void push(Splat<T,D> *a_other_splat);
111  void clone(Splat<T,D> *a_other_splat);
112 
113  void setSpace( const t_span &a_lo, const t_span &a_hi);
114  class Functor
115  {
116  public:
117  virtual ~Functor(void) {}
118  virtual void process(Splat<T,D> &a_splat, t_index &a_index)
119  {
120  }
121  };
122  void iterate(Functor &a_functor);
123 
124  void dump(const char *a_filename);
125  void dbsave(const char *a_filename);
126  void dbload(const char *a_filename);
127  void location( t_span &a_location,
128  const t_index &a_index) const;
129 
130  public:
131  t_index m_count;
132  unsigned int m_totalCount;
133  t_cells m_cells;
134  t_mass m_mass;
135  t_span m_size;
136  t_span m_root;
137  t_span m_scale;
138  T m_init;
139  t_gradients m_gradients;
140  t_mass m_gradient_mass;
141 
142  void aspectFillSolve(unsigned int a_aspect);
143  unsigned int calc_array_index( const t_index &a_index) const;
144  bool safe( t_index &a_index) const;
145  t_span &safe( t_span &a_span) const;
146  bool safe( unsigned int a_d,
147  t_index &a_index) const;
148  void unit( t_span &a_unit_location, const t_span &a_location);
149  void pivot( t_pivot &a_pivot,
150  t_index &a_index,
151  const t_span &a_location) const;
152  const t_span &cellsize(void) const { return m_size; }
153 
154  const t_index &count(void) const { return m_count; }
155  private:
156  T &access(const t_index &a_index);
157  T rLinearSample(unsigned int a_d, typename Splat<T,D>::t_index &a_index, typename Splat<T,D>::t_index &a_lower, typename Splat<T,D>::t_pivot &a_pivot, float a_mult, t_bnd *a_bnd);
158  void rIterate(unsigned int a_d, t_index &a_index, Functor &a_functor);
159 
160  unsigned int totalCount(void) const { return m_totalCount; }
161  void index( t_index &a_index,
162  const t_span &a_location) const;
163 };
164 
165 template<typename T, unsigned int D>
166 void Splat<T,D>::splat(const t_solve_real &a_mass, const typename Splat<T,D>::t_span &a_location, const T &a_value)
167 {
168  t_bnd bnd[D];
169 
170  Splat<T,D>::t_span unit_location;
171  unit(unit_location, a_location);
172 
173  t_pivot i_pivot;
174  t_index i_lower;
175  pivot(i_pivot, i_lower, unit_location);
176 
177  for(unsigned int i = 0; i < D; i++)
178  {
179  if(i_pivot[i] == e_pivot_within)
180  {
181  bnd[i].m_lo = unit_location[i]/cellsize()[i] - (Real)i_lower[i];
182  bnd[i].m_hi = 1.0 - bnd[i].m_lo;
183  }
184  else if(i_pivot[i] == e_pivot_over)
185  {
186  //bnd[i].m_hi = 0.0;
187  //bnd[i].m_lo = 1.0;
188  return;
189  }
190  else if(i_pivot[i] == e_pivot_under)
191  {
192  //bnd[i].m_hi = 1.0;
193  //bnd[i].m_lo = 0.0;
194  return;
195  }
196  }
197 
198  Real r = 1.0;
199 
200  t_index index;
201  rSplat(D-1, index, i_lower, r, bnd, a_mass, a_value);
202 }
203 
204 template<typename T, unsigned int D>
205 void Splat<T,D>::unitSplat(const t_solve_real &a_mass, const typename Splat<T,D>::t_span &a_location, const T &a_value)
206 {
207  t_bnd bnd[D];
208 
209  t_pivot i_pivot;
210  t_index i_lower;
211  pivot(i_pivot, i_lower, a_location);
212 
213  for(unsigned int i = 0; i < D; i++)
214  {
215  if(i_pivot[i] == e_pivot_within)
216  {
217  bnd[i].m_lo = a_location[i]/cellsize()[i] - (Real)i_lower[i];
218  bnd[i].m_hi = 1.0 - bnd[i].m_lo;
219  }
220  else if(i_pivot[i] == e_pivot_over)
221  {
222  bnd[i].m_hi = 0.0;
223  bnd[i].m_lo = 1.0;
224  }
225  else if(i_pivot[i] == e_pivot_under)
226  {
227  bnd[i].m_hi = 1.0;
228  bnd[i].m_lo = 0.0;
229  }
230  }
231 
232  Real r = 1.0;
233 
234  t_index index;
235  rSplat(D-1, index, i_lower, r, bnd, a_mass, a_value);
236 }
237 
238 template<typename T, unsigned int D>
239 void Splat<T,D>::massSplat(const t_solve_real &a_mass, const t_index &a_index, const T &a_value)
240 {
241  if(a_mass < 1.0e-12) { return; }
242  t_index safe_index(a_index);
243  safe(safe_index);
244  unsigned int i = calc_array_index(safe_index);
245  t_solve_real sum = a_mass + m_mass[i];
246  m_cells[i] = (m_mass[i] / sum) * m_cells[i] + (a_mass / sum) * a_value;
247  m_mass[i] += a_mass;
248 }
249 
250 template<typename T, unsigned int D>
251 inline void Splat<T,D>::location(t_span &a_location, const t_index &a_index) const
252 {
253  for(unsigned int i = 0; i < D; i++)
254  {
255  a_location[i] = m_root[i] + (Real)a_index[i] * cellsize()[i] / m_scale[i];
256  }
257 }
258 
259 template<typename T, unsigned int D>
260 void Splat<T,D>::gradientSplat(const t_solve_real &a_mass, const t_index &a_index, const T &a_value, const t_span &a_unit_dir)
261 {
262  if(a_mass < 1.0e-12) { return; }
263 
264  t_index safe_index(a_index);
265  safe(safe_index);
266  unsigned int i_cell = calc_array_index(safe_index);
267  t_gradient &gradient = m_gradients[i_cell];
268 
269  t_solve_real sum = a_mass + m_gradient_mass[i_cell];
270  t_solve_real sum_ratio = a_mass / sum;
271  t_solve_real sum_m_ratio = m_gradient_mass[i_cell] / sum;
272  m_gradient_mass[i_cell] += a_mass;
273 
274  for(unsigned int d = 0; d < D; d++)
275  {
276  gradient.m_gradient[d] = sum_m_ratio * gradient.m_gradient[d] + sum_ratio * (a_value * a_unit_dir[d]);
277  }
278 }
279 
280 template<typename T, unsigned int D>
281 void Splat<T,D>::setSpace( const t_span &a_lo, const t_span &a_hi)
282 {
283  for(unsigned int d = 0; d < D; d++)
284  {
285  m_root[d] = a_lo[d];
286  m_scale[d] = 1.0 / (a_hi[d] - a_lo[d]);
287  }
288 }
289 
290 
291 template<typename T, unsigned int D>
292 void Splat<T,D>::unit( t_span &a_unit_location, const t_span &a_location)
293 {
294  for(unsigned int i = 0; i < D; i++)
295  {
296  a_unit_location[i] = (a_location[i] - m_root[i]) * m_scale[i];
297  }
298 }
299 
300 template<typename T, unsigned int D>
301 inline T &Splat<T,D>::access(const t_index &a_index)
302 {
303  return m_cells[calc_array_index(a_index)];
304 }
305 
306 template<typename T, unsigned int D>
307 inline void Splat<T,D>::index(t_index &a_index, const t_span &a_location) const
308 {
309  for(unsigned int i = 0; i < D; i++)
310  {
311  a_index[i] = (int)(a_location[i] / m_size[i]);
312  }
313 }
314 
315 template<typename T, unsigned int D>
316 inline void Splat<T,D>::pivot(t_pivot &a_pivot, t_index &a_index, const t_span &a_location) const
317 {
318  for(unsigned int i = 0; i < D; i++)
319  {
320  a_index[i] = (int)((a_location[i]) / m_size[i]);
321 
322  if((int)a_index[i] < 0)
323  {
324  a_pivot[i] = e_pivot_under;
325  a_index[i] = 0;
326  }
327  else if((int)a_index[i] >= (int)(m_count[i])-1)
328  {
329  a_pivot[i] = e_pivot_over;
330  a_index[i] = m_count[i]-1;
331  }
332  else
333  {
334  a_pivot[i] = e_pivot_within;
335  }
336  }
337 }
338 
339 template<typename T, unsigned int D>
340 inline void Splat<T,D>::spanize(t_span &a_span, const t_index &a_index)
341 {
342  for(unsigned int i = 0; i < D; i++)
343  {
344  a_span[i] = (Real)a_index[i] * cellsize()[i];
345  }
346 }
347 
348 template<typename T, unsigned int D>
349 inline t_solve_real Splat<T,D>::magnitude(const t_span &a_span)
350 {
351  t_solve_real m = 0.0;
352  for(unsigned int d = 0; d < D; d++)
353  {
354  m += a_span[d]*a_span[d];
355  }
356  return sqrt(m);
357 }
358 
359 template<typename T, unsigned int D>
360 void Splat<T,D>::rSplat(unsigned int a_d, typename Splat<T,D>::t_index &a_index, typename Splat<T,D>::t_index &a_lower, float a_mult, t_bnd *a_bnd, const t_solve_real &a_mass, const T &a_value)
361 {
362  Real m;
363  a_index[a_d] = a_lower[a_d];
364  safe(a_index);
365  m = a_bnd[a_d].m_hi * a_mult;
366  if(m > 0.0)
367  {
368  if(a_d == 0)
369  {
370  massSplat(m * a_mass, a_index, a_value);
371  }
372  else
373  {
374  rSplat(a_d-1, a_index, a_lower, m, a_bnd, a_mass, a_value);
375  }
376  }
377 
378  a_index[a_d] = a_lower[a_d] + 1;
379  safe(a_index);
380  m = a_bnd[a_d].m_lo * a_mult;
381  if(m > 0.0)
382  {
383  if(a_d == 0)
384  {
385  massSplat(m * a_mass, a_index, a_value);
386  }
387  else
388  {
389  rSplat(a_d-1, a_index, a_lower, m, a_bnd, a_mass, a_value);
390  }
391  }
392 }
393 
394 inline t_solve_real &value(t_solve_real &a_value, unsigned int a_aspect)
395 {
396  return a_value;
397 }
398 
399 inline t_solve_real &value(t_solve_v2 &a_value, unsigned int a_aspect)
400 {
401  return a_value[a_aspect];
402 }
403 
404 inline t_solve_real &value(t_solve_v3 &a_value, unsigned int a_aspect)
405 {
406  return a_value[a_aspect];
407 }
408 
409 template<typename T, unsigned int D>
410 T Splat<T,D>::rLinearSample(unsigned int a_d, typename Splat<T,D>::t_index &a_index, typename Splat<T,D>::t_index &a_lower, typename Splat<T,D>::t_pivot &a_pivot, float a_mult, t_bnd *a_bnd)
411 {
412  T accum;
413  zero(accum);
414 
415  bool ok = false;
416  Real m;
417  a_index[a_d] = a_lower[a_d];
418  ok = safe(a_index);
419  m = a_bnd[a_d].m_hi * a_mult;
420  //if(m > 0.0)
421  {
422  if(a_d == 0)
423  {
424  accum += m * direct(a_index);
425  }
426  else
427  {
428  accum += rLinearSample(a_d-1, a_index, a_lower, a_pivot, m, a_bnd);
429  }
430  }
431 
432 
433  a_index[a_d] = a_lower[a_d] + 1;
434  ok = safe(a_index);
435  m = a_bnd[a_d].m_lo * a_mult;
436 
437  //if(m > 0.0)
438  {
439  if(a_d == 0)
440  {
441  accum += m * direct(a_index);
442  }
443  else
444  {
445  accum += rLinearSample(a_d-1, a_index, a_lower, a_pivot, m, a_bnd);
446  }
447  }
448 
449  return accum;
450 }
451 
452 /** sample a Continuum by returning the a linear interpolated value.
453  @relates Continuum */
454 template<typename T, unsigned int D>
455 T Splat<T,D>::sample(const typename Splat<T,D>::t_span &a_location)
456 {
457  t_bnd bnd[D];
458 
459  Splat<T,D>::t_span unit_location;
460  unit(unit_location, a_location);
461 
462  t_pivot i_pivot;
463  t_index i_lower;
464  pivot(i_pivot, i_lower, unit_location);
465 
466  for(unsigned int i = 0; i < D; i++)
467  {
468  if(i_pivot[i] == e_pivot_within)
469  {
470  bnd[i].m_lo = unit_location[i]/cellsize()[i] - (Real)i_lower[i];
471  bnd[i].m_hi = 1.0 - bnd[i].m_lo;
472  }
473  else if(i_pivot[i] == e_pivot_over)
474  {
475  i_lower[i] -= 1;
476  bnd[i].m_hi = 1.0;
477  bnd[i].m_lo = 0.0;
478  }
479  else if(i_pivot[i] == e_pivot_under)
480  {
481  bnd[i].m_hi = 1.0;
482  bnd[i].m_lo = 0.0;
483  }
484  }
485 
486  Real r = 1.0;
487  t_index index;
488  return rLinearSample(D-1, index, i_lower, i_pivot, r, bnd);
489 }
490 
491 inline t_solve_v2 sample(Splat<t_solve_v2,3> &a_splat, const typename Splat<t_solve_v2,3>::t_span &a_location)
492 {
494  Splat<t_solve_v2,3>::t_span unit_location;
495  a_splat.unit(unit_location, a_location);
496 
499  a_splat.pivot(i_pivot, i_lower, unit_location);
500 
501  for(unsigned int i = 0; i < 3; i++)
502  {
503  if(i_pivot[i] == Splat<t_solve_v2,3>::e_pivot_within)
504  {
505  bnd[i].m_lo = unit_location[i]/a_splat.cellsize()[i] - (Real)i_lower[i];
506  bnd[i].m_hi = 1.0 - bnd[i].m_lo;
507  }
508  else if(i_pivot[i] == Splat<t_solve_v2,3>::e_pivot_over)
509  {
510  i_lower[i] -= 1;
511  bnd[i].m_hi = 1.0;
512  bnd[i].m_lo = 0.0;
513  }
514  else if(i_pivot[i] == Splat<t_solve_v2,3>::e_pivot_under)
515  {
516  bnd[i].m_hi = 1.0;
517  bnd[i].m_lo = 0.0;
518  }
519  }
520 
521  t_solve_v2 accum(0.0,0.0);
523  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1];i_sample[2]=i_lower[2];
524  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_hi * bnd[2].m_hi;
525 
526  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1];i_sample[2]=i_lower[2]+1;
527  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_hi * bnd[2].m_lo;
528 
529  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1]+1;i_sample[2]=i_lower[2]+1;
530  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_lo * bnd[2].m_lo;
531 
532  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1]+1;i_sample[2]=i_lower[2]+1;
533  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_lo * bnd[2].m_lo;
534 
535  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1]+1;i_sample[2]=i_lower[2];
536  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_lo * bnd[2].m_hi;
537 
538  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1];i_sample[2]=i_lower[2];
539  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_hi * bnd[2].m_hi;
540 
541  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1];i_sample[2]=i_lower[2]+1;
542  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_hi * bnd[2].m_lo;
543 
544  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1]+1;i_sample[2]=i_lower[2];
545  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_lo * bnd[2].m_hi;
546  return accum;
547 }
548 
549 inline t_solve_v2 sample(Splat<t_solve_v2,2> &a_splat, const typename Splat<t_solve_v2,2>::t_span &a_location)
550 {
552  Splat<t_solve_v2,2>::t_span unit_location;
553  a_splat.unit(unit_location, a_location);
554 
557  a_splat.pivot(i_pivot, i_lower, unit_location);
558 
559  for(unsigned int i = 0; i < 2; i++)
560  {
561  if(i_pivot[i] == Splat<t_solve_v2,2>::e_pivot_within)
562  {
563  bnd[i].m_hi = unit_location[i]/a_splat.cellsize()[i] - (Real)i_lower[i];
564  bnd[i].m_lo = 1.0 - bnd[i].m_hi;
565  }
566  else if(i_pivot[i] == Splat<t_solve_v2,2>::e_pivot_over)
567  {
568  i_lower[i] -= 1;
569  bnd[i].m_hi = 0.0;
570  bnd[i].m_lo = 1.0;
571  }
572  else if(i_pivot[i] == Splat<t_solve_v2,2>::e_pivot_under)
573  {
574  bnd[i].m_hi = 0.0;
575  bnd[i].m_lo = 1.0;
576  }
577  }
578 
579  t_solve_v2 accum(0.0,0.0);
581  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1];
582  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_lo;
583 
584  i_sample[0]=i_lower[0];i_sample[1]=i_lower[1]+1;
585  accum += a_splat.direct(i_sample) * bnd[0].m_lo * bnd[1].m_hi;
586 
587  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1]+1;
588  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_hi;
589 
590  i_sample[0]=i_lower[0]+1;i_sample[1]=i_lower[1];
591  accum += a_splat.direct(i_sample) * bnd[0].m_hi * bnd[1].m_lo;
592 
593  return accum;
594 }
595 
596 template<typename T, unsigned int D>
597 class SubFill : virtual public Splat<T,D>::Functor
598 {
599  public:
600  SubFill(typename Splat<T,D>::t_index &a_index, const T &a_value, t_solve_real a_mass, std::vector<t_solve_v2> *a_data)
601  {
602  m_index = a_index;
603  m_value = a_value;
604  m_mass = a_mass;
605  m_data = a_data;
606  }
607  virtual ~SubFill(void)
608  {
609  }
610  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
611  {
612  unsigned int i_cell = a_splat.calc_array_index(a_index);
613  t_solve_real sum = 0;
614  //t_solve_real axis_factor = 1.0;
615  //unsigned off_cnt = 0;
616  for(unsigned int i = 0; i < D; i++)
617  {
618  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
619  sum += a*a;
620  }
621  t_solve_real distance = sqrt(sum);
622  if(distance < (*m_data)[i_cell][0])
623  {
624  t_solve_real dial = 0.1;
625  if(a_splat.m_mass[i_cell] <= dial && m_mass > dial)
626  {
627  (*m_data)[i_cell][0] = distance;
628  a_splat.m_cells[i_cell] = m_value;
629  a_splat.m_mass[i_cell] = dial;
630  }
631  }
632  }
633  typename Splat<T,D>::t_index m_index;
634  T m_value;
635  std::vector<t_solve_v2> *m_data;
636  t_solve_real m_mass;
637 };
638 
639 template<typename T, unsigned int D>
640 class Fill : virtual public Splat<T,D>::Functor
641 {
642  public:
643  Fill(typename Splat<T,D>::t_cells *a_cells, typename Splat<T,D>::t_mass *a_mass)
644  {
645  m_src_cells = a_cells;
646  m_src_mass = a_mass;
647  m_data.resize(m_src_mass->size());
648  for(unsigned int i = 0; i < m_data.size(); i++)
649  {
650  m_data[i] = t_solve_v2(1.0e8,1.0e8);
651  }
652  }
653  virtual ~Fill(void)
654  {
655  }
656  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
657  {
658  unsigned int i_cell = a_splat.calc_array_index(a_index);
659  T &src_value = (*m_src_cells)[i_cell];
660  t_solve_real src_mass = (*m_src_mass)[i_cell];
661  SubFill<T,D> subfill(a_index, src_value, src_mass, &m_data);
662  a_splat.iterate(subfill);
663  }
664  typename Splat<T,D>::t_cells *m_src_cells;
665  typename Splat<T,D>::t_mass *m_src_mass;
666  std::vector<t_solve_v2> m_data;
667 };
668 
669 template<typename T, unsigned int D>
670 void Splat<T,D>::fill(void)
671 {
672  t_cells src_cells;
673  t_mass src_mass;
674  src_cells = m_cells;
675  src_mass = m_mass;
676 
677  Fill<T,D> fill(&src_cells, &src_mass);
678  iterate(fill);
679 }
680 
681 
682 template<typename T, unsigned int D>
683 class SubStrut : virtual public Splat<T,D>::Functor
684 {
685  public:
686  SubStrut(typename Splat<T,D>::t_index &a_index, const T &a_value, typename Splat<T,D>::t_mass *a_mass, std::vector<t_solve_v2> *a_data, typename Splat<T,D>::t_index *a_closest0, typename Splat<T,D>::t_index *a_closest1)
687  {
688  m_index = a_index;
689  m_value = a_value;
690  m_mass = a_mass;
691  m_data = a_data;
692  m_closest0 = a_closest0;
693  m_closest1 = a_closest1;
694  }
695  virtual ~SubStrut(void)
696  {
697  }
698  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
699  {
700  unsigned int i_cell = a_splat.calc_array_index(a_index);
701  t_solve_real sum = 0;
702  t_solve_real closest0 = 0;
703  t_solve_real closest1 = 0;
704  //t_solve_real axis_factor = 1.0;
705  //unsigned off_cnt = 0;
706  for(unsigned int i = 0; i < D; i++)
707  {
708  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
709  sum += a*a;
710 
711  a = (t_solve_real)((*m_closest0)[i] - m_index[i]) * a_splat.m_size[i];
712  closest0 += a*a;
713 
714  a = (t_solve_real)((*m_closest1)[i] - m_index[i]) * a_splat.m_size[i];
715  closest1 += a*a;
716  }
717 
718 
719  if((*m_mass)[i_cell] > 1.0e-6)
720  {
721  if(sum < closest0)
722  {
723  (*m_closest1) = (*m_closest0);
724  (*m_closest0) = a_index;
725 
726  sum = 0.0; closest0 = 0.0; closest1 = 0.0;
727  for(unsigned int i = 0; i < D; i++)
728  {
729  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
730  sum += a*a;
731  a = (t_solve_real)((*m_closest0)[i] - m_index[i]) * a_splat.m_size[i];
732  closest0 += a*a;
733  a = (t_solve_real)((*m_closest1)[i] - m_index[i]) * a_splat.m_size[i];
734  closest1 += a*a;
735  }
736  }
737  else if(sum < closest1)
738  {
739  (*m_closest1) = a_index;
740  sum = 0.0; closest0 = 0.0; closest1 = 0.0;
741  for(unsigned int i = 0; i < D; i++)
742  {
743  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
744  sum += a*a;
745  a = (t_solve_real)((*m_closest0)[i] - m_index[i]) * a_splat.m_size[i];
746  closest0 += a*a;
747  a = (t_solve_real)((*m_closest1)[i] - m_index[i]) * a_splat.m_size[i];
748  closest1 += a*a;
749  }
750  }
751  }
752  }
753  typename Splat<T,D>::t_index m_index;
754  T m_value;
755  std::vector<t_solve_v2> *m_data;
756  typename Splat<T,D>::t_mass *m_mass;
757  typename Splat<T,D>::t_index *m_closest0;
758  typename Splat<T,D>::t_index *m_closest1;
759 };
760 
761 template<typename T, unsigned int D>
762 class Closest : virtual public Splat<T,D>::Functor
763 {
764  public:
765  Closest(typename Splat<T,D>::t_index &a_index, const T &a_value, typename Splat<T,D>::t_mass *a_mass, std::vector<t_solve_v2> *a_data, typename Splat<T,D>::t_index *a_closest0)
766  {
767  m_index = a_index;
768  m_value = a_value;
769  m_mass = a_mass;
770  m_data = a_data;
771  m_closest0 = a_closest0;
772  }
773  virtual ~Closest(void)
774  {
775  }
776  void exclude(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
777  {
778  unsigned int i_cell = a_splat.calc_array_index(a_index);
779  m_exclude.push_back(i_cell);
780  }
781  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
782  {
783  unsigned int i_cell = a_splat.calc_array_index(a_index);
784  for(unsigned int i = 0; i < m_exclude.size(); i++)
785  {
786  if(i_cell == m_exclude[i])
787  {
788  return;
789  }
790  }
791  t_solve_real sum = 0;
792  t_solve_real closest0 = 0;
793  for(unsigned int i = 0; i < D; i++)
794  {
795  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
796  sum += a*a;
797 
798  a = (t_solve_real)((*m_closest0)[i] - m_index[i]) * a_splat.m_size[i];
799  closest0 += a*a;
800  }
801 
802 
803  if((*m_mass)[i_cell] > 1.0e-6)
804  {
805  if(sum < closest0)
806  {
807  (*m_closest0) = a_index;
808 
809  sum = 0.0; closest0 = 0.0;
810  for(unsigned int i = 0; i < D; i++)
811  {
812  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
813  sum += a*a;
814  a = (t_solve_real)((*m_closest0)[i] - m_index[i]) * a_splat.m_size[i];
815  closest0 += a*a;
816  }
817  }
818  }
819  }
820  typename Splat<T,D>::t_index m_index;
821  std::vector<unsigned int> m_exclude;
822  T m_value;
823  std::vector<t_solve_v2> *m_data;
824  typename Splat<T,D>::t_mass *m_mass;
825  typename Splat<T,D>::t_index *m_closest0;
826 };
827 
828 template<typename T, unsigned int D>
829 class ClosestMate : virtual public Splat<T,D>::Functor
830 {
831  public:
832  ClosestMate(typename Splat<T,D>::t_index &a_index, const T &a_value, typename Splat<T,D>::t_mass *a_mass, std::vector<t_solve_v2> *a_data, typename Splat<T,D>::t_index *a_closest, typename Splat<T,D>::t_index *a_closest_mate)
833  {
834  m_index = a_index;
835  m_value = a_value;
836  m_mass = a_mass;
837  m_data = a_data;
838  m_closest = a_closest;
839  m_closest_mate = a_closest_mate;
840  }
841  virtual ~ClosestMate(void)
842  {
843  }
844  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
845  {
846  unsigned int i_cell = a_splat.calc_array_index(a_index);
847 
848  typename Splat<T,D>::t_span M;
849  a_splat.spanize(M, (*m_closest) - m_index);
850  typename Splat<T,D>::t_span C;
851  a_splat.spanize(C, a_index - m_index);
852 
853  t_solve_real DOT = 0.0;
854  t_solve_real MM = 0.0;
855  t_solve_real CC = 0.0;
856  for(unsigned int d = 0; d < D; d++)
857  {
858  MM += M[d]*M[d];
859  CC += C[d]*C[d];
860  }
861  MM = sqrt(MM);
862  CC = sqrt(CC);
863 if(MM < 1.0e-8) { return; }
864 if(CC < 1.0e-8) { return; }
865 
866  for(unsigned int d = 0; d < D; d++)
867  {
868  DOT += M[d]/MM * C[d]/MM;
869  }
870 
871  if(DOT >= -1.0e-8) { return; }
872  //if(DOT >= 0.5) { return; }
873 
874  t_solve_real sum = 0;
875  t_solve_real closest_mate = 0;
876  for(unsigned int i = 0; i < D; i++)
877  {
878  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
879  sum += a*a;
880 
881  a = (t_solve_real)((*m_closest_mate)[i] - m_index[i]) * a_splat.m_size[i];
882  closest_mate += a*a;
883  }
884 
885 
886  if((*m_mass)[i_cell] > 1.0e-6)
887  {
888  if(sum < closest_mate)
889  {
890  (*m_closest_mate) = a_index;
891  }
892  }
893  }
894  typename Splat<T,D>::t_index m_index;
895  T m_value;
896  std::vector<t_solve_v2> *m_data;
897  typename Splat<T,D>::t_mass *m_mass;
898  typename Splat<T,D>::t_index *m_closest;
899  typename Splat<T,D>::t_index *m_closest_mate;
900 };
901 
902 template<typename T, unsigned int D>
903 class Strut : virtual public Splat<T,D>::Functor
904 {
905  public:
906  Strut(typename Splat<T,D>::t_cells *a_cells, typename Splat<T,D>::t_mass *a_mass)
907  {
908  m_src_cells = a_cells;
909  m_src_mass = a_mass;
910  m_data.resize(m_src_mass->size());
911  for(unsigned int i = 0; i < m_data.size(); i++)
912  {
913  m_data[i] = t_solve_v2(1.0e8,1.0e8);
914  }
915  }
916  virtual ~Strut(void)
917  {
918  }
919  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
920  {
921  unsigned int i_cell = a_splat.calc_array_index(a_index);
922  T &src_value = (*m_src_cells)[i_cell];
923  t_solve_real src_mass = (*m_src_mass)[i_cell];
924 #if 1
925 if(src_mass > 1.0e-8)
926 {
927  a_splat.set(a_index, src_value);
928  a_splat.setMass(a_index, 1.0);
929  return;
930 }
931 #endif
932 
933  for(unsigned int d = 0; d < D; d++)
934  {
935  m_closest0[d] = 1000;
936  m_closest1[d] = 1000;
937  m_closest2[d] = 1000;
938  m_closest0mate[d] = 1000;
939  m_closest1mate[d] = 1000;
940  m_closest2mate[d] = 1000;
941  }
942  //SubStrut<T,D> substrut(a_index, src_value, m_src_mass, &m_data, &m_closest0, &m_closest1);
943  //a_splat.iterate(substrut);
944 
945  {
946  Closest<T,D> closest(a_index, src_value, m_src_mass, &m_data, &m_closest0);
947  closest.exclude(a_splat, a_index);
948  a_splat.iterate(closest);
949  }
950  {
951  ClosestMate<T,D> closestmate(a_index, src_value, m_src_mass, &m_data, &m_closest0, &m_closest0mate);
952  a_splat.iterate(closestmate);
953  }
954 
955  {
956  Closest<T,D> closest(a_index, src_value, m_src_mass, &m_data, &m_closest1);
957  closest.exclude(a_splat, a_index);
958  closest.exclude(a_splat, m_closest0);
959  closest.exclude(a_splat, m_closest0mate);
960  a_splat.iterate(closest);
961  }
962 
963  if(m_closest0mate[0] != 1000)
964  {
965  ClosestMate<T,D> closestmate(a_index, src_value, m_src_mass, &m_data, &m_closest0mate, &m_closest1mate);
966  a_splat.iterate(closestmate);
967  }
968 
969 
970 
971 
972 
973 
974  {
975  Closest<T,D> closest(a_index, src_value, m_src_mass, &m_data, &m_closest2);
976  closest.exclude(a_splat, a_index);
977  closest.exclude(a_splat, m_closest0mate);
978  a_splat.iterate(closest);
979  }
980  if(m_closest2[0] != 1000)
981  {
982  ClosestMate<T,D> closestmate(a_index, src_value, m_src_mass, &m_data, &m_closest2, &m_closest2mate);
983  a_splat.iterate(closestmate);
984  }
985 
986 
987 
988  t_solve_real closest0 = 0;
989  t_solve_real closest1 = 0;
990  t_solve_real closest2 = 0;
991  t_solve_real closest0mate = 0;
992  t_solve_real closest1mate = 0;
993  t_solve_real closest2mate = 0;
994  for(unsigned int i = 0; i < D; i++)
995  {
996  t_solve_real a;
997  a = (t_solve_real)(m_closest0[i] - a_index[i]) * a_splat.m_size[i];
998  closest0 += a*a;
999 
1000  a = (t_solve_real)(m_closest1[i] - a_index[i]) * a_splat.m_size[i];
1001  closest1 += a*a;
1002 
1003  a = (t_solve_real)(m_closest2[i] - a_index[i]) * a_splat.m_size[i];
1004  closest2 += a*a;
1005 
1006  a = (t_solve_real)(m_closest0mate[i] - a_index[i]) * a_splat.m_size[i];
1007  closest0mate += a*a;
1008 
1009  a = (t_solve_real)(m_closest1mate[i] - a_index[i]) * a_splat.m_size[i];
1010  closest1mate += a*a;
1011 
1012  a = (t_solve_real)(m_closest2mate[i] - a_index[i]) * a_splat.m_size[i];
1013  closest2mate += a*a;
1014  }
1015 
1016  typename Splat<T,D>::t_span U;
1017  a_splat.spanize(U, m_closest1 - m_closest0);
1018  typename Splat<T,D>::t_span P;
1019  a_splat.spanize(P, a_index - m_closest0);
1020 
1021  //typename Splat<T,D>::t_span C0;
1022  //a_splat.spanize(C0, m_closest0);
1023  //typename Splat<T,D>::t_span C1;
1024  //a_splat.spanize(C1, m_closest1);
1025  typename Splat<T,D>::t_span AI;
1026  a_splat.spanize(AI, a_index);
1027 
1028  t_solve_real c0z = 0.0;
1029  t_solve_real L = 0.0;
1030  for(unsigned int d = 0; d < D; d++)
1031  {
1032  c0z += P[d]*P[d];
1033  L += U[d] * U[d];
1034  }
1035  c0z = sqrt(c0z);
1036  L = sqrt(L);
1037 
1038  L = 1.0 / L;
1039 
1040 #if 0
1041  t_solve_real DOT = 0.0;
1042  for(unsigned int d = 0; d < D; d++)
1043  {
1044  DOT += P[d] * U[d];
1045  }
1046  DOT *= L*L;
1047 #endif
1048 
1049  T c0 = (*m_src_cells)[a_splat.calc_array_index(m_closest0)];
1050  if(m_closest0mate[0] == 1000
1051  || m_closest1mate[0] == 1000 )
1052  {
1053  T G;
1054  zero(G);
1055  for(unsigned int d = 0; d < D; d++)
1056  {
1057  G = G + a_splat.m_gradients[a_splat.calc_array_index(m_closest0)].m_gradient[d] * P[d];
1058  }
1059  a_splat.set(a_index, c0 + G);
1060  //a_splat.set(a_index, c0);
1061  closest0 = sqrt(closest0);
1062  a_splat.setMass(a_index, 1.0-closest0);
1063  //a_splat.setMass(a_index, 0.01);
1064  }
1065  else
1066  {
1067  T c0m = (*m_src_cells)[a_splat.calc_array_index(m_closest0mate)];
1068  closest0 = sqrt(closest0);
1069  closest0mate = sqrt(closest0mate);
1070 
1071  T c1 = (*m_src_cells)[a_splat.calc_array_index(m_closest1)];
1072  T c1m = (*m_src_cells)[a_splat.calc_array_index(m_closest1mate)];
1073  closest1 = sqrt(closest1);
1074  closest1mate = sqrt(closest1mate);
1075 
1076  //T c2 = (*m_src_cells)[a_splat.calc_array_index(m_closest2)];
1077  //T c2m = (*m_src_cells)[a_splat.calc_array_index(m_closest2mate)];
1078  closest2 = sqrt(closest2);
1079  closest2mate = sqrt(closest2mate);
1080 #if 0
1081  T G0; zero(G0);
1082  T G1; zero(G1);
1083  for(unsigned int d = 0; d < D; d++)
1084  {
1085  G0 = G0 + a_splat.m_gradients[a_splat.calc_array_index(m_closest0)].m_gradient[d] * P[d];
1086  G1 = G1 + a_splat.m_gradients[a_splat.calc_array_index(m_closest1)].m_gradient[d] * P[d];
1087  }
1088 #endif
1089  t_solve_real w0 = closest0mate / (closest0 + closest0mate);
1090  t_solve_real w0m = 1.0 - w0;
1091  t_solve_real w1 = closest1mate / (closest1 + closest1mate);
1092  t_solve_real w1m = 1.0 - w1;
1093  //t_solve_real w2 = closest2mate / (closest2 + closest2mate);
1094  //t_solve_real w2m = 1.0 - w2;
1095 
1096  t_solve_real W0 = closest1 / (closest0 + closest1);
1097  t_solve_real W1 = 1.0 - W0;
1098 
1099  T C0 = w0*c0 + w0m*c0m;
1100  T C1 = w1*c1 + w1m*c1m;
1101 
1102  T C = W0*C0 + W1*C1;
1103 C = C0;
1104  a_splat.set(a_index, C);
1105  //a_splat.setMass(a_index, w0);
1106  a_splat.setMass(a_index, 1.0 - closest0);
1107 //fe_fprintf(stderr, "%g\n", w0);
1108  //a_splat.set(a_index, c0);
1109  //a_splat.set(a_index, w0*(c0 + G0) + w1*(c1 + G1));
1110  }
1111  }
1112  typename Splat<T,D>::t_cells *m_src_cells;
1113  typename Splat<T,D>::t_mass *m_src_mass;
1114  typename Splat<T,D>::t_index m_closest0;
1115  typename Splat<T,D>::t_index m_closest1;
1116  typename Splat<T,D>::t_index m_closest2;
1117  typename Splat<T,D>::t_index m_closest0mate;
1118  typename Splat<T,D>::t_index m_closest1mate;
1119  typename Splat<T,D>::t_index m_closest2mate;
1120  std::vector<t_solve_v2> m_data;
1121 };
1122 
1123 template<typename T, unsigned int D>
1124 void Splat<T,D>::strut(void)
1125 {
1126  t_cells src_cells;
1127  t_mass src_mass;
1128  src_cells = m_cells;
1129  src_mass = m_mass;
1130  for(unsigned int i = 0; i < m_cells.size(); i++)
1131  {
1132  m_cells[i] = m_init;
1133  m_mass[i] = 0.0;
1134  }
1135 
1136  Strut<T,D> strt(&src_cells, &src_mass);
1137  iterate(strt);
1138 }
1139 
1140 template<typename T, unsigned int D>
1141 class ReSplat : virtual public Splat<T,D>::Functor
1142 {
1143  public:
1144  ReSplat(Splat<T,D> *a_other_splat)
1145  {
1146  m_other_splat = a_other_splat;
1147  }
1148  virtual ~ReSplat(void)
1149  {
1150  }
1151  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1152  {
1153  typename Splat<T,D>::t_span span;
1154  a_splat.spanize(span, a_index);
1155  m_other_splat->unitSplat(1.0, span, a_splat.get(a_index));
1156  }
1157  Splat<T,D> *m_other_splat;
1158 };
1159 
1160 
1161 
1162 template<typename T, unsigned int D>
1163 void Splat<T,D>::resplat(Splat<T,D> *a_other_splat)
1164 {
1165  ReSplat<T,D> resplat(a_other_splat);
1166  iterate(resplat);
1167 }
1168 
1169 template<typename T, unsigned int D>
1170 class Pull : virtual public Splat<T,D>::Functor
1171 {
1172  public:
1173  Pull(Splat<T,D> *a_other_splat)
1174  {
1175  m_other_splat = a_other_splat;
1176  }
1177  virtual ~Pull(void)
1178  {
1179  }
1180  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1181  {
1182  typename Splat<T,D>::t_span span;
1183  a_splat.location(span, a_index);
1184  a_splat.splat(1.0, span, m_other_splat->sample(span));
1185  }
1186  Splat<T,D> *m_other_splat;
1187 };
1188 
1189 
1190 
1191 template<typename T, unsigned int D>
1192 void Splat<T,D>::pull(Splat<T,D> *a_other_splat)
1193 {
1194  Pull<T,D> p(a_other_splat);
1195  iterate(p);
1196 }
1197 
1198 template<typename T, unsigned int D>
1199 class Push : virtual public Splat<T,D>::Functor
1200 {
1201  public:
1202  Push(Splat<T,D> *a_other_splat)
1203  {
1204  m_other_splat = a_other_splat;
1205  }
1206  virtual ~Push(void)
1207  {
1208  }
1209  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1210  {
1211  typename Splat<T,D>::t_span span;
1212  a_splat.location(span, a_index);
1213 
1214  m_other_splat->splat(1.0, span, a_splat.sample(span));
1215  }
1216  Splat<T,D> *m_other_splat;
1217 };
1218 
1219 
1220 
1221 template<typename T, unsigned int D>
1222 void Splat<T,D>::push(Splat<T,D> *a_other_splat)
1223 {
1224  Push<T,D> p(a_other_splat);
1225  iterate(p);
1226 }
1227 
1228 template<typename T, unsigned int D>
1229 class SubGradient : virtual public Splat<T,D>::Functor
1230 {
1231  public:
1232  SubGradient(typename Splat<T,D>::t_index &a_index)
1233  {
1234  m_index = a_index;
1235  }
1236  virtual ~SubGradient(void)
1237  {
1238  }
1239  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1240  {
1241  unsigned int i_cell = a_splat.calc_array_index(a_index);
1242  unsigned int i_m_cell = a_splat.calc_array_index(m_index);
1243  typename Splat<T,D>::t_index Dindex = m_index-a_index;
1244  typename Splat<T,D>::t_span Dspan;
1245  a_splat.spanize(Dspan, Dindex);
1246  t_solve_real Dmagnitude = a_splat.magnitude(Dspan);
1247 
1248  if(i_cell == i_m_cell || Dmagnitude < 1.0e-8) { return; }
1249 
1250  typename Splat<T,D>::t_span Dunit;
1251  for(unsigned int d = 0; d < D; d++)
1252  {
1253  Dunit[d] = Dspan[d] / Dmagnitude;
1254  }
1255 
1256 
1257 
1258 
1259  T value_delta_per_distance = (a_splat.m_cells[i_m_cell] - a_splat.m_cells[i_cell]) / Dmagnitude;
1260 
1261  t_solve_real use_mass = a_splat.m_mass[i_m_cell] / Dmagnitude;
1262 //if(a_splat.m_mass[i_m_cell] > 1.0e-8) { use_mass = 1.0; }
1263 if(a_splat.m_mass[i_m_cell] > 1.0e-8) { use_mass = 1.0 / Dmagnitude; }
1264 else { return; }
1265 
1266  a_splat.gradientSplat(use_mass, a_index, value_delta_per_distance, Dunit);
1267  }
1268  typename Splat<T,D>::t_index m_index;
1269 };
1270 
1271 template<typename T, unsigned int D>
1272 class Gradient : virtual public Splat<T,D>::Functor
1273 {
1274  public:
1275  Gradient()
1276  {
1277  }
1278  virtual ~Gradient(void)
1279  {
1280  }
1281  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1282  {
1283  SubGradient<T,D> subgradient(a_index);
1284  a_splat.iterate(subgradient);
1285  }
1286 };
1287 
1288 template<typename T, unsigned int D>
1289 void Splat<T,D>::gradient(void)
1290 {
1291  Gradient<T,D> gradient_fn;
1292  iterate(gradient_fn);
1293 }
1294 
1295 
1296 template<typename T, unsigned int D>
1297 class ReApply : virtual public Splat<T,D>::Functor
1298 {
1299  public:
1300  ReApply(typename Splat<T,D>::t_span a_loc, const T &a_value, t_solve_real a_mass)
1301  {
1302  m_loc = a_loc;
1303  m_value = a_value;
1304  m_mass = a_mass;
1305  }
1306  virtual ~ReApply(void)
1307  {
1308  }
1309  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1310  {
1311  typename Splat<T,D>::t_span loc;
1312  a_splat.location(loc, a_index);
1313  t_solve_real sum = 0;
1314  for(unsigned int i = 0; i < D; i++)
1315  {
1316  t_solve_real a = (m_loc[i] - loc[i]) * a_splat.m_scale[i];
1317  sum += a*a;
1318  }
1319  //t_solve_real distance = sum;
1320  //t_solve_real use_mass = m_mass / (distance + 1.0e-8);
1321  a_splat.splat(m_mass, loc, m_value);
1322  }
1323  typename Splat<T,D>::t_span m_loc;
1324  T m_value;
1325  t_solve_real m_mass;
1326 };
1327 
1328 template<typename T, unsigned int D>
1329 class Blurt : virtual public Splat<T,D>::Functor
1330 {
1331  public:
1332  Blurt(typename Splat<T,D>::t_index &a_index, const T &a_value, t_solve_real a_mass, t_solve_real a_factor)
1333  {
1334  m_index = a_index;
1335  m_value = a_value;
1336  m_mass = a_mass;
1337  m_factor = a_factor;
1338  }
1339  virtual ~Blurt(void)
1340  {
1341  }
1342  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1343  {
1344  t_solve_real sum = 0;
1345  for(unsigned int i = 0; i < D; i++)
1346  {
1347  t_solve_real a = (t_solve_real)(m_index[i] - a_index[i]) * a_splat.m_size[i];
1348  sum += a*a;
1349  }
1350  t_solve_real d = fabs(sum);
1351  t_solve_real metric = m_factor / (m_factor + d);
1352  if(metric < 0.0) { metric = 0.0; }
1353  t_solve_real use_mass = 1.0 * m_mass * metric;
1354  a_splat.massSplat(use_mass, a_index, m_value);
1355  }
1356  typename Splat<T,D>::t_index m_index;
1357  T m_value;
1358  t_solve_real m_mass;
1359  t_solve_real m_factor;
1360 };
1361 
1362 template<typename T, unsigned int D>
1363 class Blurer : virtual public Splat<T,D>::Functor
1364 {
1365  public:
1366  Blurer(typename Splat<T,D>::t_cells *a_cells, typename Splat<T,D>::t_mass *a_mass, t_solve_real a_factor)
1367  {
1368  m_src_cells = a_cells;
1369  m_src_mass = a_mass;
1370  m_factor = a_factor;
1371  }
1372  virtual ~Blurer(void)
1373  {
1374  }
1375  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1376  {
1377  unsigned int i_cell = a_splat.calc_array_index(a_index);
1378  T &src_value = (*m_src_cells)[i_cell];
1379  t_solve_real src_mass = (*m_src_mass)[i_cell];
1380  {
1381  Blurt<T,D> blurt(a_index, src_value, src_mass, m_factor);
1382  a_splat.iterate(blurt);
1383  //ReApply<T,D> reapply(loc, src_value, src_mass);
1384  //a_splat.iterate(reapply);
1385  }
1386  //fe_fprintf(stderr, "%g\n", a_splat.get(a_index));
1387  //a_splat.splat(src_mass, loc, src_value);
1388  }
1389  typename Splat<T,D>::t_cells *m_src_cells;
1390  typename Splat<T,D>::t_mass *m_src_mass;
1391  t_solve_real m_factor;
1392 };
1393 
1394 template<typename T, unsigned int D>
1395 void Splat<T,D>::blur(t_solve_real a_factor)
1396 {
1397  t_cells src_cells;
1398  t_mass src_mass;
1399  src_cells = m_cells;
1400  src_mass = m_mass;
1401  for(unsigned int i = 0; i < m_cells.size(); i++)
1402  {
1403  //m_cells[i] = m_init;
1404  //m_mass[i] = 0.0;
1405  }
1406 
1407  Blurer<T,D> blurer(&src_cells, &src_mass, a_factor);
1408  iterate(blurer);
1409 }
1410 
1411 #if 0
1412 template<typename T, unsigned int D>
1413 class Connector : virtual public Splat<T,D>::Functor
1414 {
1415  public:
1416  Connector(sp<Scope> spScope, sp<RecordGroup> rg_fill, std::vector<Record> *r_ps, std::vector<Record> *r_cs, std::vector<Record> *r_ks)
1417  {
1418  m_spScope = spScope;
1419  m_rg_fill = rg_fill;
1420 
1421  m_asSolverParticle.bind(spScope);
1422  m_asParticle.bind(spScope);
1423  m_asColored.bind(spScope);
1424  m_asLinearSpring.bind(spScope);
1425 
1426  l_point = m_spScope->declare("l_point");
1427  m_asSolverParticle.populate(l_point);
1428  m_asParticle.populate(l_point);
1429  m_asColored.populate(l_point);
1430 
1431  l_link = m_spScope->declare("l_link");
1432  m_asLinearSpring.populate(l_link);
1433 
1434  m_pps = r_ps;
1435  m_pcs = r_cs;
1436  m_pks = r_ks;
1437  }
1438  virtual ~Connector(void)
1439  {
1440  }
1441  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1442  {
1443  for(unsigned int d = 0; d < D; d++)
1444  {
1445  if(a_index[d] < a_splat.m_count[d]-1)
1446  {
1447  unsigned int i_a = a_splat.calc_array_index(a_index);
1448  typename Splat<T,D>::t_index other_index;
1449  other_index = a_index;
1450  other_index[d] += 1;
1451  unsigned int i_b = a_splat.calc_array_index(other_index);
1452 
1453  Record r_link = m_spScope->createRecord(l_link);
1454  m_asLinearSpring.left(r_link) = (*m_pps)[i_a];
1455  m_asLinearSpring.right(r_link) = (*m_pps)[i_b];
1456  m_asLinearSpring.length(r_link) = 0.0;
1457  m_asLinearSpring.stiffness(r_link) = 1.0e4;
1458  m_asLinearSpring.damping(r_link) = 1.0e1;
1459  m_rg_fill->add(r_link);
1460  }
1461  }
1462  }
1463 
1464  std::vector<Record> *m_pps;
1465  std::vector<Record> *m_pcs;
1466  std::vector<Record> *m_pks;
1467  sp<Scope> m_spScope;
1468  sp<RecordGroup> m_rg_fill;
1469  AsSolverParticle1D m_asSolverParticle;
1470  AsParticle1D m_asParticle;
1471  AsColored m_asColored;
1472  AsLinearSpringExtended m_asLinearSpring;
1473  sp<Layout> l_point;
1474  sp<Layout> l_link;
1475 };
1476 
1477 
1478 template<typename T, unsigned int D>
1479 void Splat<T,D>::fillSolve(unsigned int a_aspect)
1480 {
1481  sp<SemiImplicit1D> spSemiImplicit;
1482  sp<Master> spMaster(FLEXI_NEW( gSTMBase.GetMemPool(), gSTMDebug.GetMemTrace(), MWL::Base::BDbgString("Splat") ) Master);
1483  sp<Registry> spRegistry=spMaster->registry();
1484  spRegistry->manage("fexCathedralDL");
1485  sp<Scope> spScope = spRegistry->create("Scope");
1486  assertMath(spMaster->typeMaster());
1487  spSemiImplicit = FLEXI_NEW( gSTMBase.GetMemPool(), gSTMDebug.GetMemTrace(), MWL::Base::BDbgString("Splat") ) SemiImplicit1D();
1488  spSemiImplicit->initialize(spScope);
1489 
1490  {
1491  sp<SemiImplicit1D::Force> spForce(FLEXI_NEW( gSTMBase.GetMemPool(), gSTMDebug.GetMemTrace(), MWL::Base::BDbgString("Splat") ) LinearSpringForce1D(spSemiImplicit));
1492  spSemiImplicit->addForce(spForce, true);
1493  }
1494 
1495  sp<RecordGroup> rg_fill;
1496  rg_fill = FLEXI_NEW( gSTMBase.GetMemPool(), gSTMDebug.GetMemTrace(), MWL::Base::BDbgString("SetaTireRig") ) RecordGroup();
1497 
1498  AsSolverParticle1D asSolverParticle;
1499  asSolverParticle.bind(spScope);
1500  AsParticle1D asParticle;
1501  asParticle.bind(spScope);
1502  AsForcePoint1D asForcePoint;
1503  asForcePoint.bind(spScope);
1504  AsColored asColored;
1505  asColored.bind(spScope);
1506 
1507  sp<Layout> l_point = spScope->declare("l_point");
1508  asSolverParticle.populate(l_point);
1509  asParticle.populate(l_point);
1510  asColored.populate(l_point);
1511 
1512  sp<Layout> l_constraint = spScope->declare("l_constraint");
1513  asForcePoint.populate(l_constraint);
1514  asColored.populate(l_constraint);
1515 
1516  AsLinearSpringExtended asLinearSpring;
1517  asLinearSpring.bind(spScope);
1518  sp<Layout> l_spring = spScope->declare("l_spring");
1519  asLinearSpring.populate(l_spring);
1520 
1521  std::vector<Record> r_ps;
1522  std::vector<Record> r_cs;
1523  std::vector<Record> r_ks;
1524  r_ps.resize(m_cells.size());
1525  r_cs.resize(m_cells.size());
1526  r_ks.resize(m_cells.size());
1527  for(unsigned int i = 0; i < m_cells.size(); i++)
1528  {
1529  r_ps[i] = spScope->createRecord(l_point);
1530  asParticle.mass(r_ps[i]) = 1.0;
1531  asParticle.location(r_ps[i]) = 0.0;
1532  asParticle.velocity(r_ps[i]) = 0.0;
1533  rg_fill->add(r_ps[i]);
1534 
1535  r_cs[i] = spScope->createRecord(l_constraint);
1536  asParticle.location(r_cs[i]) = value(m_cells[i], a_aspect);
1537  asParticle.velocity(r_cs[i]) = 0.0;
1538  rg_fill->add(r_cs[i]);
1539 
1540  r_ks[i] = spScope->createRecord(l_spring);
1541  asLinearSpring.left(r_ks[i]) = r_ps[i];
1542  asLinearSpring.right(r_ks[i]) = r_cs[i];
1543  asLinearSpring.length(r_ks[i]) = 0.0;
1544  asLinearSpring.stiffness(r_ks[i]) = 1.0e8 * m_mass[i];
1545  asLinearSpring.damping(r_ks[i]) = 1.0e2;
1546  rg_fill->add(r_ks[i]);
1547  }
1548 
1549  Connector<T,D> connector(spScope, rg_fill, &r_ps, &r_cs, &r_ks);
1550  iterate(connector);
1551 
1552  spSemiImplicit->compile(rg_fill);
1553  std::vector<SemiImplicit1D::Particle> &particles =
1554  spSemiImplicit->particles();
1555 
1556 
1557  t_solve_real dummy;
1558  for(unsigned int t = 0; t < 1000; t++)
1559  {
1560  spSemiImplicit->step(0.001, dummy);
1561  }
1562 
1563  for(unsigned int i = 0 ; i < r_ps.size(); i++)
1564  {
1565  unsigned int i_p = asSolverParticle.index(r_ps[i]);
1566  fe_fprintf(stderr, "%u %g\n", i_p, particles[i_p].m_location);
1567  value(m_cells[i], a_aspect) = particles[i_p].m_location;
1568  }
1569 }
1570 #endif
1571 
1572 template<typename T, unsigned int D>
1573 inline typename Splat<T,D>::t_span &Splat<T,D>::safe(
1574  t_span &a_span) const
1575 {
1576  for(unsigned int i = 0; i < D; i++)
1577  {
1578  if(a_span[i] < 0.0)
1579  {
1580  a_span[i] = 0.0;
1581  }
1582  else if(a_span[i] > 1.0)
1583  {
1584  a_span[i] = 1.0;
1585  }
1586  }
1587 
1588  return a_span;
1589 }
1590 
1591 template<typename T, unsigned int D>
1592 inline bool Splat<T,D>::safe(t_index &a_index) const
1593 {
1594  bool ok = true;
1595  for(unsigned int i = 0; i < D; i++)
1596  {
1597  if(!safe(i, a_index)) { ok = false; }
1598  }
1599  return ok;
1600 }
1601 
1602 template<typename T, unsigned int D>
1603 inline bool Splat<T,D>::safe(unsigned int a_d, t_index &a_index) const
1604 {
1605  // return true if the requested index is a valid index
1606  bool rv = true;
1607  if(m_count[a_d] == 1)
1608  {
1609  if(a_index[a_d] != 0)
1610  {
1611  rv = false;
1612  a_index[a_d] = 0;
1613  }
1614  }
1615  else if(m_count[a_d] == 2)
1616  {
1617  if(a_index[a_d] < 0)
1618  {
1619  rv = false;
1620  a_index[a_d] = 0;
1621  }
1622  else if(a_index[a_d] > 1)
1623  {
1624  rv = false;
1625  a_index[a_d] = 1;
1626  }
1627  }
1628  else
1629  {
1630  if(a_index[a_d] < 0)
1631  {
1632  rv = false;
1633  a_index[a_d] = 0;
1634  }
1635  else if(a_index[a_d] >= m_count[a_d])
1636  {
1637  rv = false;
1638  a_index[a_d] = m_count[a_d]-1;
1639  }
1640  }
1641 
1642  return rv;
1643 }
1644 
1645 template<typename T, unsigned int D>
1646 inline void Splat<T,D>::create(const t_index &a_count, const T &a_init)
1647 {
1648  m_totalCount = 1;
1649  for(unsigned int i = 0; i < D; i++)
1650  {
1651  m_count[i] = a_count[i];
1652  m_size[i] = 1.0/(m_count[i]-1);
1653  m_totalCount *= m_count[i];
1654  }
1655 
1656  m_init = a_init;
1657  m_cells.resize(m_totalCount, a_init);
1658  m_mass.resize(m_totalCount, 0.0);
1659  m_gradients.resize(m_totalCount);
1660  m_gradient_mass.resize(m_totalCount, 0.0);
1661  for(unsigned int i = 0; i < m_totalCount; i++)
1662  {
1663  for(unsigned int d = 0; d < D; d++)
1664  {
1665  zero(m_gradients[i].m_gradient[d]);
1666  }
1667  }
1668 }
1669 
1670 template<typename T, unsigned int D>
1671 void Splat<T,D>::clone(Splat<T,D> *a_other_splat)
1672 {
1673  m_totalCount = a_other_splat->m_totalCount;
1674  for(unsigned int i = 0; i < D; i++)
1675  {
1676  m_count[i] = a_other_splat->m_count[i];
1677  m_size[i] = a_other_splat->m_size[i];
1678  }
1679  m_init = a_other_splat->m_init;
1680  m_cells.resize(m_totalCount, m_init);
1681  //m_mass.resize(m_totalCount, 0.0);
1682  //m_gradients.resize(m_totalCount);
1683  //m_gradient_mass.resize(m_totalCount, 0.0);
1684  for(unsigned int i = 0; i < m_totalCount; i++)
1685  {
1686  for(unsigned int d = 0; d < D; d++)
1687  {
1688  //zero(m_gradients[i].m_gradient[d]);
1689  m_cells[i][d] = a_other_splat->m_cells[i][d];
1690  }
1691  }
1692  for(unsigned int d = 0; d < D; d++)
1693  {
1694  m_root[d] = a_other_splat->m_root[d];
1695  m_scale[d] = a_other_splat->m_scale[d];
1696  }
1697 }
1698 
1699 
1700 template<typename T, unsigned int D>
1701 inline const T &Splat<T,D>::get(const t_index &a_index) const
1702 {
1703  t_index safe_index(a_index);
1704  safe(safe_index);
1705  return m_cells[calc_array_index(safe_index)];
1706 }
1707 
1708 template<typename T, unsigned int D>
1709 inline const T &Splat<T,D>::direct(const t_index &a_index) const
1710 {
1711  //t_index safe_index(a_index);
1712  //safe(safe_index);
1713  //return m_cells[calc_array_index(safe_index)];
1714  return m_cells[calc_array_index(a_index)];
1715 }
1716 
1717 template<typename T, unsigned int D>
1718 inline const t_solve_real &Splat<T,D>::getMass(const t_index &a_index) const
1719 {
1720  t_index safe_index(a_index);
1721  safe(safe_index);
1722  return m_mass[calc_array_index(safe_index)];
1723 }
1724 
1725 template<typename T, unsigned int D>
1726 inline void Splat<T,D>::set(const t_index &a_index, const T &a_value)
1727 {
1728  t_index safe_index(a_index);
1729  safe(safe_index);
1730  m_cells[calc_array_index(safe_index)] = a_value;
1731 }
1732 
1733 template<typename T, unsigned int D>
1734 inline void Splat<T,D>::setMass(const t_index &a_index, const t_solve_real &a_value)
1735 {
1736  t_index safe_index(a_index);
1737  safe(safe_index);
1738  m_mass[calc_array_index(safe_index)] = a_value;
1739 }
1740 
1741 template<typename T, unsigned int D>
1742 inline unsigned int Splat<T,D>::calc_array_index(
1743  const t_index &a_index) const
1744 {
1745  unsigned int index = 0;
1746  unsigned int step = 1;
1747  for(int d = D-1; d >= 0; d--)
1748  {
1749  index += a_index[d] * step;
1750  step *= m_count[d];
1751  }
1752  return index;
1753 }
1754 
1755 template<typename T, unsigned int D>
1756 inline void Splat<T,D>::iterate(Functor &a_functor)
1757 {
1758  t_index index;
1759  rIterate(D-1, index, a_functor);
1760 }
1761 
1762 template<typename T, unsigned int D>
1763 inline void Splat<T,D>::rIterate(unsigned int a_d, t_index &a_index,
1764  Functor &a_functor)
1765 {
1766  for(int i = 0; i < count()[a_d]; i++)
1767  {
1768  a_index[a_d] = i;
1769  if(a_d == 0)
1770  {
1771  a_functor.process(*this, a_index);
1772  }
1773  else
1774  {
1775  rIterate(a_d-1, a_index, a_functor);
1776  }
1777  }
1778 }
1779 
1780 template<typename T, unsigned int D>
1781 class Dumper : virtual public Splat<T,D>::Functor
1782 {
1783  public:
1784  Dumper(const char *a_filename)
1785  {
1786  m_fp = fopen(a_filename, "w");
1787  }
1788  virtual ~Dumper(void)
1789  {
1790  fclose(m_fp);
1791  }
1792  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1793  {
1794  if(D <=2 || a_index[2] == 2)
1795  {
1796  //fe_fprintf(m_fp, "%g %g %g\n", (Real)(a_index[0]), (Real)(a_index[1]), a_splat.get(a_index)[1]);
1797  typename Splat<T,D>::t_span loc;
1798  a_splat.location(loc, a_index);
1799  fe_fprintf(m_fp, "%g %g %g\n", loc[0], loc[1], a_splat.get(a_index)[0]);
1800  //fe_fprintf(m_fp, "%g %g %g\n", (Real)(a_index[0]), (Real)(a_index[1]), a_splat.getMass(a_index));
1801  }
1802  }
1803 
1804  FILE *m_fp;
1805 };
1806 
1807 
1808 template<typename T, unsigned int D>
1809 inline void Splat<T,D>::dump(const char *a_filename)
1810 {
1811  Dumper<T,D> dumper(a_filename);
1812  iterate(dumper);
1813 }
1814 
1816 
1817 
1818 template<typename T, unsigned int D>
1819 class DBSaver : virtual public Splat<T,D>::Functor
1820 {
1821  public:
1822  DBSaver(const char *a_filename)
1823  {
1824  m_fp = fopen(a_filename, "w");
1825  }
1826  virtual ~DBSaver(void)
1827  {
1828  fclose(m_fp);
1829  }
1830  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1831  {
1832  fe_fprintf(m_fp, "%g %g ", a_splat.get(a_index)[0], a_splat.get(a_index)[1]);
1833  }
1834 
1835  FILE *m_fp;
1836 };
1837 
1838 
1839 template<typename T, unsigned int D>
1840 inline void Splat<T,D>::dbsave(const char *a_filename)
1841 {
1842  DBSaver<T,D> saver(a_filename);
1843  iterate(saver);
1844 }
1845 
1846 #if 0
1847 template<typename T, unsigned int D>
1848 class Saver : virtual public Splat<T,D>::Functor
1849 {
1850  public:
1851  Saver(Record &r_splat)
1852  {
1853  m_r_splat = r_splat;
1854  }
1855  virtual ~Saver(void)
1856  {
1857  }
1858  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1859  {
1860  }
1861 
1862  Record m_r_splat;
1863 };
1864 #endif
1865 
1866 #if 0
1867 inline void save(Splat<t_solve_v2,2> &a_splat, Record &r_splat)
1868 {
1869  AsSplat22 asSplat;
1870  sp<Scope> spScope = r_splat.layout()->scope();
1871 
1872  asSplat.bind(spScope);
1873 
1874  asSplat.count(r_splat) = Vector2i(a_splat.m_count[0], a_splat.m_count[1]);
1875 }
1876 #endif
1877 
1878 template<typename T, unsigned int D>
1879 class Loader : virtual public Splat<T,D>::Functor
1880 {
1881  public:
1882  Loader(const char *a_filename)
1883  {
1884  m_fp = fopen(a_filename, "r");
1885  }
1886  virtual ~Loader(void)
1887  {
1888  fclose(m_fp);
1889  }
1890  virtual void process(Splat<T,D> &a_splat, typename Splat<T,D>::t_index &a_index)
1891  {
1892  float f0,f1;
1893  fscanf(m_fp, "%g %g", &f0, &f1);
1894  a_splat.set(a_index, t_solve_v2(f0,f1));
1895  }
1896 
1897  FILE *m_fp;
1898 };
1899 
1900 
1901 #if 0
1902 Requires new state access methodology...back to tires first
1903 
1904 template<typename T, unsigned int D>
1905 inline void Splat<T,D>::dbload(const char *a_filename)
1906 {
1907  Loader<T,D> loader(a_filename);
1908  iterate(loader);
1909 }
1910 
1911 typedef Splat<t_solve_v3,2> t_image_splat;
1912 
1913 class TestCase
1914 {
1915  public:
1916  TestCase(sp<SetaTire> a_tire, const String &a_label, const String &a_testname, const String &a_id);
1917  TestCase(sp<TireManagerI> a_tm, const String &a_label, const String &a_testname, const String &a_id);
1918 virtual ~TestCase(void);
1919 virtual void run(void);
1920 virtual void runCase(void) = 0;
1921 
1922  void mark(t_tire_real a_x, t_tire_real a_y);
1923  void line(t_tire_real a_x, t_tire_real a_y);
1924  void newline(void);
1925  void annotate(t_tire_real a_x, t_tire_real a_y, const String &a_text);
1926  void annotate(t_tire_real a_x, t_tire_real a_y, t_tire_real a_value);
1927  void hilight(t_scalar_tire_data a_datum, t_tire_real a_center, t_tire_real a_falloff, t_tire_v3 a_color);
1928  void hline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color, const String &a_text);
1929  void hline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color, t_tire_real a_value);
1930  void hline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color);
1931  void vline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color, const String &a_text);
1932  void vline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color, t_tire_real a_value);
1933  void vline(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color);
1934  void bar(t_tire_real a_x, t_tire_real a_y, const t_tire_v3 &a_color);
1935  void image(const char *a_filename);
1936  void dumpVis(void);
1937 
1938  const String &testname(void) { return m_testname; }
1939  const String &id(void) { return m_id; }
1940 
1941  class Hilight
1942  {
1943  public:
1944  Hilight(t_scalar_tire_data a_datum, t_tire_real a_center, t_tire_real a_falloff, t_tire_v3 a_color)
1945  {
1946  m_datum = a_datum;
1947  m_color = a_color;
1948  m_center = a_center;
1949  m_falloff = a_falloff;
1950  };
1951  t_scalar_tire_data m_datum;
1952  t_tire_v3 m_color;
1953  t_tire_real m_center;
1954  t_tire_real m_falloff;
1955  };
1956 
1957  class Annotation
1958  {
1959  public:
1960  Annotation(t_tire_real a_x, t_tire_real a_y, const String &a_text) :
1961  m_x(a_x), m_y(a_y), m_text(a_text) {}
1962  t_tire_real m_x;
1963  t_tire_real m_y;
1964  String m_text;
1965  };
1966  protected:
1967  sp<SetaTire> m_spTire;
1968  t_image_splat m_splat;
1969  SetaTireRig m_rig;
1970  t_stdvector< Hilight > m_hilights;
1971  String m_label;
1972  String m_testname;
1973  String m_id;
1974  t_stdvector< Annotation > m_annotations;
1975  bool m_line_started;
1976  t_image_splat::t_span m_loc;
1977  t_tire_v3 m_default_color;
1978  String m_data_path;
1979  unsigned int m_frame;
1980 };
1981 #endif
1982 
1983 
1984 } /* namespace ext */
1985 } /* namespace fe */
1986 
1987 
1988 #endif /* __solve_Splat_h__ */
1989 
1990 
N dimensional state buffer.
Definition: Splat.h:28
A heterogenous collection of records.
Definition: RecordGroup.h:35
virtual void add(const Record &record)
Add record to the collection.
Definition: RecordGroup.cc:77
Heap-based support for classes participating in fe::ptr <>
Definition: Counted.h:35
Accessor< Real > mass
mass
Definition: shapeAS.h:124
kernel
Definition: namespace.dox:3
sp< Layout > declare(const String &name)
Declare a new layout.
Definition: Scope.cc:434
sp< Layout > layout(void) const
Return the Layout.
Definition: RecordSB.h:189
force application point
Definition: shapeAS.h:98
Semi Implicit time integration.
Definition: SemiImplicit1D.h:154
sp< Component > create(const String &a_pattern, BWORD quiet=FALSE) const
Instantiate a Component of the given named implementation.
Definition: Registry.cc:628
Automatically reference-counted string container.
Definition: String.h:128
Result manage(const String &filename, bool adaptname=true, bool manageDependencies=true)
Register the factories in the named dynamic library.
Definition: Registry.cc:363
Definition: googletest-output-test_.cc:505
Reference to an instance of a Layout.
Definition: RecordSB.h:35
particle in physical space
Definition: shapeAS.h:114
Central access point for key pseudo-global objects.
Definition: Master.h:21
Record createRecord(sp< Layout > spLayout)
Create and return a new Record of layout spLayout.
Definition: Scope.cc:703