%**************************************************************************
% CLUSTER project: Curlometer method               Autor: Christian Maszl 
% Formulas: y0*Jav*(r1a x r1b) = dB1a*r1b-dB1b*r1a                        
%           div B*|r1a*(r1b x r1c)| = |Sum(cyclic) dB1a*(r1b x r1c)|    
% Unit System = [SI]                  Mail: e0025754@student.tuwien.ac.at 
%**************************************************************************
%
% Version 1.0 - 20.8.2004
%
% [Ok] Split the input data into B1,B2,B3,B4 and r1,r2,r3,r4;
for i=1:1:4    
    eval(['B',int2str(i),'=D',int2str(i),'(:,2:4);']);
    eval(['r',int2str(i),'=D',int2str(i),'(:,5:7);']);
end
clear D1 D2 D3 D4;
%**************************************************************************
% Perform calculations (see tetrahedron.jpg for details about
% geometrical coherences).
%**************************************************************************

% [Ok] Write a function faster execution 
[jav,divB] = curlB(B1,B2,B3,B4,r1,r2,r3,r4,y0);
% Output processing status
message=['. data-package ready. Proceed in execution!'];
text1  =sprintf('%u%s\n',lauf,message);
        disp(text1);
% Store data to harddisk
try
     datatodisk;
     disp('Data stored to harddisk. Proceed in execution!')
catch
     text1=['Could not write data to HD.The disk quota is either'...
           ' exceeded or you do not have write permission for the'...
           ' directory!'];
     disp(text1);
     disp('Please restart the program!');
     break;
end
