Commit 0f17b1ec authored by Xavier Garrido's avatar Xavier Garrido
Browse files

move Class engine into update method

parent 0a1ca84a
......@@ -20,13 +20,11 @@ namespace cib {
}
void cib_interface::initialize(// File to be parsed)
ClassEngine * klass_
)
{
if (_initialized_) {
throw std::logic_error("cib_interface::initialize: CIB model already initialized !");
}
_klass_ = klass_;
// law == "lognormal_sigevol"
_parameters_.Meffmax = 8753289339381.791;
......@@ -42,14 +40,7 @@ namespace cib {
_ell_ = {187., 320., 502., 684., 890., 1158., 1505., 1956};
_nell_ = _ell_.size();
cib::zeros(_gnu_, _nfreq_);
const double h_p = 6.62607004e-34;
const double k_B = 1.38064852e-23;
const double T_cmb = _klass_->Tcmb();
for (size_t i = 0; i < _nu_.size(); i++) {
const double x = h_p*_nu_[i]/k_B/T_cmb;
_gnu_[i] = x*((std::exp(x) + 1)/(std::exp(x) - 1)) - 4;
}
_gnu_.resize(_nfreq_);
// Halo mass sampling
for (double m = 6; m <= 15; m+=0.1) _mh_.push_back(std::pow(10, m));
......@@ -76,12 +67,21 @@ namespace cib {
_initialized_ = true;
}
void cib_interface::update(const cib::cib_parameters & parameters_)
void cib_interface::update(const cib::cib_parameters & parameters_, ClassEngine* klass_)
{
if (! _initialized_) {
throw std::logic_error("cib_interface::update: CIB model not initialized !");
}
_parameters_ = parameters_;
_klass_ = klass_;
const double h_p = 6.62607004e-34;
const double k_B = 1.38064852e-23;
const double T_cmb = _klass_->Tcmb();
for (size_t i = 0; i < _nu_.size(); i++) {
const double x = h_p*_nu_[i]/k_B/T_cmb;
_gnu_[i] = x*((std::exp(x) + 1)/(std::exp(x) - 1)) - 4;
}
// Update comoving distances for each z given cosmo. parameters
const double Om0 = _klass_->Omega_m();
......
......@@ -29,10 +29,10 @@ namespace cib {
~cib_interface();
/// Initialize method
void initialize(ClassEngine* klass_);
void initialize();
/// Update CIB parameters
void update(const cib::cib_parameters & parameters_);
void update(const cib::cib_parameters & parameters_, ClassEngine* klass_);
/// Compute and retrieve Cls
void compute_cls(cib::array3d & cl_cib_,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment