/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/OAD_support/OAD_active.F90
ViewVC logotype

Annotation of /MITgcm_contrib/heimbach/OpenAD/OAD_support/OAD_active.F90

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


Revision 1.7 - (hide annotations) (download)
Sun May 23 14:29:13 2010 UTC (16 years, 3 months ago) by utke
Branch: MAIN
Changes since 1.6: +18 -0 lines
fix up for exch1 changes and consolidate with OpenAD default run time files

1 utke 1.5 !#########################################################
2     ! This file is part of OpenAD released under the LGPL. #
3     ! The full COPYRIGHT notice can be found in the top #
4     ! level directory of the OpenAD distribution #
5     !#########################################################
6 utke 1.1 module OAD_active
7     use w2f__types
8     implicit none
9 utke 1.6 private :: runTimeErrorStop, shapeChange
10     public :: active
11     #ifndef TRACE
12     public :: saxpy, sax, zero_deriv, setderiv
13     public :: set_neg_deriv, inc_deriv, dec_deriv
14     #endif
15     public :: oad_convert, oad_allocateMatching, oad_shapeTest
16     #ifndef TRACE
17     integer :: count_mult = 0
18     integer :: count_add = 0
19     #endif
20     integer, parameter :: shapeChange=0
21     #ifdef VECTOR
22     integer :: max_deriv_vec_len
23     parameter ( max_deriv_vec_len = 100 )
24     # define VECTOR_DIM , dimension(max_deriv_vec_len)
25     # define VECTOR_LOOP_VAR integer :: i
26     # define VECTOR_LOOP_BEGIN do i=1,max_deriv_vec_len
27     # define VECTOR_LOOP_END end do
28     # define DELEM d(i)
29     #else
30     # define VECTOR_DIM
31     # define VECTOR_LOOP_VAR
32     # define VECTOR_LOOP_BEGIN
33     # define VECTOR_LOOP_END
34     # define DELEM d
35     #endif
36     #ifdef SCALARNDI
37     # define DINIT
38     #else
39     # define DINIT =0.0d0
40     #endif
41 utke 1.1
42     !
43     ! active needs to be a sequence type
44     ! with no initialization
45     !
46     type active
47     sequence
48     real(w2f__8) :: v
49 utke 1.6 #ifndef TRACE
50 utke 1.1 ! initialization does not work for active variables
51     ! inside of common block, such as in boxmodel
52     ! initialization is required for correct adjoint
53 utke 1.6 real(w2f__8) VECTOR_DIM :: d DINIT
54     #endif
55     end type
56     #ifndef TRACE
57 utke 1.1 interface saxpy
58 utke 1.6 module procedure saxpy_d0_a0_a0, saxpy_l0_a0_a0, saxpy_i0_a0_a0
59     module procedure saxpy_d1_a1_a1, saxpy_l1_a1_a1, saxpy_i1_a1_a1
60 utke 1.1 end interface
61    
62     interface setderiv
63 utke 1.6 module procedure setderiv_a0_a0
64     module procedure setderiv_a1_a1
65 utke 1.1 end interface
66    
67 utke 1.3 interface set_neg_deriv
68 utke 1.6 module procedure set_neg_deriv_a0_a0
69     module procedure set_neg_deriv_a1_a1
70 utke 1.3 end interface set_neg_deriv
71    
72     interface inc_deriv
73 utke 1.6 module procedure inc_deriv_a0_a0
74     module procedure inc_deriv_a1_a1
75 utke 1.3 end interface inc_deriv
76    
77     interface dec_deriv
78 utke 1.6 module procedure dec_deriv_a0_a0
79     module procedure dec_deriv_a1_a1
80 utke 1.3 end interface dec_deriv
81    
82 utke 1.1 interface zero_deriv
83 utke 1.6 module procedure zero_deriv_a0
84     module procedure zero_deriv_a1
85     module procedure zero_deriv_a2
86     module procedure zero_deriv_a3
87     module procedure zero_deriv_a4
88 utke 1.1 end interface
89 utke 1.6
90 utke 1.1 interface sax
91 utke 1.6 module procedure sax_d0_a0_a0, sax_l0_a0_a0, sax_i0_a0_a0
92     module procedure sax_d1_a1_a1, sax_l1_a1_a1, sax_i1_a1_a1
93 utke 1.1 end interface
94    
95 utke 1.2 #endif
96 utke 1.6 interface oad_convert
97     module procedure convert_d0_a0
98     module procedure convert_d1_a1
99     module procedure convert_d2_a2
100     module procedure convert_d3_a3
101     module procedure convert_d4_a4
102     module procedure convert_d5_a5
103     module procedure convert_d6_a6
104     module procedure convert_d7_a7
105     module procedure convert_a0_d0
106     module procedure convert_a1_d1
107     module procedure convert_a2_d2
108     module procedure convert_a3_d3
109     module procedure convert_a4_d4
110     module procedure convert_a5_d5
111     module procedure convert_a6_d6
112     module procedure convert_a7_d7
113     #ifndef DEFAULT_R8
114     module procedure convert_r0_a0
115     module procedure convert_r1_a1
116     module procedure convert_r2_a2
117     module procedure convert_r3_a3
118     module procedure convert_r4_a4
119     module procedure convert_r5_a5
120     module procedure convert_r6_a6
121     module procedure convert_r7_a7
122     module procedure convert_a0_r0
123     module procedure convert_a1_r1
124     module procedure convert_a2_r2
125     module procedure convert_a3_r3
126     module procedure convert_a4_r4
127     module procedure convert_a5_r5
128     module procedure convert_a6_r6
129     module procedure convert_a7_r7
130 utke 1.2 #endif
131 utke 1.1 end interface
132    
133 utke 1.6 interface oad_allocateMatching
134     module procedure allocateMatching_a1_d1
135     module procedure allocateMatching_a1_a1
136     module procedure allocateMatching_d1_a1
137     module procedure allocateMatching_a2_a2
138     module procedure allocateMatching_d2_a2
139     module procedure allocateMatching_a4_a4
140     module procedure allocateMatching_d4_a4
141     module procedure allocateMatching_a5_a5
142     module procedure allocateMatching_d5_a5
143 utke 1.7 module procedure allocateMatching_a5_d5
144 utke 1.6 #ifndef DEFAULT_R8
145     module procedure allocateMatching_r1_a1
146     module procedure allocateMatching_r2_a2
147 utke 1.2 #endif
148 utke 1.6 end interface
149 utke 1.1
150 utke 1.6 interface oad_shapeTest
151     module procedure shapeTest_a1_d1
152     module procedure shapeTest_a1_a1
153     module procedure shapeTest_d1_a1
154     module procedure shapeTest_a2_a2
155     module procedure shapeTest_d2_a2
156     module procedure shapeTest_a4_a4
157     module procedure shapeTest_d4_a4
158     module procedure shapeTest_a5_a5
159     module procedure shapeTest_d5_a5
160 utke 1.7 module procedure shapeTest_a5_d5
161 utke 1.6 #ifndef DEFAULT_R8
162     module procedure shapeTest_r1_a1
163     module procedure shapeTest_r2_a2
164 utke 1.3 #endif
165     end interface
166    
167 utke 1.6 interface runTimeErrorStop
168     module procedure runTimeErrorStopI
169 utke 1.5 end interface
170    
171 utke 1.1 contains
172 utke 1.6 #ifndef TRACE
173 utke 1.1 !
174     ! chain rule saxpy to be used in forward and reverse modes
175     !
176    
177 utke 1.6 subroutine saxpy_d0_a0_a0(a,x,y)
178 utke 1.1 real(w2f__8), intent(in) :: a
179     type(active), intent(in) :: x
180     type(active), intent(inout) :: y
181 utke 1.6 VECTOR_LOOP_VAR
182     VECTOR_LOOP_BEGIN
183     y%DELEM = y%DELEM + x%DELEM*a
184     VECTOR_LOOP_END
185     end subroutine
186    
187     subroutine saxpy_i0_a0_a0(a,x,y)
188     integer(kind=w2f__i4), intent(in) :: a
189     type(active), intent(in) :: x
190     type(active), intent(inout) :: y
191     VECTOR_LOOP_VAR
192     VECTOR_LOOP_BEGIN
193     y%DELEM = y%DELEM + x%DELEM*a
194     VECTOR_LOOP_END
195     end subroutine
196 utke 1.1
197 utke 1.6 subroutine saxpy_l0_a0_a0(a,x,y)
198     integer(kind=w2f__i8), intent(in) :: a
199     type(active), intent(in) :: x
200     type(active), intent(inout) :: y
201     VECTOR_LOOP_VAR
202     VECTOR_LOOP_BEGIN
203     y%DELEM = y%DELEM + x%DELEM*a
204     VECTOR_LOOP_END
205     end subroutine
206    
207     subroutine saxpy_d1_a1_a1(a,x,y)
208     real(w2f__8), dimension(:), intent(in) :: a
209     type(active), dimension(:), intent(in) :: x
210     type(active), dimension(:), intent(inout) :: y
211     VECTOR_LOOP_VAR
212     VECTOR_LOOP_BEGIN
213     y%DELEM=y%DELEM+x%DELEM*a
214     VECTOR_LOOP_END
215     end subroutine
216    
217     subroutine saxpy_i1_a1_a1(a,x,y)
218     integer(kind=w2f__i4), dimension(:), intent(in) :: a
219     type(active), dimension(:), intent(in) :: x
220     type(active), dimension(:), intent(inout) :: y
221     VECTOR_LOOP_VAR
222     VECTOR_LOOP_BEGIN
223     y%DELEM=y%DELEM+x%DELEM*a
224     VECTOR_LOOP_END
225     end subroutine
226    
227     subroutine saxpy_l1_a1_a1(a,x,y)
228     integer(kind=w2f__i8), dimension(:), intent(in) :: a
229     type(active), dimension(:), intent(in) :: x
230     type(active), dimension(:), intent(inout) :: y
231     VECTOR_LOOP_VAR
232     VECTOR_LOOP_BEGIN
233     y%DELEM=y%DELEM+x%DELEM*a
234     VECTOR_LOOP_END
235     end subroutine
236    
237 utke 1.1 !
238     ! chain rule saxpy to be used in forward and reverse modes
239     ! derivative component of y is equal to zero initially
240     ! note: y needs to be inout as otherwise value component gets
241     ! zeroed out
242     !
243    
244 utke 1.6 subroutine sax_d0_a0_a0(a,x,y)
245 utke 1.1 real(w2f__8), intent(in) :: a
246     type(active), intent(in) :: x
247     type(active), intent(inout) :: y
248 utke 1.6 VECTOR_LOOP_VAR
249     VECTOR_LOOP_BEGIN
250     y%DELEM = x%DELEM*a
251     VECTOR_LOOP_END
252     end subroutine
253    
254     subroutine sax_i0_a0_a0(a,x,y)
255     integer(kind=w2f__i4), intent(in) :: a
256     type(active), intent(in) :: x
257     type(active), intent(inout) :: y
258     VECTOR_LOOP_VAR
259     VECTOR_LOOP_BEGIN
260     y%DELEM = x%DELEM*a
261     VECTOR_LOOP_END
262     end subroutine
263 utke 1.1
264 utke 1.6 subroutine sax_l0_a0_a0(a,x,y)
265 utke 1.1 integer(kind=w2f__i8), intent(in) :: a
266     type(active), intent(in) :: x
267     type(active), intent(inout) :: y
268 utke 1.6 VECTOR_LOOP_VAR
269     VECTOR_LOOP_BEGIN
270     y%DELEM = x%DELEM*a
271     VECTOR_LOOP_END
272     end subroutine
273    
274     subroutine sax_d1_a1_a1(a,x,y)
275     real(w2f__8), dimension(:), intent(in) :: a
276     type(active), dimension(:), intent(in) :: x
277     type(active), dimension(:), intent(inout) :: y
278     VECTOR_LOOP_VAR
279     VECTOR_LOOP_BEGIN
280     y%DELEM=x%DELEM*a
281     VECTOR_LOOP_END
282     end subroutine
283    
284     subroutine sax_i1_a1_a1(a,x,y)
285     integer(kind=w2f__i4), dimension(:), intent(in) :: a
286     type(active), dimension(:), intent(in) :: x
287     type(active), dimension(:), intent(inout) :: y
288     VECTOR_LOOP_VAR
289     VECTOR_LOOP_BEGIN
290     y%DELEM=x%DELEM*a
291     VECTOR_LOOP_END
292     end subroutine
293    
294     subroutine sax_l1_a1_a1(a,x,y)
295     integer(kind=w2f__i8), dimension(:), intent(in) :: a
296     type(active), dimension(:), intent(in) :: x
297     type(active), dimension(:), intent(inout) :: y
298     VECTOR_LOOP_VAR
299     VECTOR_LOOP_BEGIN
300     y%DELEM=x%DELEM*a
301     VECTOR_LOOP_END
302     end subroutine
303    
304 utke 1.1 !
305     ! set derivative of y to be equal to derivative of x
306     ! note: making y inout allows for already existing active
307     ! variables to become the target of a derivative assignment
308     !
309    
310 utke 1.6 subroutine setderiv_a0_a0(y,x)
311 utke 1.1 type(active), intent(inout) :: y
312     type(active), intent(in) :: x
313 utke 1.6 VECTOR_LOOP_VAR
314     VECTOR_LOOP_BEGIN
315     y%DELEM = x%DELEM
316     VECTOR_LOOP_END
317     end subroutine
318    
319     subroutine setderiv_a1_a1(y,x)
320     type(active), intent(inout), dimension(:) :: y
321     type(active), intent(in), dimension(:) :: x
322     VECTOR_LOOP_VAR
323     VECTOR_LOOP_BEGIN
324     y%DELEM = x%DELEM
325     VECTOR_LOOP_END
326     end subroutine
327 utke 1.1
328     !
329 utke 1.3 ! set the derivative of y to be the negated derivative of x
330     ! note: making y inout allows for already existing active
331     ! variables to become the target of a derivative assignment
332     !
333    
334 utke 1.6 subroutine set_neg_deriv_a0_a0(y,x)
335 utke 1.3 type(active), intent(inout) :: y
336     type(active), intent(in) :: x
337 utke 1.6 VECTOR_LOOP_VAR
338     VECTOR_LOOP_BEGIN
339     y%DELEM = -x%DELEM
340     VECTOR_LOOP_END
341     end subroutine
342    
343     subroutine set_neg_deriv_a1_a1(y,x)
344     type(active), intent(inout), dimension(:) :: y
345     type(active), intent(in), dimension(:) :: x
346     VECTOR_LOOP_VAR
347     VECTOR_LOOP_BEGIN
348     y%DELEM = -x%DELEM
349     VECTOR_LOOP_END
350     end subroutine
351 utke 1.3
352     !
353     ! increment the derivative of y by the derivative of x
354     ! note: making y inout allows for already existing active
355     ! variables to become the target of a derivative assignment
356     !
357    
358 utke 1.6 subroutine inc_deriv_a0_a0(y,x)
359 utke 1.3 type(active), intent(inout) :: y
360     type(active), intent(in) :: x
361 utke 1.6 VECTOR_LOOP_VAR
362     VECTOR_LOOP_BEGIN
363     y%DELEM = y%DELEM + x%DELEM
364     VECTOR_LOOP_END
365     end subroutine
366    
367     subroutine inc_deriv_a1_a1(y,x)
368     type(active), intent(inout), dimension(:) :: y
369     type(active), intent(in), dimension(:) :: x
370     VECTOR_LOOP_VAR
371     VECTOR_LOOP_BEGIN
372     y%DELEM = y%DELEM + x%DELEM
373     VECTOR_LOOP_END
374     end subroutine
375 utke 1.3
376     !
377     ! decrement the derivative of y by the derivative of x
378     ! note: making y inout allows for already existing active
379     ! variables to become the target of a derivative assignment
380     !
381    
382 utke 1.6 subroutine dec_deriv_a0_a0(y,x)
383 utke 1.3 type(active), intent(inout) :: y
384     type(active), intent(in) :: x
385 utke 1.6 VECTOR_LOOP_VAR
386     VECTOR_LOOP_BEGIN
387     y%DELEM = y%DELEM - x%DELEM
388     VECTOR_LOOP_END
389     end subroutine
390 utke 1.3
391 utke 1.6 subroutine dec_deriv_a1_a1(y,x)
392     type(active), intent(inout), dimension(:) :: y
393     type(active), intent(in), dimension(:) :: x
394     VECTOR_LOOP_VAR
395     VECTOR_LOOP_BEGIN
396     y%DELEM = y%DELEM - x%DELEM
397     VECTOR_LOOP_END
398     end subroutine
399    
400 utke 1.3 !
401 utke 1.1 ! set derivative components to 0.0
402     !
403 utke 1.6 subroutine zero_deriv_a0(x)
404 utke 1.1 type(active), intent(inout) :: x
405 utke 1.6 VECTOR_LOOP_VAR
406     VECTOR_LOOP_BEGIN
407     x%DELEM=0.0d0
408     VECTOR_LOOP_END
409     end subroutine
410 utke 1.1
411 utke 1.6 subroutine zero_deriv_a1(x)
412     type(active), dimension(:), intent(inout) :: x
413     VECTOR_LOOP_VAR
414     VECTOR_LOOP_BEGIN
415     x%DELEM=0.0d0
416     VECTOR_LOOP_END
417     end subroutine
418    
419     subroutine zero_deriv_a2(x)
420     type(active), dimension(:,:), intent(inout) :: x
421     VECTOR_LOOP_VAR
422     VECTOR_LOOP_BEGIN
423     x%DELEM=0.0d0
424     VECTOR_LOOP_END
425     end subroutine
426    
427     subroutine zero_deriv_a3(x)
428     type(active), dimension(:,:,:), intent(inout) :: x
429     VECTOR_LOOP_VAR
430     VECTOR_LOOP_BEGIN
431     x%DELEM=0.0d0
432     VECTOR_LOOP_END
433     end subroutine
434    
435     subroutine zero_deriv_a4(x)
436     type(active), dimension(:,:,:,:), intent(inout) :: x
437     VECTOR_LOOP_VAR
438     VECTOR_LOOP_BEGIN
439     x%DELEM=0.0d0
440     VECTOR_LOOP_END
441     end subroutine
442    
443     #endif
444 utke 1.1 !
445 utke 1.6 ! conversions
446 utke 1.1 !
447 utke 1.6 subroutine convert_d0_a0(convertTo, convertFrom)
448     real(w2f__8), intent(out) :: convertTo
449 utke 1.1 type(active), intent(in) :: convertFrom
450     convertTo=convertFrom%v
451     end subroutine
452 utke 1.6 subroutine convert_d1_a1(convertTo, convertFrom)
453     real(w2f__8), dimension(:), intent(out) :: convertTo
454     type(active), dimension(:), intent(in) :: convertFrom
455 utke 1.1 convertTo=convertFrom%v
456     end subroutine
457 utke 1.6 subroutine convert_d2_a2(convertTo, convertFrom)
458     real(w2f__8), dimension(:,:), intent(out) :: convertTo
459     type(active), dimension(:,:), intent(in) :: convertFrom
460 utke 1.1 convertTo=convertFrom%v
461     end subroutine
462 utke 1.6 subroutine convert_d3_a3(convertTo, convertFrom)
463     real(w2f__8), dimension(:,:,:), intent(out) :: convertTo
464     type(active), dimension(:,:,:), intent(in) :: convertFrom
465 utke 1.1 convertTo=convertFrom%v
466     end subroutine
467 utke 1.6 subroutine convert_d4_a4(convertTo, convertFrom)
468     real(w2f__8), dimension(:,:,:,:), intent(out) :: convertTo
469     type(active), dimension(:,:,:,:), intent(in) :: convertFrom
470     convertTo=convertFrom%v
471 utke 1.1 end subroutine
472 utke 1.6 subroutine convert_d5_a5(convertTo, convertFrom)
473     real(w2f__8), dimension(:,:,:,:,:), intent(out) :: convertTo
474     type(active), dimension(:,:,:,:,:), intent(in) :: convertFrom
475     convertTo=convertFrom%v
476 utke 1.1 end subroutine
477 utke 1.6 subroutine convert_d6_a6(convertTo, convertFrom)
478     real(w2f__8), dimension(:,:,:,:,:,:), intent(out) :: convertTo
479     type(active), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
480 utke 1.1 convertTo=convertFrom%v
481     end subroutine
482 utke 1.6 subroutine convert_d7_a7(convertTo, convertFrom)
483     real(w2f__8), dimension(:,:,:,:,:,:,:), intent(out) :: convertTo
484     type(active), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
485 utke 1.1 convertTo=convertFrom%v
486     end subroutine
487    
488 utke 1.6 subroutine convert_a0_d0(convertTo, convertFrom)
489     type(active), intent(inout) :: convertTo
490     real(w2f__8), intent(in) :: convertFrom
491     convertTo%v=convertFrom
492     end subroutine
493     subroutine convert_a1_d1(convertTo, convertFrom)
494     type(active), dimension(:), intent(inout) :: convertTo
495     real(w2f__8), dimension(:), intent(in) :: convertFrom
496     convertTo%v=convertFrom
497     end subroutine
498     subroutine convert_a2_d2(convertTo, convertFrom)
499 utke 1.2 type(active), dimension(:,:), intent(inout) :: convertTo
500 utke 1.6 real(w2f__8), dimension(:,:), intent(in) :: convertFrom
501 utke 1.2 convertTo%v=convertFrom
502     end subroutine
503 utke 1.6 subroutine convert_a3_d3(convertTo, convertFrom)
504     type(active), dimension(:,:,:), intent(inout) :: convertTo
505     real(w2f__8), dimension(:,:,:), intent(in) :: convertFrom
506 utke 1.1 convertTo%v=convertFrom
507     end subroutine
508 utke 1.6 subroutine convert_a4_d4(convertTo, convertFrom)
509     type(active), dimension(:,:,:,:), intent(inout) :: convertTo
510     real(w2f__8), dimension(:,:,:,:), intent(in) :: convertFrom
511     convertTo%v=convertFrom
512 utke 1.1 end subroutine
513 utke 1.6 subroutine convert_a5_d5(convertTo, convertFrom)
514     type(active), dimension(:,:,:,:,:), intent(inout) :: convertTo
515     real(w2f__8), dimension(:,:,:,:,:), intent(in) :: convertFrom
516     convertTo%v=convertFrom
517 utke 1.1 end subroutine
518 utke 1.6 subroutine convert_a6_d6(convertTo, convertFrom)
519     type(active), dimension(:,:,:,:,:,:), intent(inout) :: convertTo
520     real(w2f__8), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
521 utke 1.1 convertTo%v=convertFrom
522     end subroutine
523 utke 1.6 subroutine convert_a7_d7(convertTo, convertFrom)
524     type(active), dimension(:,:,:,:,:,:,:), intent(inout) :: convertTo
525     real(w2f__8), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
526 utke 1.1 convertTo%v=convertFrom
527     end subroutine
528 utke 1.6 #ifndef DEFAULT_R8
529     subroutine convert_r0_a0(convertTo, convertFrom)
530     real(w2f__4), intent(out) :: convertTo
531     type(active), intent(in) :: convertFrom
532 utke 1.1 convertTo=convertFrom%v
533     end subroutine
534 utke 1.6 subroutine convert_r1_a1(convertTo, convertFrom)
535     real(w2f__4), dimension(:), intent(out) :: convertTo
536     type(active), dimension(:), intent(in) :: convertFrom
537 utke 1.1 convertTo=convertFrom%v
538     end subroutine
539 utke 1.6 subroutine convert_r2_a2(convertTo, convertFrom)
540     real(w2f__4), dimension(:,:), intent(out) :: convertTo
541     type(active), dimension(:,:), intent(in) :: convertFrom
542     convertTo=convertFrom%v
543 utke 1.1 end subroutine
544 utke 1.6 subroutine convert_r3_a3(convertTo, convertFrom)
545     real(w2f__4), dimension(:,:,:), intent(out) :: convertTo
546     type(active), dimension(:,:,:), intent(in) :: convertFrom
547     convertTo=convertFrom%v
548 utke 1.1 end subroutine
549 utke 1.6 subroutine convert_r4_a4(convertTo, convertFrom)
550     real(w2f__4), dimension(:,:,:,:), intent(out) :: convertTo
551     type(active), dimension(:,:,:,:), intent(in) :: convertFrom
552 utke 1.1 convertTo=convertFrom%v
553     end subroutine
554 utke 1.6 subroutine convert_r5_a5(convertTo, convertFrom)
555     real(w2f__4), dimension(:,:,:,:,:), intent(out) :: convertTo
556 utke 1.1 type(active), dimension(:,:,:,:,:), intent(in) :: convertFrom
557     convertTo=convertFrom%v
558     end subroutine
559 utke 1.6 subroutine convert_r6_a6(convertTo, convertFrom)
560     real(w2f__4), dimension(:,:,:,:,:,:), intent(out) :: convertTo
561 utke 1.3 type(active), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
562     convertTo=convertFrom%v
563     end subroutine
564 utke 1.6 subroutine convert_r7_a7(convertTo, convertFrom)
565     real(w2f__4), dimension(:,:,:,:,:,:,:), intent(out) :: convertTo
566     type(active), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
567 utke 1.3 convertTo=convertFrom%v
568     end subroutine
569    
570 utke 1.6 subroutine convert_a0_r0(convertTo, convertFrom)
571     type(active), intent(inout) :: convertTo
572     real(w2f__4), intent(in) :: convertFrom
573     convertTo%v=convertFrom
574     end subroutine
575     subroutine convert_a1_r1(convertTo, convertFrom)
576     type(active), dimension(:), intent(inout) :: convertTo
577     real(w2f__4), dimension(:), intent(in) :: convertFrom
578     convertTo%v=convertFrom
579     end subroutine
580     subroutine convert_a2_r2(convertTo, convertFrom)
581     type(active), dimension(:,:), intent(inout) :: convertTo
582     real(w2f__4), dimension(:,:), intent(in) :: convertFrom
583 utke 1.3 convertTo%v=convertFrom
584     end subroutine
585 utke 1.6 subroutine convert_a3_r3(convertTo, convertFrom)
586     type(active), dimension(:,:,:), intent(inout) :: convertTo
587     real(w2f__4), dimension(:,:,:), intent(in) :: convertFrom
588 utke 1.3 convertTo%v=convertFrom
589     end subroutine
590 utke 1.6 subroutine convert_a4_r4(convertTo, convertFrom)
591     type(active), dimension(:,:,:,:), intent(inout) :: convertTo
592     real(w2f__4), dimension(:,:,:,:), intent(in) :: convertFrom
593     convertTo%v=convertFrom
594 utke 1.3 end subroutine
595 utke 1.6 subroutine convert_a5_r5(convertTo, convertFrom)
596     type(active), dimension(:,:,:,:,:), intent(inout) :: convertTo
597     real(w2f__4), dimension(:,:,:,:,:), intent(in) :: convertFrom
598     convertTo%v=convertFrom
599 utke 1.3 end subroutine
600 utke 1.6 subroutine convert_a6_r6(convertTo, convertFrom)
601     type(active), dimension(:,:,:,:,:,:), intent(inout) :: convertTo
602     real(w2f__4), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
603 utke 1.3 convertTo%v=convertFrom
604     end subroutine
605 utke 1.6 subroutine convert_a7_r7(convertTo, convertFrom)
606 utke 1.3 type(active), dimension(:,:,:,:,:,:,:), intent(inout) :: convertTo
607 utke 1.6 real(w2f__4), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
608 utke 1.3 convertTo%v=convertFrom
609     end subroutine
610 utke 1.6 #endif
611     !
612     ! allocations
613     !
614     subroutine allocateMatching_a1_d1(toBeAllocated,allocateMatching)
615 utke 1.5 implicit none
616     type(active), dimension(:), allocatable :: toBeAllocated
617     real(w2f__8), dimension(:) :: allocateMatching
618     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
619     end subroutine
620 utke 1.6 subroutine allocateMatching_a1_a1(toBeAllocated,allocateMatching)
621 utke 1.3 implicit none
622     type(active), dimension(:), allocatable :: toBeAllocated
623     type(active), dimension(:) :: allocateMatching
624 utke 1.4 if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
625     end subroutine
626 utke 1.6 subroutine allocateMatching_d1_a1(toBeAllocated,allocateMatching)
627 utke 1.4 implicit none
628     real(w2f__8), dimension(:), allocatable :: toBeAllocated
629     type(active), dimension(:) :: allocateMatching
630     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
631     end subroutine
632 utke 1.6 subroutine allocateMatching_a2_a2(toBeAllocated,allocateMatching)
633 utke 1.4 implicit none
634     type(active), dimension(:,:), allocatable :: toBeAllocated
635     type(active), dimension(:,:) :: allocateMatching
636     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
637     size(allocateMatching,2)))
638     end subroutine
639 utke 1.6 subroutine allocateMatching_d2_a2(toBeAllocated,allocateMatching)
640 utke 1.4 implicit none
641     real(w2f__8), dimension(:,:), allocatable :: toBeAllocated
642     type(active), dimension(:,:) :: allocateMatching
643     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
644     size(allocateMatching,2)))
645     end subroutine
646 utke 1.6 subroutine allocateMatching_a4_a4(toBeAllocated,allocateMatching)
647 utke 1.4 implicit none
648     type(active), dimension(:,:,:,:), allocatable :: toBeAllocated
649     type(active), dimension(:,:,:,:) :: allocateMatching
650     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
651     size(allocateMatching,2),&
652     size(allocateMatching,3),&
653     size(allocateMatching,4)))
654 utke 1.3 end subroutine
655 utke 1.6 subroutine allocateMatching_d4_a4(toBeAllocated,allocateMatching)
656 utke 1.4 implicit none
657     real(w2f__8), dimension(:,:,:,:), allocatable :: toBeAllocated
658     type(active), dimension(:,:,:,:) :: allocateMatching
659     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
660     size(allocateMatching,2),&
661     size(allocateMatching,3),&
662     size(allocateMatching,4)))
663     end subroutine
664 utke 1.6 subroutine allocateMatching_a5_a5(toBeAllocated,allocateMatching)
665 utke 1.4 implicit none
666     type(active), dimension(:,:,:,:,:), allocatable :: toBeAllocated
667     type(active), dimension(:,:,:,:,:) :: allocateMatching
668     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
669     size(allocateMatching,2),&
670     size(allocateMatching,3),&
671     size(allocateMatching,4),&
672     size(allocateMatching,5)))
673     end subroutine
674 utke 1.6 subroutine allocateMatching_d5_a5(toBeAllocated,allocateMatching)
675 utke 1.4 implicit none
676     real(w2f__8), dimension(:,:,:,:,:), allocatable :: toBeAllocated
677     type(active), dimension(:,:,:,:,:) :: allocateMatching
678     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
679     size(allocateMatching,2),&
680     size(allocateMatching,3),&
681     size(allocateMatching,4),&
682     size(allocateMatching,5)))
683     end subroutine
684 utke 1.7 subroutine allocateMatching_a5_d5(toBeAllocated,allocateMatching)
685     implicit none
686     type(active), dimension(:,:,:,:,:), allocatable :: toBeAllocated
687     real(w2f__8), dimension(:,:,:,:,:) :: allocateMatching
688     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
689     size(allocateMatching,2),&
690     size(allocateMatching,3),&
691     size(allocateMatching,4),&
692     size(allocateMatching,5)))
693     end subroutine
694 utke 1.6 #ifndef DEFAULT_R8
695     subroutine allocateMatching_r1_a1(toBeAllocated,allocateMatching)
696     implicit none
697     real(w2f__4), dimension(:), allocatable :: toBeAllocated
698     type(active), dimension(:) :: allocateMatching
699     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
700     end subroutine
701     subroutine allocateMatching_r2_a2(toBeAllocated,allocateMatching)
702     implicit none
703     real(w2f__4), dimension(:,:), allocatable :: toBeAllocated
704     type(active), dimension(:,:) :: allocateMatching
705     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
706     size(allocateMatching,2)))
707     end subroutine
708     #endif
709     !
710     ! shape tests
711     !
712     subroutine shapeTest_a1_d1(allocatedVar,origVar)
713 utke 1.5 implicit none
714     type(active), dimension(:), allocatable :: allocatedVar
715     real(w2f__8), dimension(:) :: origVar
716 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
717 utke 1.5 end subroutine
718 utke 1.6 subroutine shapeTest_a1_a1(allocatedVar,origVar)
719 utke 1.5 implicit none
720     type(active), dimension(:), allocatable :: allocatedVar
721     type(active), dimension(:) :: origVar
722 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
723 utke 1.5 end subroutine
724 utke 1.6 subroutine shapeTest_d1_a1(allocatedVar,origVar)
725 utke 1.5 implicit none
726     real(w2f__8), dimension(:), allocatable :: allocatedVar
727     type(active), dimension(:) :: origVar
728 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
729 utke 1.5 end subroutine
730 utke 1.6 subroutine shapeTest_a2_a2(allocatedVar,origVar)
731 utke 1.5 implicit none
732     type(active), dimension(:,:), allocatable :: allocatedVar
733     type(active), dimension(:,:) :: origVar
734 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
735 utke 1.5 end subroutine
736 utke 1.6 subroutine shapeTest_d2_a2(allocatedVar,origVar)
737 utke 1.5 implicit none
738     real(w2f__8), dimension(:,:), allocatable :: allocatedVar
739     type(active), dimension(:,:) :: origVar
740 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
741 utke 1.5 end subroutine
742 utke 1.6 subroutine shapeTest_a4_a4(allocatedVar,origVar)
743 utke 1.5 implicit none
744     type(active), dimension(:,:,:,:), allocatable :: allocatedVar
745     type(active), dimension(:,:,:,:) :: origVar
746 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
747 utke 1.5 end subroutine
748 utke 1.6 subroutine shapeTest_d4_a4(allocatedVar,origVar)
749 utke 1.5 implicit none
750     real(w2f__8), dimension(:,:,:,:), allocatable :: allocatedVar
751     type(active), dimension(:,:,:,:) :: origVar
752 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
753 utke 1.5 end subroutine
754 utke 1.6 subroutine shapeTest_a5_a5(allocatedVar,origVar)
755 utke 1.5 implicit none
756     type(active), dimension(:,:,:,:,:), allocatable :: allocatedVar
757     type(active), dimension(:,:,:,:,:) :: origVar
758 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
759 utke 1.5 end subroutine
760 utke 1.6 subroutine shapeTest_d5_a5(allocatedVar,origVar)
761 utke 1.5 implicit none
762     real(w2f__8), dimension(:,:,:,:,:), allocatable :: allocatedVar
763     type(active), dimension(:,:,:,:,:) :: origVar
764 utke 1.6 if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
765     end subroutine
766 utke 1.7 subroutine shapeTest_a5_d5(allocatedVar,origVar)
767     implicit none
768     type(active), dimension(:,:,:,:,:), allocatable :: allocatedVar
769     real(w2f__8), dimension(:,:,:,:,:) :: origVar
770     if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
771     end subroutine
772 utke 1.6 #ifndef DEFAULT_R8
773     subroutine shapeTest_r1_a1(allocatedVar,origVar)
774     implicit none
775     real(w2f__4), dimension(:), allocatable :: allocatedVar
776     type(active), dimension(:) :: origVar
777     if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
778     end subroutine
779     subroutine shapeTest_r2_a2(allocatedVar,origVar)
780     implicit none
781     real(w2f__4), dimension(:,:), allocatable :: allocatedVar
782     type(active), dimension(:,:) :: origVar
783     if (.not. all(shape(allocatedVar)==shape(origVar))) call runTimeErrorStop(shapeChange)
784     end subroutine
785     #endif
786     subroutine runTimeErrorStopI(mesgId)
787     implicit none
788     integer mesgId
789     select case (mesgId)
790     case (shapeChange)
791     stop "ERROR: OAD run time library: detected shape change"
792     end select
793 utke 1.5 end subroutine
794 utke 1.1
795 utke 1.6 end module

  ViewVC Help
Powered by ViewVC 1.1.22