ZBFREAD

Opens the specified ZBF file and places the electric field and beam property data in two user-defined array variables.

Syntax:

ZBFREAD filename, beamname, propertyname
 

Discussion:

This keyword requires the name of the ZBF file and the name of two arrays defined by a previous call to DECLARE. The beamname must be a 3 dimensional array, of minimum size (nx, ny, 2) for an unpolarized beam and minimum size (nx, ny, 4) for a polarized beam. The propertyname array must be a one dimensional array of minimum size 14. After the ZBFREAD function executes, the following beam data will be placed in the specified propertyname array: nx, ny, dx, dy, waist_x, waist_y, position_x, position_y, rayleigh_x, rayleigh_y, wavelength (in lens units), total power, peak irradiance (power per area), the is_polarized flag (0 for no, 1 for yes), and the media index; the values are placed in array positions 1 through 15. The electric field data will be placed in the beamname array. The third dimension of the beamname array is 1 for Ex Real, 2 for Ex Imaginary, and if the beam is polarized, 3 for Ey Real, and 4 for Ey Imaginary.

See "Purpose:" for comments that apply to all ZBF related keywords. See also "ZBFWRITE".

Example:

! First get the beam size 
ZBFPROPERTIES "TEST1.ZBF", 1 
nx = vec1(1)
ny = vec1(2)
ip = vec1(14) ! The "is polarized" flag
 
! Allocate enough memory to hold the beam
IF (ip == 0) THEN DECLARE B, DOUBLE, 3, nx, ny, 2
IF (ip == 1) THEN DECLARE B, DOUBLE, 3, nx, ny, 4
DECLARE P, DOUBLE, 1, 20
ZBFREAD "test1.zbf", B, P
 
FOR j, 1, ny, 1
FOR i, 1, nx, 1
FORMAT 4.0
PRINT i, j,
FORMAT 12.6
IF (ip == 1)
PRINT B(i, j, 1),
PRINT B(i, j, 2),
PRINT B(i, j, 3),
PRINT B(i, j, 4)
ELSE
PRINT B(i, j, 1),
PRINT B(i, j, 2)
ENDIF
NEXT
NEXT
 
! save the beam
ZBFWRITE "TEST2.ZBF", B, P
 
! release the allocated memory
RELEASE B
RELEASE P

Next: