utilities.h File Reference

Defines some utility functions. More...

#include "focus3d_parameters.h"
#include "precompile.h"

Include dependency graph for utilities.h:

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


Functions

bool my_mkdir (string s)
 A simple function for making a directory if it already does not exist.
Array< double, 3 > calculate_simpson_13_weights (int Nx, int Ny, int Nz, double Dx, double Dy, double Dz)
 Calculates the Simpson 1/3 weights for a three-dimensional grid.
Array< double, 2 > calculate_simpson_13_weights (int Ntheta, int Nphi, double Dtheta, double Dphi)
 Calculates the Simpson 1/3 weights for a two-dimensional grid.
void file_read_error (string s)
 Prints read file error to cerr.
Array< complex< double >, 2 > make_angular_weights (Array< double, 1 > ampl_coeffs, Array< double, 1 > phase_coeffs, focus3d_parameters param)
 Calculates the angular weights.
Array< double, 1 > load_polynomial_coeffs (string filename, int poly_fit_order)
 load polynomial coefficients.
Array< complex< double >, 2 > make_angular_weights (string ampl_coeff_file, string phase_coeff_file, focus3d_parameters param)
 Calculates angular weights.
int determine_poly_fit_order (string filename)
 Determine the order of the polynomial fit.
void interpolate_data (string filename, Array< double, 1 > theta, Array< complex< double >, 1 > &output)
 Interpolate amplitude and phase data of G($ \theta $) from a file.

Detailed Description

Defines some utility functions.

Author:
Vishnu Krishnamachari
Date:
June 2006 - May 2008 Defines some utility functions that are used by the methods of the classes introduced in this package.

Function Documentation

Array<double,2> calculate_simpson_13_weights ( int  Ntheta,
int  Nphi,
double  Dtheta,
double  Dphi 
)

Calculates the Simpson 1/3 weights for a two-dimensional grid.

Parameters:
Ntheta - number of points along dimension 1
Nphi - number of points along dimension 2
Dtheta - grid spacing along dimension 1
Dphi - grid spacing along dimension 2
Returns:
output - Array<double,2> A(theta,phi): a two dimensional blitz++ array

Array<double,3> calculate_simpson_13_weights ( int  Nx,
int  Ny,
int  Nz,
double  Dx,
double  Dy,
double  Dz 
)

Calculates the Simpson 1/3 weights for a three-dimensional grid.

Parameters:
Nx - number of points along dimension 1
Ny - number of points along dimension 2
Nz - number of points along dimension 3
Dx - grid spacing along dimension 1
Dy - grid spacing along dimension 2
Dz - grid spacing along dimension 3
Returns:
output - Array<double,3>: a three dimensional blitz++ array

int determine_poly_fit_order ( string  filename  ) 

Determine the order of the polynomial fit.

Parameters:
filename - std::string with filename containing the polynomial coefficients
Returns:
result - an integer with the order of the polynomial fit
Note:
  • The polynomial coefficients file is a file containing the coefficients of the polynomial fit one in each line. If the polynomial fit is a third order polynomial, then the fit function $ f(x) $ is

    \begin{eqnarray*} f(x) &=& P(0)*x^3 + P(1)*x^2 + P(2)*x + P(3) \end{eqnarray*}

    and the coefficients P(0), ..., P(3) are stored in the file one in each line in that order.

void file_read_error ( string  s  ) 

Prints read file error to cerr.

Parameters:
s - std::string to be sent to cerr

void interpolate_data ( string  filename,
Array< double, 1 >  theta,
Array< complex< double >, 1 > &  output 
)

Interpolate amplitude and phase data of G($ \theta $) from a file.

Parameters:
filename - std::string with filename containing three colums corresponding to $ \theta $, $ |G(\theta)| $, and angle($ G(\theta) $)
theta - A double array with the theta values at which the interpolated G($ \theta $) is required
[out] output - a complex double array which is populated with interpolated G($ \theta $). Note the memory to this array should be allocated before calling the function. The length of this array is equal to that of the second parameter.

Array<double,1> load_polynomial_coeffs ( string  filename,
int  poly_fit_order 
)

load polynomial coefficients.

Parameters:
filename - std::string with filename containing the polynomial coefficients
poly_fit_order - order of the fit polynomial
Returns:
result - a one dimensional array of the polynomial coefficients
Note:
  • The polynomial coefficients file is a file containing the coefficients of the polynomial fit one in each line. If the polynomial fit is a third order polynomial, then the fit function $ f(x) $ is

    \begin{eqnarray*} f(x) &=& P(0)*x^3 + P(1)*x^2 + P(2)*x + P(3) \end{eqnarray*}

    and the coefficients P(0), ..., P(3) are stored in the file one in each line in that order.

Array<complex<double>,2> make_angular_weights ( string  ampl_coeff_file,
string  phase_coeff_file,
focus3d_parameters  param 
)

Calculates angular weights.

Parameters:
ampl_coeff_file - std::string with filename containing the polynomial coefficients for amplitude fit
phase_coeff_file - std::string with filename containing the polynomial coefficients for amplitude fit
param - focus3d_parameters object with information about Ntheta and Nphi
Returns:
result - a 2D complex array of size (param.Ntheta,param.Nphi) of angular weights
Note:
  • The polynomial coefficients file is a file containing the coefficients of the polynomial fit one in each line. If the polynomial fit is a third order polynomial, then the fit function $ f(x) $ is

    \begin{eqnarray*} f(x) &=& P(0)*x^3 + P(1)*x^2 + P(2)*x + P(3) \end{eqnarray*}

    and the coefficients P(0), ..., P(3) are stored in the file one in each line in that order.

Array<complex<double>,2> make_angular_weights ( Array< double, 1 >  ampl_coeffs,
Array< double, 1 >  phase_coeffs,
focus3d_parameters  param 
)

Calculates the angular weights.

Parameters:
ampl_coeffs - blitz array of polynomial coefficients of amplitude fit
phase_coeffs - blitz array of polynomial coefficients of phase fit
param - focus3d_parameters object containing Ntheta and Nphi information.
Returns:
result - a 2D complex array of size (param.Ntheta,param.Nphi) of angular weights

bool my_mkdir ( string  s  ) 

A simple function for making a directory if it already does not exist.

Parameters:
s - name of the directory.
Returns:
result - a bool - true if successful false otherwise


Generated on Tue May 13 14:25:06 2008 for focal fields package by  doxygen 1.5.5