/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/OAD_support/OAD_tape.f90
ViewVC logotype

Annotation of /MITgcm_contrib/heimbach/OpenAD/OAD_support/OAD_tape.f90

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Nov 20 15:19:43 2007 UTC (18 years, 9 months ago) by utke
Branch: MAIN
common runtime support

1 utke 1.1 module OAD_tape
2     implicit none
3    
4     private
5     public :: double_tape, double_tmp_tape, &
6     & double_tape_pointer, double_tape_size, &
7     & integer_tape, integer_tmp_tape, &
8     & integer_tape_pointer, integer_tape_size, &
9     & logical_tape, logical_tmp_tape, &
10     & logical_tape_pointer, logical_tape_size, &
11     & string_tape, string_tmp_tape, &
12     & string_tape_pointer, string_tape_size, &
13     & tape_init, tape_increment, &
14     & oad_dt_grow
15    
16     double precision, dimension(:), allocatable :: double_tape, double_tmp_tape
17     integer, dimension(:), allocatable :: integer_tape, integer_tmp_tape
18     logical, dimension(:), allocatable :: logical_tape, logical_tmp_tape
19     character(80), dimension(:), allocatable :: string_tape, string_tmp_tape
20     integer :: double_tape_pointer=0, integer_tape_pointer=0
21     integer :: double_tape_size=0, integer_tape_size=0
22     integer :: logical_tape_pointer=0, string_tape_pointer=0
23     integer :: logical_tape_size=0, string_tape_size=0
24     integer :: tape_increment
25    
26     interface tape_init
27     module procedure init
28     end interface
29    
30     interface oad_dt_grow
31     module procedure dt_grow
32     end interface
33    
34     contains
35    
36     subroutine init
37     double_tape_pointer=1
38     if (allocated(double_tape)) then
39     deallocate(double_tape)
40     end if
41     double_tape_size=1048576
42     allocate(double_tape(double_tape_size))
43     integer_tape_pointer=1
44     if (allocated(integer_tape)) then
45     deallocate(integer_tape)
46     end if
47     integer_tape_size=1048576
48     allocate(integer_tape(integer_tape_size))
49     logical_tape_pointer=1
50     if (allocated(logical_tape)) then
51     deallocate(logical_tape)
52     end if
53     logical_tape_size=1048576
54     allocate(logical_tape(logical_tape_size))
55     string_tape_size=1048576
56     allocate(string_tape(string_tape_size))
57     string_tape_pointer=1
58     if (allocated(string_tape)) then
59     deallocate(string_tape)
60     end if
61     string_tape_size=1048576
62     allocate(string_tape(string_tape_size))
63     tape_increment=16777216
64     end subroutine init
65    
66     subroutine dt_grow
67     integer status
68     print *, "DT+ ", double_tape_size
69     allocate(double_tmp_tape(double_tape_size),STAT=status)
70     if (status .gt. 0 ) then
71     print *,'allocation (1)failed with', status
72     stop
73     end if
74     double_tmp_tape=double_tape
75     deallocate(double_tape)
76     allocate(double_tape(double_tape_size+tape_increment),STAT=status)
77     if (status .gt. 0 ) then
78     print *,'allocation (2)failed with', status
79     stop
80     end if
81     double_tape(1:double_tape_size) = double_tmp_tape
82     deallocate(double_tmp_tape)
83     double_tape_size=double_tape_size+tape_increment
84     end subroutine dt_grow
85    
86     end module

  ViewVC Help
Powered by ViewVC 1.1.22