This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/src/doBounderRng.h
2010-08-18 13:37:17 +02:00

42 lines
935 B
C++

// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _doBounderRng_h
#define _doBounderRng_h
#include "doBounder.h"
template < typename EOT >
class doBounderRng : public doBounder< EOT >
{
public:
doBounderRng( EOT min, EOT max, eoRndGenerator< double > & rng )
: doBounder< EOT >( min, max ), _rng(rng)
{}
void operator()( EOT& x )
{
unsigned int size = x.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) // browse all dimensions
{
// FIXME: attention: les bornes RNG ont les memes bornes quelque soit les dimensions idealement on voudrait avoir des bornes differentes pour chaque dimensions.
if (x[d] < this->min()[d] || x[d] > this->max()[d])
{
x[d] = _rng();
}
}
}
private:
eoRndGenerator< double> & _rng;
};
#endif // !_doBounderRng_h