forked from bakerb845/fem25
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.f90
48 lines (44 loc) · 1.03 KB
/
test.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module commondat
implicit none
real, public :: a,b,c
data a,b,c / -1.0, -1.0, -1.0/
contains
subroutine outdat()
write(6,'(1x,"a,b,c=",3f7.2)') a,b,c
end subroutine outdat
end module commondat
program tcommon
use commondat
implicit none
call suba()
call subb()
call subc()
call outdat()
end program tcommon
subroutine suba()
! USE the module ... it handles all
! the necessary declarations
use commondat, only : x=>a
implicit none
real :: a = 1.0
x = a
return
end subroutine suba
subroutine subb()
! ONLY use the variable we need ...
! even rename it,all other are 'invisible'
use commondat, only : x=>b
implicit none
real :: a = 2.0
x = a
return
end subroutine subb
subroutine subc()
use commondat, only : x=>c
! note the rename syntax is same as
! pointer assignment
implicit none
real :: a = 3.0
x = a
return
end subroutine subc