Separating parameters of store's default constructor of job parameters in eoParallelPopEval.

This commit is contained in:
Benjamin Bouvier 2012-07-10 15:38:36 +02:00
commit 76c4f19829

View file

@ -85,31 +85,28 @@ class eoParallelPopLoopEval : public eoPopEvalFunc<EOT>
public: public:
/** Ctor: set value of embedded eoEvalFunc */ /** Ctor: set value of embedded eoEvalFunc */
eoParallelPopLoopEval( eoParallelPopLoopEval(
eoEvalFunc<EOT> & _eval, // Job parameters
eo::mpi::AssignmentAlgorithm& _assignAlgo, eo::mpi::AssignmentAlgorithm& _assignAlgo,
int _masterRank, int _masterRank,
// Default parameters for store
eoEvalFunc<EOT> & _eval,
int _packetSize = 1 int _packetSize = 1
) : ) :
eval(_eval),
assignAlgo( _assignAlgo ), assignAlgo( _assignAlgo ),
masterRank( _masterRank ), masterRank( _masterRank ),
packetSize( _packetSize ),
needToDeleteStore( true ) needToDeleteStore( true )
{ {
store = new eo::mpi::ParallelEvalStore<EOT>( _eval, _masterRank, _packetSize ); store = new eo::mpi::ParallelEvalStore<EOT>( _eval, _masterRank, _packetSize );
} }
eoParallelPopLoopEval( eoParallelPopLoopEval(
eoEvalFunc<EOT> & _eval, // Job parameters
eo::mpi::AssignmentAlgorithm& _assignAlgo, eo::mpi::AssignmentAlgorithm& _assignAlgo,
eo::mpi::ParallelEvalStore<EOT>* _store,
int _masterRank, int _masterRank,
int _packetSize = 1 eo::mpi::ParallelEvalStore<EOT>* _store
) : ) :
eval(_eval),
assignAlgo( _assignAlgo ), assignAlgo( _assignAlgo ),
masterRank( _masterRank ), masterRank( _masterRank ),
packetSize( _packetSize ),
needToDeleteStore( false ), needToDeleteStore( false ),
store( _store ) store( _store )
{ {
@ -131,20 +128,17 @@ class eoParallelPopLoopEval : public eoPopEvalFunc<EOT>
} }
/** Do the job: simple loop over the offspring */ /** Do the job: simple loop over the offspring */
void operator()(eoPop<EOT> & _parents, eoPop<EOT> & _offspring) void operator()( eoPop<EOT> & _parents, eoPop<EOT> & _offspring )
{ {
(void)_parents; (void)_parents;
parallelApply<EOT>(_offspring, assignAlgo, masterRank, *store); parallelApply<EOT>(_offspring, assignAlgo, masterRank, *store);
} }
private: private:
eoEvalFunc<EOT> & eval;
eo::mpi::AssignmentAlgorithm & assignAlgo; eo::mpi::AssignmentAlgorithm & assignAlgo;
eo::mpi::ParallelEvalStore<EOT>* store;
int masterRank; int masterRank;
int packetSize;
eo::mpi::ParallelEvalStore<EOT>* store;
bool needToDeleteStore; bool needToDeleteStore;
}; };
#endif #endif