2 |
|
|
3 |
implicit none |
implicit none |
4 |
|
|
5 |
private :: increment , dtt, itt, ltt, stt |
private :: increment , dtt, itt, ltt, stt, & |
6 |
|
init, dump_tapestats, & |
7 |
|
dt_grow, it_grow, lt_grow, st_grow, & |
8 |
|
push_i0, push_d1, push_i1, & |
9 |
|
pop_i0, pop_d1, pop_i1, & |
10 |
|
push_d4, push_d6, & |
11 |
|
pop_d4, pop_d6 |
12 |
|
|
13 |
public :: & |
public :: & |
14 |
oad_dt, oad_dt_ptr, oad_dt_sz, oad_dt_grow, & |
oad_dt, oad_dt_ptr, oad_dt_sz, oad_dt_grow, & |
15 |
oad_it, oad_it_ptr, oad_it_sz, oad_it_grow, & |
oad_it, oad_it_ptr, oad_it_sz, oad_it_grow, & |
16 |
oad_lt, oad_lt_ptr, oad_lt_sz, oad_lt_grow, & |
oad_lt, oad_lt_ptr, oad_lt_sz, oad_lt_grow, & |
17 |
oad_st, oad_st_ptr, oad_st_sz, oad_st_grow, & |
oad_st, oad_st_ptr, oad_st_sz, oad_st_grow, & |
18 |
|
oad_chunk_size, & |
19 |
oad_tape_init, & |
oad_tape_init, & |
20 |
oad_dump_tapestats |
oad_dump_tapestats, & |
21 |
|
oad_tape_push, oad_tape_pop |
22 |
|
|
23 |
double precision, dimension(:), allocatable :: oad_dt, dtt |
double precision, dimension(:), allocatable :: oad_dt, dtt |
24 |
integer, dimension(:), allocatable :: oad_it, itt |
integer, dimension(:), allocatable :: oad_it, itt |
29 |
integer :: oad_lt_ptr=0, oad_st_ptr=0 |
integer :: oad_lt_ptr=0, oad_st_ptr=0 |
30 |
integer :: oad_lt_sz=0, oad_st_sz=0 |
integer :: oad_lt_sz=0, oad_st_sz=0 |
31 |
integer :: increment |
integer :: increment |
32 |
|
integer :: oad_chunk_size |
33 |
|
|
34 |
interface oad_tape_init |
interface oad_tape_init |
35 |
module procedure init |
module procedure init |
55 |
module procedure st_grow |
module procedure st_grow |
56 |
end interface |
end interface |
57 |
|
|
58 |
|
interface oad_tape_push |
59 |
|
module procedure push_i0 |
60 |
|
module procedure push_d1, push_i1 |
61 |
|
module procedure push_d4, push_d6 |
62 |
|
end interface |
63 |
|
|
64 |
|
interface oad_tape_pop |
65 |
|
module procedure pop_i0 |
66 |
|
module procedure pop_d1, pop_i1 |
67 |
|
module procedure pop_d4, pop_d6 |
68 |
|
end interface |
69 |
|
|
70 |
contains |
contains |
71 |
|
|
72 |
subroutine init |
subroutine init |
187 |
oad_st_sz=oad_st_sz+increment |
oad_st_sz=oad_st_sz+increment |
188 |
end subroutine st_grow |
end subroutine st_grow |
189 |
|
|
190 |
|
subroutine push_i0(v) |
191 |
|
implicit none |
192 |
|
integer :: v |
193 |
|
if(oad_it_sz .lt. oad_it_ptr+1) call oad_it_grow() |
194 |
|
oad_it(oad_it_ptr)=v; oad_it_ptr=oad_it_ptr+1 |
195 |
|
end subroutine push_i0 |
196 |
|
|
197 |
|
subroutine pop_i0(v) |
198 |
|
implicit none |
199 |
|
integer :: v |
200 |
|
oad_it_ptr=oad_it_ptr-1 |
201 |
|
v=oad_it(oad_it_ptr) |
202 |
|
end subroutine pop_i0 |
203 |
|
|
204 |
|
subroutine push_d1(v) |
205 |
|
implicit none |
206 |
|
double precision :: v(:) |
207 |
|
integer :: chunk |
208 |
|
chunk=size(v,1) |
209 |
|
if(oad_dt_sz .lt. oad_dt_ptr+chunk) call oad_dt_grow() |
210 |
|
oad_dt(oad_dt_ptr:oad_dt_ptr+chunk-1)=v; oad_dt_ptr=oad_dt_ptr+chunk |
211 |
|
end subroutine push_d1 |
212 |
|
|
213 |
|
subroutine push_i1(v) |
214 |
|
implicit none |
215 |
|
integer :: v(:) |
216 |
|
integer :: chunk |
217 |
|
chunk=size(v,1) |
218 |
|
if(oad_it_sz .lt. oad_it_ptr+chunk) call oad_it_grow() |
219 |
|
oad_it(oad_it_ptr:oad_it_ptr+chunk-1)=v; oad_it_ptr=oad_it_ptr+chunk |
220 |
|
end subroutine push_i1 |
221 |
|
|
222 |
|
subroutine push_d4(v) |
223 |
|
implicit none |
224 |
|
double precision :: v(:,:,:,:) |
225 |
|
integer :: chunk(1), dims(4) |
226 |
|
dims=shape(v) |
227 |
|
chunk(1)=dims(1)*dims(2)*dims(3)*dims(4) |
228 |
|
do while (oad_dt_sz .lt. oad_dt_ptr+chunk(1)) |
229 |
|
call oad_dt_grow() |
230 |
|
end do |
231 |
|
oad_dt(oad_dt_ptr:oad_dt_ptr+chunk(1)-1)=reshape(v,chunk) |
232 |
|
oad_dt_ptr=oad_dt_ptr+chunk(1) |
233 |
|
end subroutine push_d4 |
234 |
|
|
235 |
|
subroutine push_d6(v) |
236 |
|
implicit none |
237 |
|
double precision :: v(:,:,:,:,:,:) |
238 |
|
integer :: chunk(1), dims(6) |
239 |
|
dims=shape(v) |
240 |
|
chunk(1)=dims(1)*dims(2)*dims(3)*dims(4)*dims(5)*dims(6) |
241 |
|
do while (oad_dt_sz .lt. oad_dt_ptr+chunk(1)) |
242 |
|
call oad_dt_grow() |
243 |
|
end do |
244 |
|
oad_dt(oad_dt_ptr:oad_dt_ptr+chunk(1)-1)=reshape(v,chunk) |
245 |
|
oad_dt_ptr=oad_dt_ptr+chunk(1) |
246 |
|
end subroutine push_d6 |
247 |
|
|
248 |
|
subroutine pop_d1(v) |
249 |
|
implicit none |
250 |
|
double precision :: v(:) |
251 |
|
integer :: chunk |
252 |
|
chunk=size(v,1) |
253 |
|
oad_dt_ptr=oad_dt_ptr-chunk |
254 |
|
v=oad_dt(oad_dt_ptr:oad_dt_ptr+chunk-1) |
255 |
|
end subroutine pop_d1 |
256 |
|
|
257 |
|
subroutine pop_i1(v) |
258 |
|
implicit none |
259 |
|
integer :: v(:) |
260 |
|
integer :: chunk |
261 |
|
chunk=size(v,1) |
262 |
|
oad_it_ptr=oad_it_ptr-chunk |
263 |
|
v=oad_it(oad_it_ptr:oad_it_ptr+chunk-1) |
264 |
|
end subroutine pop_i1 |
265 |
|
|
266 |
|
subroutine pop_d4(v) |
267 |
|
implicit none |
268 |
|
double precision :: v(:,:,:,:) |
269 |
|
integer :: chunk, dims(4) |
270 |
|
dims=shape(v) |
271 |
|
chunk=dims(1)*dims(2)*dims(3)*dims(4) |
272 |
|
oad_dt_ptr=oad_dt_ptr-chunk |
273 |
|
v=reshape(oad_dt(oad_dt_ptr:oad_dt_ptr+chunk-1),dims) |
274 |
|
end subroutine pop_d4 |
275 |
|
|
276 |
|
subroutine pop_d6(v) |
277 |
|
implicit none |
278 |
|
double precision :: v(:,:,:,:,:,:) |
279 |
|
integer :: chunk, dims(6) |
280 |
|
dims=shape(v) |
281 |
|
chunk=dims(1)*dims(2)*dims(3)*dims(4)*dims(5)*dims(6) |
282 |
|
oad_dt_ptr=oad_dt_ptr-chunk |
283 |
|
v=reshape(oad_dt(oad_dt_ptr:oad_dt_ptr+chunk-1),dims) |
284 |
|
end subroutine pop_d6 |
285 |
|
|
286 |
end module |
end module |