Program Listing for File cosmology.h

Return to documentation for file (src/lib/cosmology.h)

// avoid multiple def of the same class
#ifndef COSMO_H  // check that this keyword has been set already
#define COSMO_H  // define the keyword to be checked

#include <iostream>
#include <vector>

using std::ostream;
using std::vector;

class cosmo {
 private:
  double h0, om0, l0;

 public:
  cosmo(double h0 = 70,
        double om0 = 0.3,
        double l0 = 0.7)
  {
    (*this).h0 = h0;
    (*this).om0 = om0;
    (*this).l0 = l0;
  }

  double distMet(double z) const;

  double distMod(double z) const;

  double time(
      double z) const;

  inline bool operator==(const cosmo &rhs) const {
    return h0 == rhs.h0 && om0 == rhs.om0 && l0 == rhs.l0;
  }

  inline bool operator!=(const cosmo &rhs) const {
    return h0 != rhs.h0 || om0 != rhs.om0 || l0 != rhs.l0;
  }

  inline friend ostream &operator<<(ostream &output, const cosmo &c) {
    output << c.h0 << "," << c.om0 << "," << c.l0;
    return output;
  }


  double flux_rescaling(double z, double z_t) const;
};

vector<double> zgrid(double dz, double zmin, double &zmax);
int indexz(const double red, const vector<double> &gridz);

#endif