NADCON5-ng  0.0.1
NADCON5 Next Generation
convlv.f
Go to the documentation of this file.
1 c> \ingroup core
2 c> Part of the NADCON5 \ref core , Convolves two grids
3 c>
4 c> Convolves one grid against another
5 c> \f[
6 c> c(i,j) = a(i,j) * b(i,j)
7 c> \f]
8 c>
9 c> ### Program arguments
10 c> Arguments are newline terminated and read from standard input
11 c>
12 c> When run from the command line, the program prints a prompt for each argument
13 c>
14 c> They are enumerated here
15 c> \param infileA First Input File Name
16 c> \param infileB Second Input File Name
17 c> \param outfile Output File Name of A*B
18 c>
19 c> ### Program Inputs:
20 c>
21 c> - `lin1` Input File A
22 c> - `lin2` Input File B
23 c> - `lout` Output File to Write A+B
24 c>
25  program convlv
26 
27 *** convolve one grid against another:
28 c c(i,j) = a(i,j) * b(i,j)
29 
30  implicit double precision(a-h,o-z)
31  character*88 fname
32  integer hrec1(200049),hrec2(200049)
33  real*4 zrec1(200049),zrec2(200049)
34  equivalence(hrec1(1),zrec1(1))
35  equivalence(hrec2(1),zrec2(1))
36 
37  lin1=1
38  lin2=2
39  lout=3
40 
41  write(6,*) 'program convlv'
42 
43  write(6,3)
44  3 format('Enter "first" input file: ',$)
45  read(5,1) fname
46  1 format(a)
47  open(lin1,file=fname,status='old',form='unformatted')
48 
49  write(6,4)
50  4 format('Enter "second" input file: ',$)
51  read(5,1) fname
52  open(lin2,file=fname,status='old',form='unformatted')
53 
54  write(6,2)
55  2 format('Enter "a*b" output file: ',$)
56  read(5,1) fname
57  open(lout,file=fname,status='new',form='unformatted')
58 
59  read(lin1) glamn1,glomn1,dgla1,dglo1,nla1,nlo1,ikind1
60  read(lin2) glamn2,glomn2,dgla2,dglo2,nla2,nlo2,ikind2
61 
62 *** check compatability
63 
64  if(dabs(glomn1-glomn2).gt.1.d-7) stop 1
65  if(dabs(glamn1-glamn2).gt.1.d-7) stop 6
66  if(dabs(dgla1 -dgla2 ).gt.1.d-7) stop 2
67  if(dabs(dglo1 -dglo2 ).gt.1.d-7) stop 3
68  if(nlo1 .ne.nlo2 ) stop 4
69  if(nla1 .ne.nla2 ) stop 7
70  if(ikind1.ne.ikind2) stop 5
71 
72  write(lout) glamn1,glomn1,dgla1,dglo1,nla1,nlo1,ikind1
73  if(ikind1.eq.0) then
74  do 10 irow=1,nla1
75  read (lin1) (hrec1(i),i=1,nlo1)
76  read (lin2) (hrec2(i),i=1,nlo1)
77  do 11 i=1,nlo1
78  11 hrec1(i)=hrec1(i)+hrec2(i)
79  10 write(lout) (hrec1(i),i=1,nlo1)
80  else
81  do 20 irow=1,nla1
82  read (lin1) (zrec1(i),i=1,nlo1)
83  read (lin2) (zrec2(i),i=1,nlo1)
84  do 21 i=1,nlo1
85  21 zrec1(i)=zrec1(i)*zrec2(i)
86  20 write(lout) (zrec1(i),i=1,nlo1)
87  endif
88 
89  stop
90  end
program convlv
Part of the NADCON5 NADCON5 Core Library , Convolves two grids.
Definition: convlv.f:25