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:
/** Ctor: set value of embedded eoEvalFunc */
eoParallelPopLoopEval(
eoEvalFunc<EOT> & _eval,
// Job parameters
eo::mpi::AssignmentAlgorithm& _assignAlgo,
int _masterRank,
// Default parameters for store
eoEvalFunc<EOT> & _eval,
int _packetSize = 1
) :
eval(_eval),
assignAlgo( _assignAlgo ),
masterRank( _masterRank ),
packetSize( _packetSize ),
needToDeleteStore( true )
{
store = new eo::mpi::ParallelEvalStore<EOT>( _eval, _masterRank, _packetSize );
}
eoParallelPopLoopEval(
eoEvalFunc<EOT> & _eval,
// Job parameters
eo::mpi::AssignmentAlgorithm& _assignAlgo,
eo::mpi::ParallelEvalStore<EOT>* _store,
int _masterRank,
int _packetSize = 1
eo::mpi::ParallelEvalStore<EOT>* _store
) :
eval(_eval),
assignAlgo( _assignAlgo ),
masterRank( _masterRank ),
packetSize( _packetSize ),
needToDeleteStore( false ),
store( _store )
{
@ -131,20 +128,17 @@ class eoParallelPopLoopEval : public eoPopEvalFunc<EOT>
}
/** 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;
parallelApply<EOT>(_offspring, assignAlgo, masterRank, *store);
}
private:
eoEvalFunc<EOT> & eval;
eo::mpi::AssignmentAlgorithm & assignAlgo;
eo::mpi::ParallelEvalStore<EOT>* store;
int masterRank;
int packetSize;
eo::mpi::ParallelEvalStore<EOT>* store;
bool needToDeleteStore;
};
#endif