Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# eoRealAtomXover.h

    00001
    00023 //-----------------------------------------------------------------------------
    00024
    00031 #ifndef _eoRealAtomXover_H
    00032 #define _eoRealAtomXover_H
    00033
    00034 #include <utils/eoRNG.h>
    00035
    00036 #include <eoOp.h>
    00037
    00041 class eoDoubleExchange: public eoBinOp<double>
    00042 {
    00043 public:
    00047   eoDoubleExchange() {}
    00048
    00050   virtual std::string className() const { return "eoDoubleExchange"; }
    00051
    00055   bool operator()(double& r1, const double& r2)
    00056   {
    00057     if (eo::rng.flip())
    00058       if (r1 != r2)        // if r1 == r2 you must return false
    00059         {
    00060           r1 = r2;
    00061           return true;
    00062         }
    00063     return false;
    00064   }
    00065
    00066 };
    00067
    00071 class eoDoubleIntermediate: public eoBinOp<double>
    00072 {
    00073 public:
    00077   eoDoubleIntermediate() {}
    00078
    00080   virtual std::string className() const { return "eoDoubleIntermediate"; }
    00081
    00085   bool operator()(double& r1, const double& r2)
    00086   {
    00087     double alpha = eo::rng.uniform();
    00088     r1 = alpha * r2 + (1-alpha) * r1;
    00089     return true;
    00090   }
    00091
    00092 };
    00093
    00094 #endif