+ do files
This commit is contained in:
parent
d55182a8b0
commit
a038586edb
27 changed files with 1439 additions and 0 deletions
58
src/doSampler.h
Normal file
58
src/doSampler.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef _doSampler_h
|
||||
#define _doSampler_h
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
#include "doBounder.h"
|
||||
|
||||
template < typename D >
|
||||
class doSampler : public eoUF< D&, typename D::EOType >
|
||||
{
|
||||
public:
|
||||
typedef typename D::EOType EOType;
|
||||
|
||||
doSampler(doBounder< EOType > & bounder)
|
||||
: _bounder(bounder)
|
||||
{}
|
||||
|
||||
// virtual EOType operator()( D& ) = 0 (provided by eoUF< A1, R >)
|
||||
|
||||
virtual EOType sample( D& ) = 0;
|
||||
|
||||
EOType operator()( D& distrib )
|
||||
{
|
||||
unsigned int size = distrib.size();
|
||||
assert(size > 0);
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Point we want to sample to get higher a set of points
|
||||
// (coordinates in n dimension)
|
||||
// x = {x1, x2, ..., xn}
|
||||
// the sample method is implemented in the derivated class
|
||||
//-------------------------------------------------------------
|
||||
|
||||
EOType solution(sample(distrib));
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Now we are bounding the distribution thanks to min and max
|
||||
// parameters.
|
||||
//-------------------------------------------------------------
|
||||
|
||||
_bounder(solution);
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
|
||||
return solution;
|
||||
}
|
||||
|
||||
private:
|
||||
//! Bounder functor
|
||||
doBounder< EOType > & _bounder;
|
||||
};
|
||||
|
||||
#endif // !_doSampler_h
|
||||
Reference in a new issue