paradiseo/src/doUniformCenter.h
Caner Candan a038586edb + do files
2010-07-05 19:04:35 +02:00

28 lines
591 B
C++

#ifndef _doUniformCenter_h
#define _doUniformCenter_h
#include "doModifierMass.h"
#include "doUniform.h"
template < typename EOT >
class doUniformCenter : public doModifierMass< doUniform< EOT > >
{
public:
typedef typename EOT::AtomType AtomType;
void operator() ( doUniform< EOT >& distrib, EOT& mass )
{
for (unsigned int i = 0, n = mass.size(); i < n; ++i)
{
AtomType& min = distrib.min()[i];
AtomType& max = distrib.max()[i];
AtomType range = (max - min) / 2;
min = mass[i] - range;
max = mass[i] + range;
}
}
};
#endif // !_doUniformCenter_h