USAGE: bar2dat <filename.bar> <dimensions> <isComplex (y/n)>
Note that .bar files can be opened in any text editor. From the first line of the file which shows the size of the matrix, its dimensions can be deduced. Similarly whether the data stored is complex or not can be obtained by examining the file.
focus3d objects generate a set of files and dipole_radiation objects generate another set of .bar files. A simple shell script can be written to convert these sets of files to their corresponding data flies.
The following script converts the .bar files generated by focus3d objects and stores in a subfolder called "data_files/":
if [ $# -lt 1 ] then echo Usage: $0 directory else if [ -d $1 ] then if [ -x bar2dat ] then ./bar2dat $1/x.bar 1 n ./bar2dat $1/y.bar 1 n ./bar2dat $1/z.bar 1 n ./bar2dat $1/theta.bar 1 n ./bar2dat $1/phi.bar 1 n ./bar2dat $1/E_focus_x.bar 3 y ./bar2dat $1/E_focus_y.bar 3 y ./bar2dat $1/E_focus_z.bar 3 y ./bar2dat $1/E_incident_x.bar 2 y ./bar2dat $1/E_incident_y.bar 2 y ./bar2dat $1/E_incident_z.bar 2 y ./bar2dat $1/angular_weights.bar 2 y else echo Error: bar2dat not in path! fi else echo Error: $1 is not a directory! fi fi
The following script converts the .bar files generated by dipole_radiation objects and stores in a subfolder called "data_files/":
if [ $# -lt 1 ] then echo Usage: $0 directory else if [ -d $1 ] then if [ -x bar2dat ] then ./bar2dat $1/x.bar 1 n ./bar2dat $1/y.bar 1 n ./bar2dat $1/z.bar 1 n ./bar2dat $1/theta.bar 1 n ./bar2dat $1/phi.bar 1 n ./bar2dat $1/E_dipole_x.bar 3 y ./bar2dat $1/E_dipole_y.bar 3 y ./bar2dat $1/E_dipole_z.bar 3 y ./bar2dat $1/E_far_x.bar 2 y ./bar2dat $1/E_far_y.bar 2 y ./bar2dat $1/E_far_z.bar 2 y ./bar2dat $1/E_refracted_x.bar 2 y ./bar2dat $1/E_refracted_y.bar 2 y ./bar2dat $1/E_refracted_z.bar 2 y else echo Error: bar2dat not in path! fi else echo Error: $1 is not a directory! fi fi
1.5.5