| [ < ] | [ > ] | [ << ] | [ 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:
mglDatamglTransform (const mglData &real,const mglData &imag,const char *type) - C function:
HMDTmgl_transform (const HMDTreal,const HMDTimag,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:
mglDatamglTransformAconst mglData &l,const mglData &phase,const char *type) - C function:
HMDTmgl_transform_aconst HMDTampl,const HMDTphase,const char *type) The same as previous but with specified amplitude ampl and phase phase of complex numbers.
- Global function:
mglDatamglSTFA (const mglData &real,const mglData &imag,intdn,chardir='x') - C function:
HMDTmgl_data_stfa (const HMDTreal,const HMDTimag,intdn,chardir) 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:
mglDatamglPDE (const char *ham,const mglData &ini_re,const mglData &ini_im,mglPointMin,mglPointMax,floatdz=0.1,floatk0=100) - C function:
HMDTmgl_pde_solve (HMGLgr,const char *ham,const HMDTini_re,const HMDTini_im,floatdz,floatk0) 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 sample, for sample code and picture. See section PDE sample, for sample code and picture.
- Global function:
mglDatamglRay (const char *ham,mglPointr0,mglPointp0,floatdt=0.1,floattmax=10) - C function:
HMDTmgl_ray_trace (const char *ham,floatx0,floaty0,floatz0,floatpx,floatpy,floatpz,floatdt,floattmax) 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:
mglDatamglQO2d (const char *ham,const mglData &ini_re,const mglData &ini_im,const mglData &ray,floatr=1,floatk0=100,mglData *xx=0,mglData *yy=0,boolUseR=true) - C function:
HMDTmgl_qo2d_solve (const char *ham,const HMDTini_re,const HMDTini_im,const HMDTray,floatr,floatk0,HMDTxx,HMDTyy) 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 Beam tracing sample, for sample code and picture.
- Global function:
mglDatamglJacobian (const mglData &x,const mglData &y) - Global function:
mglDatamglJacobian (const mglData &x,const mglData &y,const mglData &z) - C function:
HMDTmgl_jacobian_2d (const HMDTx,const HMDTy) - C function:
HMDTmgl_jacobian_3d (const HMDTx,const HMDTy,const HMDTz) 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] | [ ? ] |
