Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Interp_obj Class Reference

: linear interpolation (Steffen) of data [x, y] More...

#include <core_power.h>

Inheritance diagram for Interp_obj:

Public Member Functions

 Interp_obj ()
 
 ~Interp_obj ()
 
double operator() (double x) const
 
template<typename T , size_t N>
void init (const Data_Vec< T, N > &data)
 

Public Attributes

double x_min
 
double x_max
 

Private Attributes

bool is_init
 
gsl_spline * spline
 
gsl_interp_accel * acc
 

Detailed Description

: linear interpolation (Steffen) of data [x, y]

Definition at line 96 of file core_power.h.

Constructor & Destructor Documentation

Interp_obj::Interp_obj ( )
inline

Definition at line 99 of file core_power.h.

References init(), operator()(), x, and ~Interp_obj().

99 : is_init(false) {}
bool is_init
Definition: core_power.h:107
Interp_obj::~Interp_obj ( )

Definition at line 511 of file core_power.cpp.

Referenced by Interp_obj().

512 {
513  if (is_init)
514  {
515  gsl_spline_free(spline);
516  gsl_interp_accel_free (acc);
517  }
518 }
gsl_spline * spline
Definition: core_power.h:108
gsl_interp_accel * acc
Definition: core_power.h:109
bool is_init
Definition: core_power.h:107

Member Function Documentation

template<typename T , size_t N>
template void Interp_obj::init ( const Data_Vec< T, N > &  data)

EXPLICIT INSTANTIATION *

Definition at line 496 of file core_power.cpp.

References Catch::begin, Catch::end, and Data_Vec< T, N >::size().

Referenced by Extrap_Pk< T, N >::Extrap_Pk(), gen_sigma_func_binned_gsl_qawf_nl(), and Interp_obj().

497 {
498  is_init = true;
499  acc = gsl_interp_accel_alloc ();
500  spline = gsl_spline_alloc (gsl_interp_steffen, data.size());
501 
502  std::vector<double> tmp_x(data[0].begin(), data[0].end());
503  std::vector<double> tmp_y(data[1].begin(), data[1].end());
504 
505  gsl_spline_init (spline, tmp_x.data(), tmp_y.data(), data.size());
506 
507  x_min = data[0].front();
508  x_max = data[0].back();
509 }
not_this_one end(...)
gsl_spline * spline
Definition: core_power.h:108
size_t size() const noexcept
not_this_one begin(...)
double x_min
Definition: core_power.h:104
gsl_interp_accel * acc
Definition: core_power.h:109
double x_max
Definition: core_power.h:104
bool is_init
Definition: core_power.h:107
double Interp_obj::operator() ( double  x) const

Definition at line 520 of file core_power.cpp.

Referenced by Interp_obj(), and Extrap_Pk< T, N >::operator()().

520 { return gsl_spline_eval(spline, x, acc); }
gsl_spline * spline
Definition: core_power.h:108
gsl_interp_accel * acc
Definition: core_power.h:109
static CCL_BEGIN_DECLS double x[111][8]

Member Data Documentation

gsl_interp_accel* Interp_obj::acc
private

Definition at line 109 of file core_power.h.

bool Interp_obj::is_init
private

Definition at line 107 of file core_power.h.

gsl_spline* Interp_obj::spline
private

Definition at line 108 of file core_power.h.

double Interp_obj::x_max

Definition at line 104 of file core_power.h.

Referenced by print_pow_spec_diff().

double Interp_obj::x_min

Definition at line 104 of file core_power.h.

Referenced by print_pow_spec_diff().


The documentation for this class was generated from the following files: