program testwbrb c c - - Test the ability to create platform-independent large-endian binary c - - data files, write to them, read from them c implicit none c c - - datapos, nelem must be 64-bit integers c integer*8 datapos integer*8 nelemc,nelemf,nelemd,nelemi c integer nbpwc,nbpwf,nbpwd,nbpwi,nrep,i character*80 fname c c - - variables to be written c character*40 startlab real sp(100) double precision dp(100) integer isp(100) c c - - variables to be read c character*40 endlab real spr(100) double precision dpr(100) integer ispr(100) c c - - Setting nrep = 3000000 will create a 4.8 GB file. Adjust downward c - - if you don't want a file that big! c nrep=100000 fname="testwbrb.dat" datapos=0 nbpwc=1 nbpwf=4 nbpwd=8 nbpwi=4 nelemc=40 nelemf=100 nelemd=100 nelemi=100 c c - - create data to be written c startlab="Initial string in file" do i=1,100 isp(i)=i sp(i)=sqrt(float(i)) dp(i)=dsqrt(dble(i)) enddo c c - - write the file: c call sdf_wb_f77(fname,datapos,nelemc,nbpwc,startlab) c do i=1,nrep call sdf_wb_f77(fname,datapos,nelemf,nbpwf,sp) call sdf_wb_f77(fname,datapos,nelemi,nbpwi,isp) call sdf_wb_f77(fname,datapos,nelemd,nbpwd,dp) enddo c c - - read the file: c datapos=0 call sdf_rb_f77(fname,datapos,nelemc,nbpwc,endlab) do i=1,nrep call sdf_rb_f77(fname,datapos,nelemf,nbpwf,spr) call sdf_rb_f77(fname,datapos,nelemi,nbpwi,ispr) call sdf_rb_f77(fname,datapos,nelemd,nbpwd,dpr) enddo c c - - print out values that are read in from last read repetition: c write(6,*) "endlab = ",endlab write(6,*) "spr = ", spr write(6,*) "ispr = ", ispr write(6,*) "dpr = ", dpr write(6,*) "final value of datapos = ", datapos c stop end