manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.11 Global functions

These functions are not methods of mglData class. However it have additional functionality to handle data. So I put it in this chapter.

Global function: mglData mglTransform (const mglData &real, const mglData &imag, const char *type)
C function: HMDT mgl_transform (const HMDT real, const HMDT imag, const char *type)

Do integral transformation of complex data real, imag on specified direction. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: ‘f’ is forward Fourier transformation, ‘i’ is inverse Fourier transformation, ‘s’ is Sine transform, ‘c’ is Cosine transform, ‘h’ is Hankel transform, ‘n’ or ‘ ’ is no transformation.

Global function: mglData mglTransformA const mglData &ampl, const mglData &phase, const char *type)
C function: HMDT mgl_transform_a const HMDT ampl, const HMDT phase, const char *type)

The same as previous but with specified amplitude ampl and phase phase of complex numbers.

Global function: mglData mglSTFA (const mglData &real, const mglData &imag, int dn, char dir='x')
C function: HMDT mgl_data_stfa (const HMDT real, const HMDT imag, int dn,char dir)

Short time Fourier transformation for real and imaginary parts. Output is amplitude of partial Fourier of length dn. For example if dir=‘x’, result will have size {int(nx/dn), dn, ny} and it will contain res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn.

Global function: mglData mglPDE (const char *ham, const mglData &ini_re, const mglData &ini_im, mglPoint Min, mglPoint Max, float dz=0.1, float k0=100)
C function: HMDT mgl_pde_solve (HMGL gr, const char *ham, const HMDT ini_re, const HMDT ini_im, float dz, float k0)

Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed. Here variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)", but only if dependence on variable ‘i’ is linear (i.e. ham = hre+i*him). See section PDE sample, for sample code and picture. See section PDE sample, for sample code and picture.

Global function: mglData mglRay (const char *ham, mglPoint r0, mglPoint p0, float dt=0.1, float tmax=10)
C function: HMDT mgl_ray_trace (const char *ham, float x0, float y0, float z0, float px, float py, float pz, float dt, float tmax)

Solves GO ray equation like dr/dt = d ham/dp, dp/dt = -d ham/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here ham is Hamiltonian which may depend on coordinates ‘x’, ‘y’, ‘z’, momentums ‘p’=px, ‘q’=py, ‘v’=pz and time ‘t’: ham = H(x,y,z,p,q,v,t). The starting point (at t=0) is defined by variables r0, p0. Parameters dt and tmax specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(tmax/dt+1) }. See section Beam tracing sample, for sample code and picture.

Global function: mglData mglQO2d (const char *ham, const mglData &ini_re, const mglData &ini_im, const mglData &ray, float r=1, float k0=100, mglData *xx=0, mglData *yy=0, bool UseR=true)
C function: HMDT mgl_qo2d_solve (const char *ham, const HMDT ini_re, const HMDT ini_im, const HMDT ray, float r, float k0, HMDT xx, HMDT yy)

Solves equation du/dt = i*k0*ham(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators (see mglPDE() for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by mglRay() function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy are non-zero then Cartesian coordinates for each point will be written into them. See also mglPDE(). See section Beam tracing sample, for sample code and picture.

Global function: mglData mglJacobian (const mglData &x, const mglData &y)
Global function: mglData mglJacobian (const mglData &x, const mglData &y, const mglData &z)
C function: HMDT mgl_jacobian_2d (const HMDT x, const HMDT y)
C function: HMDT mgl_jacobian_3d (const HMDT x, const HMDT y, const HMDT z)

Computates the Jacobian for transformation {i,j,k} to {x,y,z} where initial coordinates {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||dr_\alpha/d\xi_\beta|| where r={x,y,z} and \xi={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {x,y,z} are specified or 2D if only 2 arrays {x,y} are specified.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.