00001 #ifndef gridripper_metric_Metric_h
00002 #define gridripper_metric_Metric_h
00003
00004
00005 #include <gridripper/math.h>
00006 #include <gridripper/tvector.h>
00007 #include <string>
00008
00009
00010 namespace gridripper { namespace metric {
00011
00012
00020 struct MetricValues
00021 {
00026 GReal_t r, G00, G01, G10, G11;
00032 GReal_t invr, invG00, invG01, invG10, invG11;
00037 GReal_t Volume;
00042 GReal_t divgtau, divgrho;
00044 GReal_t rtau, rrho;
00046 GReal_t rtautau, rtaurho, rrhotau, rrhorho;
00051 GReal_t Normal0, Normal1, Lapse, Shift0, Shift1, Volume3;
00055 GReal_t SpatialNormal0, SpatialNormal1, SpatialVolume3;
00059 GReal_t Killing0, Killing1;
00060 };
00061
00062
00070 class MetricParam : public tvector<GReal_t>
00071 {
00072 public:
00073 MetricParam() : tvector<GReal_t>() { }
00074 MetricParam(const MetricParam &other) : tvector<GReal_t>(other) { }
00075 MetricParam(const GReal_t param1) : tvector<GReal_t>()
00076 {
00077 push_back(param1);
00078 }
00079 MetricParam(const GReal_t param1, const GReal_t param2) : tvector<GReal_t>()
00080 {
00081 push_back(param1);
00082 push_back(param2);
00083 }
00084 MetricParam(const GReal_t param1, const GReal_t param2, const GReal_t param3) : tvector<GReal_t>()
00085 {
00086 push_back(param1);
00087 push_back(param2);
00088 push_back(param3);
00089 }
00090 MetricParam(const GReal_t param1, const GReal_t param2, const GReal_t param3,
00091 const GReal_t param4) : tvector<GReal_t>()
00092 {
00093 push_back(param1);
00094 push_back(param2);
00095 push_back(param3);
00096 push_back(param4);
00097 }
00098 MetricParam(const GReal_t param1, const GReal_t param2, const GReal_t param3,
00099 const GReal_t param4, const GReal_t param5) : tvector<GReal_t>()
00100 {
00101 push_back(param1);
00102 push_back(param2);
00103 push_back(param3);
00104 push_back(param4);
00105 push_back(param5);
00106 }
00107 };
00108
00109
00118 class Metric
00119 {
00120 public:
00122 enum eval_t { rderiv, metric, metricderiv, all };
00123 protected:
00125 const GReal_t rhomin, rhomax;
00127 const bool isleftinfty, isrightinfty;
00129 const std::string name;
00130 private:
00134 Metric()
00135 : rhomin(0.0), rhomax(0.0), isleftinfty(false), isrightinfty(false)
00136 { }
00137 public:
00138 Metric(const Metric &other)
00139 : rhomin(other.rhomin), rhomax(other.rhomax),
00140 isleftinfty(other.isleftinfty), isrightinfty(other.isrightinfty), name(other.name)
00141 { }
00142 Metric(const GReal_t RhoMin, const GReal_t RhoMax,
00143 const bool IsLeftInfty, const bool IsRightInfty, const std::string& Name)
00144 : rhomin(RhoMin), rhomax(RhoMax),
00145 isleftinfty(IsLeftInfty),isrightinfty(IsRightInfty), name(Name)
00146 { }
00147 virtual ~Metric() { }
00149 virtual void eval(MetricValues &metricvalues,
00150 const GReal_t tau, const GReal_t rho,
00151 const eval_t ev=all) const = 0;
00156 GReal_t getRhoMin() const { return rhomin; }
00157 GReal_t getRhoMax() const { return rhomax; }
00162 bool isLeftInfty() const { return isleftinfty; }
00163 bool isRightInfty() const { return isrightinfty; }
00165 std::string getName() const { return name; }
00166 };
00167
00168
00170 class MInert : public Metric
00171 {
00172 protected:
00173 GReal_t kappa;
00174 public:
00175 MInert(const MInert &other) : Metric(other), kappa(other.kappa) { }
00176 MInert(const GReal_t kappaarg)
00177 : Metric(0.0, 1.0, false, true, "MInert"), kappa(kappaarg)
00178 { }
00179 void eval(MetricValues &metricvalues,
00180 const GReal_t tau, const GReal_t rho,
00181 const eval_t ev) const;
00182 };
00183
00184
00186 class MHyper : public Metric
00187 {
00188 protected:
00189 GReal_t kappa;
00190 public:
00191 MHyper(const MHyper &other) : Metric(other), kappa(other.kappa) { }
00192 MHyper(const GReal_t kappaarg)
00193 : Metric(0.0, 1.0, false, true, "MHyper"), kappa(kappaarg)
00194 { }
00195 void eval(MetricValues &metricvalues,
00196 const GReal_t tau, const GReal_t rho,
00197 const eval_t ev) const;
00198 };
00199
00200
00202 class Sch : public Metric
00203 {
00204 protected:
00205 GReal_t kappa, Mass;
00206 public:
00207 Sch(const Sch &other) : Metric(other), kappa(other.kappa), Mass(other.Mass) { }
00208 Sch(const GReal_t kappaarg, const GReal_t Massarg)
00209 : Metric(-1.0, 1.0, true, true, "Sch"), kappa(kappaarg), Mass(Massarg)
00210 { }
00211 void eval(MetricValues &metricvalues,
00212 const GReal_t tau, const GReal_t rho,
00213 const eval_t ev) const;
00214 };
00215
00216
00217 } }
00218
00219
00220 #endif