00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _EOVECTORPARTICLE_H
00012 #define _EOVECTORPARTICLE_H
00013
00014 #include <PO.h>
00015
00021 template < class FitT, class PositionType, class VelocityType > class eoVectorParticle:public PO < FitT >,
00022 public std::vector <
00023 PositionType >
00024 {
00025
00026 public:
00027
00028 using PO < FitT >::invalidate;
00029 using
00030 std::vector <
00031 PositionType >::operator[];
00032 using
00033 std::vector <
00034 PositionType >::begin;
00035 using
00036 std::vector <
00037 PositionType >::end;
00038 using
00039 std::vector <
00040 PositionType >::size;
00041
00042 typedef
00043 PositionType
00044 AtomType;
00045 typedef
00046 VelocityType
00047 ParticleVelocityType;
00048
00055 eoVectorParticle (unsigned _size = 0,PositionType position = PositionType (), VelocityType velocity = VelocityType (), PositionType bestPositions = PositionType ()):PO < FitT > (),std::vector < PositionType > (_size, position), bestPositions (_size, bestPositions), velocities (_size,
00056 velocity)
00057 {
00058 }
00059
00060
00061
00062
00063 void
00064 position (const std::vector < PositionType > &_v)
00065 {
00066 if (_v.size () != size ())
00067 {
00068 if (size ())
00069 std::
00070 cout <<
00071 "Warning: Changing position size in eoVectorParticle assignation"
00072 << std::endl;
00073 resize (_v.size ());
00074 }
00075
00076 std::copy (_v.begin (), _v.end (), begin ());
00077 invalidate ();
00078 }
00079
00083 void
00084 resize (unsigned _size)
00085 {
00086 std::vector < PositionType >::resize (_size);
00087 bestPositions.resize (_size);
00088 velocities.resize (_size);
00089 }
00090
00091
00095 void
00096 resizeBestPositions (unsigned _size)
00097 {
00098 bestPositions.resize (_size);
00099 }
00100
00101
00105 void
00106 resizeVelocities (unsigned _size)
00107 {
00108 velocities.resize (_size);
00109 }
00110
00111
00112
00113 std::vector < PositionType > bestPositions;
00114 std::vector < ParticleVelocityType > velocities;
00115
00116 };
00117
00118 #endif