CLASS MANUAL
output.c File Reference
#include "output.h"
+ Include dependency graph for output.c:

Functions

int output_init (struct background *pba, struct thermo *pth, struct perturbs *ppt, struct primordial *ppm, struct transfers *ptr, struct spectra *psp, struct nonlinear *pnl, struct lensing *ple, struct output *pop)
 
int output_cl (struct background *pba, struct perturbs *ppt, struct spectra *psp, struct lensing *ple, struct output *pop)
 
int output_pk (struct background *pba, struct perturbs *ppt, struct spectra *psp, struct output *pop)
 
int output_pk_nl (struct background *pba, struct perturbs *ppt, struct spectra *psp, struct output *pop)
 
int output_tk (struct background *pba, struct perturbs *ppt, struct spectra *psp, struct output *pop)
 
int output_print_data (FILE *out, char titles[_MAXTITLESTRINGLENGTH_], double *dataptr, int size_dataptr)
 
int output_open_cl_file (struct spectra *psp, struct output *pop, FILE **clfile, FileName filename, char *first_line, int lmax)
 
int output_one_line_of_cl (struct background *pba, struct spectra *psp, struct output *pop, FILE *clfile, double l, double *cl, int ct_size)
 
int output_open_pk_file (struct background *pba, struct spectra *psp, struct output *pop, FILE **pkfile, FileName filename, char *first_line, double z)
 
int output_one_line_of_pk (FILE *pkfile, double one_k, double one_pk)
 

Detailed Description

Documented output module

Julien Lesgourgues, 26.08.2010

This module writes the output in files.

The following functions can be called from other modules or from the main:

  1. output_init() (must be called after spectra_init())
  2. output_total_cl_at_l() (can be called even before output_init())

No memory needs to be deallocated after that, hence there is no output_free() routine like in other modules.

Function Documentation

int output_init ( struct background pba,
struct thermo pth,
struct perturbs ppt,
struct primordial ppm,
struct transfers ptr,
struct spectra psp,
struct nonlinear pnl,
struct lensing ple,
struct output pop 
)

This routine writes the output in files.

Parameters
pbaInput: pointer to background structure (needed for calling spectra_pk_at_z())
pthInput: pointer to thermodynamics structure
pptInput: pointer perturbation structure
ppmInput: pointer to primordial structure
ptrInput: pointer to transfer structure
pspInput: pointer to spectra structure
pnlInput: pointer to nonlinear structure
pleInput: pointer to lensing structure
popInput: pointer to output structure

Summary:

  • check that we really want to output at least one file
  • deal with all anisotropy power spectra $ C_l$'s
  • deal with all Fourier matter power spectra P(k)'s
  • deal with density and matter power spectra
  • deal with background quantities
  • deal with thermodynamics quantities
  • deal with perturbation quantities
  • deal with primordial spectra

+ Here is the call graph for this function:

int output_cl ( struct background pba,
struct perturbs ppt,
struct spectra psp,
struct lensing ple,
struct output pop 
)

This routines writes the output in files for anisotropy power spectra $ C_l$'s.

Parameters
pbaInput: pointer to background structure (needed for $ T_{cmb}$)
pptInput: pointer perturbation structure
pspInput: pointer to spectra structure
pleInput: pointer to lensing structure
popInput: pointer to output structure

Summary:

  • define local variables
  • first, allocate all arrays of files and $ C_l$'s
  • second, open only the relevant files, and write a heading in each of them
  • third, perform loop over l. For each multipole, get all $ C_l$'s by calling spectra_cl_at_l() and distribute the results to relevant files
  • finally, close files and free arrays of files and $ C_l$'s

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int output_pk ( struct background pba,
struct perturbs ppt,
struct spectra psp,
struct output pop 
)

This routines writes the output in files for Fourier matter power spectra P(k)'s.

Parameters
pbaInput: pointer to background structure (needed for calling spectra_pk_at_z())
pptInput: pointer perturbation structure
pspInput: pointer to spectra structure
popInput: pointer to output structure

Summary:

  • define local variables
  • first, check that requested redshift z_pk is consistent
  • second, open only the relevant files and write a heading in each of them
  • third, compute P(k) for each k (if several ic's, compute it for each ic and compute also the total); if z_pk = 0, this is done by directly reading inside the pre-computed table; if not, this is done by interpolating the table at the correct value of tau.
  • fourth, write in files
  • fifth, free memory and close files

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int output_pk_nl ( struct background pba,
struct perturbs ppt,
struct spectra psp,
struct output pop 
)

This routines writes the output in files for Fourier non-linear matter power spectra P(k)'s.

Parameters
pbaInput: pointer to background structure (needed for calling spectra_pk_at_z())
pptInput: pointer perturbation structure
pspInput: pointer to spectra structure
popInput: pointer to output structure

Summary:

  • define local variables
  • first, check that requested redshift z_pk is consistent
  • second, open only the relevant files, and write a heading in each of them
  • third, compute P(k) for each k (if several ic's, compute it for each ic and compute also the total); if z_pk = 0, this is done by directly reading inside the pre-computed table; if not, this is done by interpolating the table at the correct value of tau.
  • fourth, write in files
  • fifth, free memory and close files

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int output_tk ( struct background pba,
struct perturbs ppt,
struct spectra psp,
struct output pop 
)

This routines writes the output in files for matter transfer functions $ T_i(k)$'s.

Parameters
pbaInput: pointer to background structure (needed for calling spectra_pk_at_z())
pptInput: pointer perturbation structure
pspInput: pointer to spectra structure
popInput: pointer to output structure

Summary:

  • define local variables
  • first, check that requested redshift z_pk is consistent
  • second, open only the relevant files, and write a heading in each of them
  • free memory and close files

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int output_print_data ( FILE *  out,
char  titles[_MAXTITLESTRINGLENGTH_],
double *  dataptr,
int  size_dataptr 
)

Summary

  • First we print the titles
  • Then we print the data

+ Here is the caller graph for this function:

int output_open_cl_file ( struct spectra psp,
struct output pop,
FILE **  clfile,
FileName  filename,
char *  first_line,
int  lmax 
)

This routine opens one file where some $ C_l$'s will be written, and writes a heading with some general information concerning its content.

Parameters
pspInput: pointer to spectra structure
popInput: pointer to output structure
clfileOutput: returned pointer to file pointer
filenameInput: name of the file
first_lineInput: text describing the content (mode, initial condition..)
lmaxInput: last multipole in the file (the first one is assumed to be 2)
Returns
the error status

Summary

  • First we deal with the entries that are dependent of format type
  • Next deal with entries that are independent of format type

+ Here is the caller graph for this function:

int output_one_line_of_cl ( struct background pba,
struct spectra psp,
struct output pop,
FILE *  clfile,
double  l,
double *  cl,
int  ct_size 
)

This routine write one line with l and all $ C_l$'s for all types (TT, TE...)

Parameters
pbaInput: pointer to background structure (needed for $ T_{cmb}$)
pspInput: pointer to spectra structure
popInput: pointer to output structure
clfileInput: file pointer
lInput: multipole
clInput: $ C_l$'s for all types
ct_sizeInput: number of types
Returns
the error status

+ Here is the caller graph for this function:

int output_open_pk_file ( struct background pba,
struct spectra psp,
struct output pop,
FILE **  pkfile,
FileName  filename,
char *  first_line,
double  z 
)

This routine opens one file where some P(k)'s will be written, and writes a heading with some general information concerning its content.

Parameters
pbaInput: pointer to background structure (needed for h)
pspInput: pointer to spectra structure
popInput: pointer to output structure
pkfileOutput: returned pointer to file pointer
filenameInput: name of the file
first_lineInput: text describing the content (initial conditions, ...)
zInput: redshift of the output
Returns
the error status

+ Here is the caller graph for this function:

int output_one_line_of_pk ( FILE *  pkfile,
double  one_k,
double  one_pk 
)

This routine writes one line with k and P(k)

Parameters
pkfileInput: file pointer
one_kInput: wavenumber
one_pkInput: matter power spectrum
Returns
the error status

+ Here is the caller graph for this function: