BAR2DAT utility

Author:
Vishnu Krishnamachari, University of California Irvine, Irvine, CA, USA
Date:
June 2006 - May 2008
Version:
1.0
BAR2DAT utility which can be gnerated from the supplied source code can be used for generating ASCII data files from the .bar files that focus3d and dipole_radiation objects create.

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

Generated on Tue May 13 14:25:06 2008 for focal fields package by  doxygen 1.5.5