Fortran SFF API to data I/O streams in C++

◆ writetest()

subroutine writetest ( character*(*)  filename,
double precision  indt 
)

Definition at line 131 of file fapidtest.f.

Referenced by fapidtest().

131 c
132  character*(*) filename
133  double precision indt
134 c
135  integer m
136  parameter(m=1024)
137  real d(m)
138  integer id(m)
139  equivalence(d,id)
140  integer n,i,j,s,k
141  real p,dx,dt,rate
142 c
143  integer lu, ierr
144  parameter(lu=10)
145  character date*7, time*12,stype*22, wid2line*132, nil*10
146  parameter(nil='NIL')
147 c
148  print *,'write test'
149  print *,'----------'
150  print *,'open ',filename(1:index(filename,' '))
151  dt=indt
152  rate=1./dt
153  dx=1.
154  n=40
155  p=(dt*m)/(dx*n)
156  stype='synthetic'
157  date='110401'
158  time='123209.012345'
159  call sff_prepwid2(m, rate, 'sta ',
160  & 2011, 04, 01, 12, 32, 'chan ', 'aux ', 'ins ',
161  & 10.023456, -1., -1., -1., -1., wid2line, ierr)
162  if (ierr.ne.0) stop 'ERROR: preparing wid2line'
163  call sff_wopens(lu, filename, stype, 'C', 0., 0., 0., date, time, ierr)
164  if (ierr.ne.0) stop 'ERROR: opening file'
165  s=int((dx*p)/dt)
166  k=s
167  do i=1,n
168  print *,'write trace #',i
169  do j=1,m
170  d(j)=0.
171  enddo
172  if (k.le.m) d(k)=1./sqrt(i*dx)
173  k=k+s
174  if (i.eq.n) then
175  call sff_wtracei(lu, wid2line, m, d, id, .true., 'C',
176  & i*dx, 0., 0., 1, ierr)
177  else
178  call sff_wtracei(lu, wid2line, m, d, id, .false., 'C',
179  & i*dx, 0., 0., 1, ierr)
180  endif
181  if (ierr.ne.0) stop 'ERROR: writing trace'
182  enddo
183 c
184  return
Here is the caller graph for this function: