00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _MP_constant_hpp_
00010 #define _MP_constant_hpp_
00011
00012 #include "MP_utilities.hpp"
00013
00014 namespace flopc {
00020 class Constant_base {
00021 friend class Constant;
00022 friend class Handle<Constant_base*>;
00023 public:
00024 virtual double evaluate() const = 0;
00025 virtual int getStage() const {
00026 return 0;
00027 }
00028 virtual int stage() const {
00029 return 0;
00030 }
00031 protected:
00032 Constant_base() : count(0) {}
00033 virtual ~Constant_base() {}
00034 int count;
00035
00036 };
00037
00038 class MP_index_exp;
00039 class DataRef;
00040 class MP_domain;
00041
00048 class Constant : public Handle<Constant_base*> {
00049 public:
00050 Constant(Constant_base* r) : Handle<Constant_base*>(r) {}
00051 Constant(const MP_index_exp& i);
00052 Constant(const DataRef& d);
00053 Constant(double d);
00054 Constant(int d);
00055 };
00056
00063 Constant abs(const Constant& c);
00073 Constant pos(const Constant& c);
00082 Constant ceil(const Constant& c);
00091 Constant floor(const Constant& c);
00100 Constant minimum(const Constant& a, const Constant& b);
00109 Constant maximum(const Constant& a, const Constant& b);
00117 Constant operator+(const Constant& a, const Constant& b);
00125 Constant operator-(const Constant& a, const Constant& b);
00133 Constant operator*(const Constant& a, const Constant& b);
00141 Constant operator/(const Constant& a, const Constant& b);
00142
00149 Constant maximum(const MP_domain& i, const Constant& e);
00156 Constant minimum(const MP_domain& i, const Constant& e);
00163 Constant sum(const MP_domain& i, const Constant& e);
00170 Constant product(const MP_domain& i, const Constant& e);
00171 }
00172 #endif