[Getdp] flush buffer in Sparskit/inout.f

wm214 at maths.bath.ac.uk wm214 at maths.bath.ac.uk
Wed Apr 18 13:21:44 CEST 2007


Hi,

I have just started using gmsh/getdp and believe it will prove very useful
for a project I am working on.  For this project, I need to save a copy
of the system matrix, so in solver.par I set MATRIX_PRINTING to 1.

However, in the text files fort.12 and fort.30 only the first line
of output appears.  Both files are written from fortran routines in
Sparskit/inout.f and the problem seems to be that the relevant buffers are
not being flushed before the files are closed.  In any case, the patch
shown below has fixed the problem for me.  (My fortran compiler is g95 and
I am running the Linux kernel version 2.6.18.2-34-default with gcc version
4.1.2 20061115 on x86_64.)

I guess it would be better to flush the buffers in Sparskit/Solvers.c
after each fortran routine gets called, but I wasn't sure how to do this.

Bill McLean


inout.f.patch:



*** inout.f.orig        2007-04-18 10:33:22.000000000 +0100
--- inout.f     2007-04-18 11:56:23.000000000 +0100
***************
*** 785,790 ****
--- 785,791 ----
    1    continue
   c-----------------------------------------------------------------------
         write(iunt,10) 'showpage'
+       flush(iunt)
         return
   c
    10   format (A)
***************
*** 1381,1386 ****
--- 1382,1388 ----
         write(iounit,ptrfmt,err=1000) (ia(i), i = 1, n+1)
         write(iounit,indfmt,err=1000) (ja(i), i = 1, nnz)
         write(iounit,valfmt,err=1000) ( a(i), i = 1, nnz)
+       flush(iounit)
   c
   c     done, if no trouble is encounted in writing data
   c