%**************************************************************************
%This function writes the field integrals to the data file.
%
%Input:
%dat_file, data file for results
%x_val, x position of the integral (m)
%y_val, y position of the integral (m)
%z, z position of the cumulative integral (m)
%int_bx_dz, cumulative integral of Bx along z at (x_int, y_int) (Tm)
%int_by_dz, cumulative integral of By along z at (x_int, y_int) (Tm)
%int_int_bx_dz_dz, cumulative second integral of Bx along z at (x_int, y_int) (Tm)
%int_int_by_dz_dz, cumulative second integral of By along z at (x_int, y_int) (Tm)
%
%Zachary Wolf, 2/7/11

function [] = virtual_shim_dat_intbxydz(dat_file, x_val, y_val, z, int_bx_dz, int_by_dz, int_int_bx_dz_dz, int_int_by_dz_dz)

%Write the overall field integrals to the data file
fid = fopen(dat_file, 'a');
fprintf(fid, '\r\n');
fprintf(fid, 'Overall Field Integrals:\r\n');
fprintf(fid, 'x = %f m\r\n', x_val);
fprintf(fid, 'y = %f m\r\n', y_val);
fprintf(fid, 'Int Bx dz = %13.4e Tm\r\n', int_bx_dz(end));
fprintf(fid, 'Int Int Bx dz dz = %13.4e Tm^2\r\n', int_int_bx_dz_dz(end));
fprintf(fid, 'Int By dz = %13.4e Tm\r\n', int_by_dz(end));
fprintf(fid, 'Int Int By dz dz = %13.4e Tm^2\r\n', int_int_by_dz_dz(end));
fclose(fid);

%Done