3.4.16. horton/grid/rtransform.h – Transformation from uniform 1D to non-uniform 1D grids

class
#include <rtransform.h>

Transformation of radial grid used for integration in spherical coordinates.

Some conventions

  • radius or r are the transformed values, a function of t.
  • t is used for the original grid

Subclassed by ExpRTransform, HyperbolicRTransform, IdentityRTransform, LinearRTransform, PowerRTransform

Public Functions

RTransform::RTransform(int npoint)

Create an RTransform object.

Parameters
  • npoint -

    The number of points on the radial grid.

virtual RTransform::~RTransform()

Destructor.

virtual double RTransform::radius(double t)
= 0

Compute the radius for a given t. (Forward transformation.)

Parameters
  • t -

    The value on the untransformed grid.

virtual double RTransform::deriv(double t)
= 0

Compute the derivative of the radius w.r.t. t.

Parameters
  • t -

    The value on the untransformed grid.

virtual double RTransform::deriv2(double t)
= 0

Compute the second derivative of the radius w.r.t. t.

Parameters
  • t -

    The value on the untransformed grid.

virtual double RTransform::deriv3(double t)
= 0

Compute the third derivative of the radius w.r.t. t.

Parameters
  • t -

    The value on the untransformed grid.

virtual double RTransform::inv(double r)
= 0

Compute t for a given radius. (Reverse transform.)

Parameters
  • r -

    The value on the transformed grid.

void RTransform::radius_array(double *t, double *r, int n)

Compute the radii for a given array of t values. (Forward transformation.)

Parameters
  • t -

    The array with values on the untransformed grid.

  • r -

    The output array with radii.

  • n -

    The number of elements in the array.

void RTransform::deriv_array(double *t, double *d, int n)

Compute derivatives of the radius for a given array of t values.

Parameters
  • t -

    The array with values on the untransformed grid.

  • d -

    The output array with (d r)/(d t).

  • n -

    The number of elements in the array.

void RTransform::deriv2_array(double *t, double *d, int n)

Compute second derivatives of the radius for a given array of t values.

Parameters
  • t -

    The array with values on the untransformed grid.

  • d -

    The output array with (d^2 r)/(d t^2).

  • n -

    The number of elements in the array.

void RTransform::deriv3_array(double *t, double *d, int n)

Compute third derivatives of the radius for a given array of t values.

Parameters
  • t -

    The array with values on the untransformed grid.

  • d -

    The output array with (d^3 r)/(d t^3).

  • n -

    The number of elements in the array.

void RTransform::inv_array(double *r, double *t, int n)

Compute the t values for a given array radii. (Reverse transformation.)

Parameters
  • r -

    The array with radii.

  • t -

    The output array with values on the untransformed grid.

  • n -

    The number of elements in the array.

int RTransform::get_npoint()

The number of grid points .

Protected Attributes

int RTransform::npoint

The number of grid points.

class
#include <rtransform.h>

Identity transformation, mostly used for debugging. r(t) = t.

Inherits from RTransform

Public Functions

IdentityRTransform::IdentityRTransform(int npoint)

Create an IdentityRTransform object.

Parameters
  • npoint -

    The number of points on the radial grid.

double IdentityRTransform::radius(double t)

Forward transformation.

double IdentityRTransform::deriv(double t)

(d r)/(d t)

double IdentityRTransform::deriv2(double t)

(d^2 r)/(d t^2)

double IdentityRTransform::deriv3(double t)

(d^3 r)/(d t^3)

double IdentityRTransform::inv(double r)

Reverse transformation.

class
#include <rtransform.h>

Linear transformation. r(t) = rmin + t*(rmax - rmin)/(npoint - 1)

Inherits from RTransform

Public Functions

LinearRTransform::LinearRTransform(double rmin, double rmax, int npoint)

Create an LinearRTransform object.

Parameters
  • rmin -

    First radius

  • rmax -

    Last radius

  • npoint -

    The number of points on the radial grid.

double LinearRTransform::radius(double t)

Forward transformation.

double LinearRTransform::deriv(double t)

(d r)/(d t)

double LinearRTransform::deriv2(double t)

(d^2 r)/(d t^2)

double LinearRTransform::deriv3(double t)

(d^3 r)/(d t^3)

double LinearRTransform::inv(double r)

Reverse transformation.

double LinearRTransform::get_rmin()

First radius.

double LinearRTransform::get_rmax()

Last radius.

double LinearRTransform::get_alpha()

Slope.

Private Members

double LinearRTransform::rmin

First radius.

double LinearRTransform::rmax

Last radius.

double LinearRTransform::alpha

Slope.

class
#include <rtransform.h>

Exponential transformation. r(t) = rmin*exp(t*log(rmax/rmin)/(npoint - 1))

Inherits from RTransform

Public Functions

ExpRTransform::ExpRTransform(double rmin, double rmax, int npoint)

Create an ExpRTransform object.

Parameters
  • rmin -

    First radius

  • rmax -

    Last radius

  • npoint -

    The number of points on the radial grid.

double ExpRTransform::radius(double t)

Forward transformation.

double ExpRTransform::deriv(double t)

(d r)/(d t)

double ExpRTransform::deriv2(double t)

(d^2 r)/(d t^2)

double ExpRTransform::deriv3(double t)

(d^3 r)/(d t^3)

double ExpRTransform::inv(double r)

Reverse transformation.

double ExpRTransform::get_rmin()

First radius.

double ExpRTransform::get_rmax()

Last radius.

double ExpRTransform::get_alpha()

Exponent.

Private Members

double ExpRTransform::rmin

First radius.

double ExpRTransform::rmax

Last radius.

double ExpRTransform::alpha

Exponent.

class
#include <rtransform.h>

Power transformation. r(t) = rmin*t^power with power = log(rmax/rmin)/log(npoint)

Inherits from RTransform

Public Functions

PowerRTransform::PowerRTransform(double rmin, double rmax, int npoint)

Create a PowerRTransform object.

Parameters
  • rmin -

    First radius

  • rmax -

    Last radius

  • npoint -

    The number of points on the radial grid.

double PowerRTransform::radius(double t)

Forward transformation.

double PowerRTransform::deriv(double t)

(d r)/(d t)

double PowerRTransform::deriv2(double t)

(d^2 r)/(d t^2)

double PowerRTransform::deriv3(double t)

(d^3 r)/(d t^3)

double PowerRTransform::inv(double r)

Reverse transformation.

double PowerRTransform::get_rmin()

First radius.

double PowerRTransform::get_rmax()

Last radius.

double PowerRTransform::get_power()

The power of t.

Private Members

double PowerRTransform::rmin

First radius.

double PowerRTransform::rmax

Last radius.

double PowerRTransform::power

The power of t.

class
#include <rtransform.h>

Hyperbolic transformation. r(t) = a*t/(1 - b*t)

Inherits from RTransform

Public Functions

HyperbolicRTransform::HyperbolicRTransform(double a, double b, int npoint)

Create a HyperbolicRTransform object.

Parameters
  • a -

    Prefactor in r(t).

  • b -

    Parameter in denominator of r(t).

  • npoint -

    The number of points on the radial grid.

double HyperbolicRTransform::radius(double t)

Forward transformation.

double HyperbolicRTransform::deriv(double t)

(d r)/(d t)

double HyperbolicRTransform::deriv2(double t)

(d^2 r)/(d t^2)

double HyperbolicRTransform::deriv3(double t)

(d^3 r)/(d t^3)

double HyperbolicRTransform::inv(double r)

Reverse transformation.

double HyperbolicRTransform::get_a()

Prefactor in r(t)

double HyperbolicRTransform::get_b()

Parameter in denominator of r(t)

Private Members

double HyperbolicRTransform::a

Prefactor in r(t)

double HyperbolicRTransform::b

Parameter in denominator of r(t)