00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _eoParticleFullInitializer_H
00028 #define _eoParticleFullInitializer_H
00029
00030 #include <utils/eoRealVectorBounds.h>
00031 #include <eoVelocityInit.h>
00032 #include <eoPop.h>
00033 #include <eoParticleBestInit.h>
00034 #include <eoTopology.h>
00035
00036
00037
00038
00039
00040 template <class POT> class eoInitializerBase : public eoFunctorBase
00041 {
00042 public :
00043
00044 virtual ~eoInitializerBase()
00045 {}
00046
00047 virtual void operator()()
00048 {};
00049 };
00050
00056 template <class POT> class eoParticleInitializer : public eoInitializerBase <POT>
00057 {
00058 public:
00059
00065 eoParticleFullInitializer(
00066 eoUF<POT&, void>& _proc,
00067 eoVelocityInit < POT > &_initVelo,
00068 eoParticleBestInit <POT> &_initBest,
00069 eoTopology <POT> &_topology,
00070 eoPop < POT > &_pop
00071 ) : proc(_proc), procPara(dummyEval), initVelo(_initVelo), initBest(_initBest), topology(_topology), pop(_pop) {}
00072
00073
00079 eoParticleFullInitializer(
00080 eoPopEvalFunc <POT>& _proc,
00081 eoVelocityInit < POT > &_initVelo,
00082 eoParticleBestInit <POT> &_initBest,
00083 eoTopology <POT> &_topology,
00084 eoPop < POT > &_pop
00085 ) : proc(dummy), procPara(_proc), initVelo(_initVelo), initBest(_initBest), topology(_topology), pop(_pop)
00086 {}
00087
00088
00091 virtual std::string className (void) const
00092 {
00093 return "eoInitializer";
00094 }
00095
00096
00097
00098 virtual void operator () ()
00099 {
00100 eoPop<POT> empty_pop;
00101
00102
00103 apply(proc, pop);
00104
00105
00106 procPara(empty_pop, pop);
00107
00108
00109 apply < POT > (initVelo, pop);
00110 apply < POT > (initBest, pop);
00111
00112
00113 topology.setup(pop);
00114 }
00115
00116 private :
00117
00118
00119
00120
00121
00122
00123
00124 eoPop < POT > & pop;
00125 eoUF<POT&, void>& proc;
00126 eoPopEvalFunc <POT>& procPara;
00127 eoVelocityInit < POT > & initVelo;
00128 eoParticleBestInit <POT> & initBest;
00129 eoTopology <POT> & topology;
00130 class eoDummyEval : public eoPopEvalFunc<POT>
00131 {
00132 public:
00133 void operator()(eoPop<POT> &,eoPop<POT> &_pop)
00134 {}
00135 }
00136 dummyEval;
00137 class eoDummy : public eoUF<POT&, void>
00138 {
00139 public:
00140 void operator()(POT &)
00141 {}
00142
00143 }
00144 dummy;
00145 };
00146 #endif
00147
00148
00149