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