gimme-alpha 0.1

density.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  density_point

Functions

double get_density_within_range (double xmin, double xmax, struct density_point *p, int len, short int type)
double get_density_within_range2 (double xmin, double xmax, double x[], double rho[], int len)

Function Documentation

double get_density_within_range ( double  xmin,
double  xmax,
struct density_point p,
int  len,
short int  type 
)

Definition at line 91 of file density.c.

References get_density_within_range2(), get_density_within_range2_stairstep(), get_density_within_range2_sum(), density_point::rho, and density_point::x.

Referenced by main().

                                                                                                            {
  int i;
  double x[len];
  double rho[len];
  for(i=0; i<len; i++) {
    x[i] = p[i].x;
    rho[i] = p[i].rho;
    //fprintf(stderr, "i=%d: x=%g rho=%g -> x=%g rho=%g\n", i, p[i].x, p[i].rho, x[i], rho[i]);
  }
  switch (type) {
  case 1:
    return get_density_within_range2_stairstep(xmin, xmax, x, rho, len);
    break;
  case 2:
    return get_density_within_range2_sum(xmin, xmax, x, rho, len);
    break;
  default:
    return get_density_within_range2(xmin, xmax, x, rho, len);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

double get_density_within_range2 ( double  xmin,
double  xmax,
double  x[],
double  rho[],
int  len 
)

Definition at line 32 of file density.c.

Referenced by get_density_within_range().

                                                                                              {
  /*Use GSL to integrate using a spline interpolator*/
  gsl_interp_accel *acc = gsl_interp_accel_alloc();
  gsl_spline *spline = gsl_spline_alloc(gsl_interp_akima_periodic, len);
  gsl_spline_init(spline, x, rho, len);
  double density = gsl_spline_eval_integ(spline, xmin, xmax, acc);
  gsl_spline_free(spline);
  gsl_interp_accel_free(acc);
  return density;
}

Here is the caller graph for this function:

 All Classes Files Functions Variables Enumerations Enumerator Defines