gridder.cpp File Reference

grid functions More...

#include <cstdlib>
#include <cstdio>
#include <vector>
#include "helperfunc.h"
#include "Matrix.h"
#include "Cvals.h"

Include dependency graph for gridder.cpp:


Functions

int gridder (int nx, int ny, int ndata, int offset[3], int jump[3], double xmin, double xmax, double ymin, double ymax, float *xval, float *yval, float *val, float *xsep, float *ysep, float **results)
int gridder (int nx, int ny, int ndata, int offset[3], int jump[3], double xmin, double xmax, double ymin, double ymax, float *xval, float *yval, float *val, vector< float > &xsep, vector< float > &ysep, Matrix< float > &results, Matrix< int > &number)
int gridder (int nx, int ny, int ilow, int ihigh, double xmin, double xmax, double ymin, double ymax, Cvals *xval, Cvals *yval, Cvals *val, vector< float > &xsep, vector< float > &ysep, Matrix< float > &results, Matrix< int > &number)
double get_upbnd_bin_linear (int nbins, double xmin, double xmax, int bin)
double get_lowbnd_bin_linear (int nbins, double xmin, double xmax, int bin)
int get_bin_number_linear (int nbins, double xmin, double xmax, double xval)
double get_center_bin_linear (int nbins, double xmin, double xmax, int bin)

Detailed Description

grid functions

Functions that allows you to distribute any quantity you want to a two-dimensional grid.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> NOTE: the 2D array is viewed as a matrix, meaning that the first index corresponds to y (a row), the second index corresponds to x (a column)! This because pgplot plots 2D arrays this way. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

arguments: nx, ny: number of grid cells in the x- and y directions

ndata: number of data points (e.g. min length of the xval, yval and val arrays) offset: start using data points from the noffset'th point. This is an array with 3 indices: for respectively xval, yval and val

jump: the increment of the array index. A default value would be 1 (use all values in the chosen array range). If you have e.g. an array arr[100][3] then you could use the second column (e.g. the arr[x][1] elements) by passing arr[0][1] as the pointer and specifiying a jump of 3.

jump is an array with 3 indices: respectively the jump for xval, yval and val.

If you are unsure and don't need special behaviour: pass an array (1,1,1)

xmin, xmax, ymin, ymax: indicates the boundaries of the grid.

xval: x values of values yval: y values of values val: value that will be added to the grid-points.

xsep, ysep: will contain the values of the edges of the gridpoints. Allocate yourself, nx+1 and ny+1 places!

results: two-dimenstional array that will store the results. The caller is responsible for allocating a large enough array. the number of columns should be equal to nx!

return value: number of points added to the grid


Function Documentation

int get_bin_number_linear ( int  nbins,
double  xmin,
double  xmax,
double  xval 
)

return the bin number for an xvalue between xmin and xmax, with nbins bins. the scale is linear. A value of xmin returns 0, a value of xmax returns nbins - 1. (xmax would normally return nbins but is modified by hand to avoid segfaults)

double get_center_bin_linear ( int  nbins,
double  xmin,
double  xmax,
int  bin 
)

returns the center value of a bin. bins: between 0 and nbins-1

int gridder ( int  nx,
int  ny,
int  ndata,
int  offset[3],
int  jump[3],
double  xmin,
double  xmax,
double  ymin,
double  ymax,
float *  xval,
float *  yval,
float *  val,
vector< float > &  xsep,
vector< float > &  ysep,
Matrix< float > &  results,
Matrix< int > &  number 
)

overloaded: uses a Matrix for the results. See the file info for details. ilow, ihigh: loop over the particle numbers [ilow, ihigh[

int gridder ( int  nx,
int  ny,
int  ndata,
int  offset[3],
int  jump[3],
double  xmin,
double  xmax,
double  ymin,
double  ymax,
float *  xval,
float *  yval,
float *  val,
float *  xsep,
float *  ysep,
float **  results 
)

Allows you to distribute any quantity you want to a 2D grid


Generated on Fri Oct 16 18:59:58 2009 for HYPLOT by  doxygen 1.5.8