~esys-p-dev/esys-particle/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __STDCOMPONENTFIELD_H
#define __STDCOMPONENTFIELD_H

// -- project includes --
#include "Field.h"
#include "vec3.h"

template <class T> class ParalllelParticleArray;

/*!
  \class TStdComponentField
  \brief Abstract base class for "standard" component fields, i.e. one componen of a vector value per particle

  \author  Steffen Abe
  $Revision$
  $Date$
*/
template <class T>
class TStdComponentField : public AField
{
 protected:
  ParallelParticleArray<T> *m_ppa_ptr; //!< pointer to the parallel particle array
  Vec3 (T::*m_accessFn)()const; //!< particle field value access function
  vector<pair<int,Vec3> > m_field_values;
  int m_component;

 public:
  TStdComponentField(ParallelParticleArray<T>*,Vec3 (T::*)()const,int);
  virtual bool isScalar()const{return true;};
  virtual bool isVector()const{return false;};
  virtual void updateFieldValues();
  virtual int getSize()const;
  virtual int idx(int)const;
  virtual double operator()(int,int component=0)const;
};

#include "StdComponentField.hpp"

#endif //__STDCOMPONENTFIELD_H