ouput with XLONG XLAT
[wrf-fire-matlab.git] / femwind / f_assembly_fortran.m
blobcd11d38fa540b199dd8bf13dcdf2bf05a0dde602
1 function F=f_assembly_fortran(A,X,u0, lambda, params)
2 % call fortran version
4 F= f_assembly(A,X,u0);
6 if params.test_fortran
7     disp('testing if sparse assembly of F same result in fortran')
8     exe = './fortran/f_assembly_test.exe';
9     if exist(exe,'file') 
10         %Writing all arrays to text files for use by fortran tester
11         write_array_nd(swap23(X{1}),'X');
12         write_array_nd(swap23(X{2}),'Y');   
13         write_array_nd(swap23(X{3}),'Z');
14         write_array_nd(swap23(u0{1}),'Xu0');
15         write_array_nd(swap23(u0{2}),'Yu0');
16         write_array_nd(swap23(u0{3}),'Zu0');
17         write_array(A,'A');
18         
19         system(exe)
20         
21         F_fort=swap23(read_array_nd('F'));
22         err= norm(F(:)-F_fort(:),inf)
23         
24         tol = 10*eps(single(1.));
25         if err < tol
26             fprintf('error %g OK, tol = %g\n',err,tol)
27         elseif err < 0.2
28             warning(sprintf('error %g too large\n',err))
29         else
30             error(sprintf('error %g too large, tol=%g',err,tol))
31         end
33     else
34         warning(['file ',exe,' does not exist'])
35     end
36 end
37 end