[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.11 Global functions
These functions are not methods of mglData
class. However it provide additional functionality to handle data. So I put it in this chapter.
- MGL command: transform DAT 'type' real imag
- Global function:
mglData
mglTransform (const mglData &
real,const mglData &
imag,const char *
type) - C function:
HMDT
mgl_transform (HCDT
real,HCDT
imag,const char *
type) Does 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.
- MGL command: transforma DAT 'type' ampl phase
- Global function:
mglData
mglTransformAconst mglData &
ampl,const mglData &
phase,const char *
type) - C function:
HMDT
mgl_transform_aHCDT
ampl,HCDT
phase,const char *
type) The same as previous but with specified amplitude ampl and phase phase of complex numbers.
- MGL command: fourier reDat imDat 'dir'
- Global function:
void
mglFourierconst mglData &
re,const mglData &
im,const char *
dir) - C function:
void
mgl_data_fourierHCDT
re,HCDT
im,const char *
dir) Does Fourier transform of complex data re+i*im in directions dir. Result is placed back into re and im data arrays.
- MGL command: stfad RES real imag
dn
['dir'='x'] - Global function:
mglData
mglSTFA (const mglData &
real,const mglData &
imag,int
dn,char
dir='x'
) - C function:
HMDT
mgl_data_stfa (HCDT
real,HCDT
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.
- MGL command: pde RES 'ham' ini_re ini_im [
dz=0.1 k0=100
] - Global function:
mglData
mglPDE (HMGL
gr,const char *
ham,const mglData &
ini_re,const mglData &
ini_im,float
dz=0.1
,float
k0=100
,const char *
opt=""
) - C function:
HMDT
mgl_pde_solve (HMGL
gr,const char *
ham,HCDT
ini_re,HCDT
ini_im,float
dz,float
k0,const char *
opt) 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, likeham = "p^2 + i*x*(x>0)"
, but only if dependence on variable ‘i’ is linear (i.e. ham = hre+i*him). See section PDE solving hints, for sample code and picture.
- MGL command: ray RES 'ham'
x0 y0 z0 p0 q0 v0 [dt=0.1 tmax=10]
- 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) }.
- MGL command: qo2d RES 'ham' ini_re ini_im ray [
r=1 k0=100
xx yy] - 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
) - Global function:
mglData
mglQO2d (const char *
ham,const mglData &
ini_re,const mglData &
ini_im,const mglData &
ray,mglData &
xx,mglData &
yy,float
r=1
,float
k0=100
) - C function:
HMDT
mgl_qo2d_solve (const char *
ham,HCDT
ini_re,HCDT
ini_im,HCDT
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 bymglRay()
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 alsomglPDE()
. See section PDE solving hints, for sample code and picture.
- MGL command: jacobian RES xdat ydat [zdat]
- 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 (HCDT
x,HCDT
y) - C function:
HMDT
mgl_jacobian_3d (HCDT
x,HCDT
y,HCDT
z) Computes 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.
- MGL command: triangulation RES xdat ydat [zdat]
- Global function:
mglData
mglTriangulation (const mglData &
x,const mglData &
y) - Global function:
mglData
mglTriangulation (const mglData &
x,const mglData &
y,const mglData &
z) - C function:
HMDT
mgl_triangulation_2d (HCDT
x,HCDT
y) - C function:
HMDT
mgl_triangulation_3d (HCDT
x,HCDT
y,HCDT
z) Computes triangulation for arbitrary placed points with coordinates {x,y,z} (i.e. finds triangles which connect points). The sizes of 1st dimension must be equal for all arrays
x.nx=y.nx=z.nx
. Resulting array can be used in triplot or tricont functions for visualization of reconstructed surface.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 13, 2012 using texi2html 5.0.