/[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.5 - (hide annotations) (download)
Sun Jan 24 06:35:54 2010 UTC (16 years, 7 months ago) by utke
Branch: MAIN
Changes since 1.4: +114 -1 lines
update for shape test

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 utke 1.5
8 utke 1.1 use w2f__types
9     implicit none
10     private
11 utke 1.3 public :: active, saxpy, sax, zero_deriv, &
12     setderiv, set_neg_deriv, inc_deriv, dec_deriv, &
13     convert_p2a_scalar, convert_a2p_scalar, &
14     convert_p2a_vector, convert_a2p_vector, &
15     convert_p2a_matrix, convert_a2p_matrix, &
16     convert_p2a_three_tensor, convert_a2p_three_tensor, &
17     convert_p2a_four_tensor, convert_a2p_four_tensor, &
18     convert_p2a_five_tensor, convert_a2p_five_tensor, &
19     convert_p2a_six_tensor, convert_a2p_six_tensor, &
20     convert_p2a_seven_tensor, convert_a2p_seven_tensor, &
21 utke 1.5 oad_allocateMatching, oad_shapeTest
22 utke 1.1
23    
24     !
25     ! active needs to be a sequence type
26     ! with no initialization
27     !
28     type active
29     sequence
30     real(w2f__8) :: v
31     ! initialization does not work for active variables
32     ! inside of common block, such as in boxmodel
33     ! initialization is required for correct adjoint
34     real(w2f__8) :: d=0.0
35     ! real(w2f__8) :: d
36     end type active
37    
38     interface saxpy
39     module procedure saxpy_a_a
40     end interface
41    
42     interface setderiv
43     module procedure setderiv_a_a
44     end interface
45    
46 utke 1.3 interface set_neg_deriv
47     module procedure set_neg_deriv_a_a
48     end interface set_neg_deriv
49    
50     interface inc_deriv
51     module procedure inc_deriv_a_a
52     end interface inc_deriv
53    
54     interface dec_deriv
55     module procedure dec_deriv_a_a
56     end interface dec_deriv
57    
58 utke 1.1 interface zero_deriv
59     module procedure zero_deriv_a
60     end interface
61    
62     interface sax
63     module procedure sax_d_a_a, sax_i_a_a
64     end interface
65    
66     interface convert_p2a_scalar
67 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
68 utke 1.1 module procedure convert_sp2a_scalar_impl
69 utke 1.2 #endif
70 utke 1.1 module procedure convert_p2a_scalar_impl
71     end interface
72     interface convert_a2p_scalar
73 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
74 utke 1.1 module procedure convert_a2sp_scalar_impl
75 utke 1.2 #endif
76 utke 1.1 module procedure convert_a2p_scalar_impl
77     end interface
78    
79     interface convert_p2a_vector
80 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
81 utke 1.1 module procedure convert_sp2a_vector_impl
82 utke 1.2 #endif
83 utke 1.1 module procedure convert_p2a_vector_impl
84     end interface
85     interface convert_a2p_vector
86 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
87 utke 1.1 module procedure convert_a2sp_vector_impl
88 utke 1.2 #endif
89 utke 1.1 module procedure convert_a2p_vector_impl
90     end interface
91    
92     interface convert_p2a_matrix
93 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
94 utke 1.1 module procedure convert_sp2a_matrix_impl
95 utke 1.2 #endif
96 utke 1.1 module procedure convert_p2a_matrix_impl
97     end interface
98     interface convert_a2p_matrix
99 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
100 utke 1.1 module procedure convert_a2sp_matrix_impl
101 utke 1.2 #endif
102 utke 1.1 module procedure convert_a2p_matrix_impl
103     end interface
104    
105     interface convert_p2a_three_tensor
106 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
107 utke 1.1 module procedure convert_sp2a_three_tensor_impl
108 utke 1.2 #endif
109 utke 1.1 module procedure convert_p2a_three_tensor_impl
110     end interface
111     interface convert_a2p_three_tensor
112 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
113 utke 1.1 module procedure convert_a2sp_three_tensor_impl
114 utke 1.2 #endif
115 utke 1.1 module procedure convert_a2p_three_tensor_impl
116     end interface
117    
118     interface convert_p2a_four_tensor
119 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
120 utke 1.1 module procedure convert_sp2a_four_tensor_impl
121 utke 1.2 #endif
122 utke 1.1 module procedure convert_p2a_four_tensor_impl
123     end interface
124     interface convert_a2p_four_tensor
125 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
126 utke 1.1 module procedure convert_a2sp_four_tensor_impl
127 utke 1.2 #endif
128 utke 1.1 module procedure convert_a2p_four_tensor_impl
129     end interface
130    
131     interface convert_p2a_five_tensor
132 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
133 utke 1.1 module procedure convert_sp2a_five_tensor_impl
134 utke 1.2 #endif
135 utke 1.1 module procedure convert_p2a_five_tensor_impl
136     end interface
137     interface convert_a2p_five_tensor
138 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
139 utke 1.1 module procedure convert_a2sp_five_tensor_impl
140 utke 1.2 #endif
141 utke 1.1 module procedure convert_a2p_five_tensor_impl
142     end interface
143    
144 utke 1.3 interface convert_p2a_six_tensor
145     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
146     module procedure convert_sp2a_six_tensor_impl
147     #endif
148     module procedure convert_p2a_six_tensor_impl
149     end interface
150     interface convert_a2p_six_tensor
151     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
152     module procedure convert_a2sp_six_tensor_impl
153     #endif
154     module procedure convert_a2p_six_tensor_impl
155     end interface
156    
157     interface convert_p2a_seven_tensor
158     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
159     module procedure convert_sp2a_seven_tensor_impl
160     #endif
161     module procedure convert_p2a_seven_tensor_impl
162     end interface
163     interface convert_a2p_seven_tensor
164     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
165     module procedure convert_a2sp_seven_tensor_impl
166     #endif
167     module procedure convert_a2p_seven_tensor_impl
168     end interface
169    
170     interface oad_allocateMatching
171 utke 1.5 module procedure oad_allocateMatching_pv2av
172 utke 1.4 module procedure oad_allocateMatching_av
173     module procedure oad_allocateMatching_pv
174     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
175     module procedure oad_allocateMatching_p4bv
176     #endif
177     module procedure oad_allocateMatching_am
178     module procedure oad_allocateMatching_pm
179     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
180     module procedure oad_allocateMatching_p4bm
181     #endif
182     module procedure oad_allocateMatching_at4
183     module procedure oad_allocateMatching_pt4
184     module procedure oad_allocateMatching_at5
185     module procedure oad_allocateMatching_pt5
186 utke 1.3 end interface
187    
188 utke 1.5 interface oad_shapeTest
189     module procedure oad_shapeTest_pv2av
190     module procedure oad_shapeTest_av
191     module procedure oad_shapeTest_pv
192     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
193     module procedure oad_shapeTest_p4bv
194     #endif
195     module procedure oad_shapeTest_am
196     module procedure oad_shapeTest_pm
197     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
198     module procedure oad_shapeTest_p4bm
199     #endif
200     module procedure oad_shapeTest_at4
201     module procedure oad_shapeTest_pt4
202     module procedure oad_shapeTest_at5
203     module procedure oad_shapeTest_pt5
204     end interface
205    
206 utke 1.1 contains
207    
208     !
209     ! chain rule saxpy to be used in forward and reverse modes
210     !
211    
212     subroutine saxpy_a_a(a,x,y)
213     real(w2f__8), intent(in) :: a
214     type(active), intent(in) :: x
215     type(active), intent(inout) :: y
216     y%d=y%d+x%d*a
217     end subroutine saxpy_a_a
218    
219     !
220     ! chain rule saxpy to be used in forward and reverse modes
221     ! derivative component of y is equal to zero initially
222     ! note: y needs to be inout as otherwise value component gets
223     ! zeroed out
224     !
225    
226     subroutine sax_d_a_a(a,x,y)
227     real(w2f__8), intent(in) :: a
228     type(active), intent(in) :: x
229     type(active), intent(inout) :: y
230     y%d=x%d*a
231     end subroutine sax_d_a_a
232    
233     subroutine sax_i_a_a(a,x,y)
234     integer(kind=w2f__i8), intent(in) :: a
235     type(active), intent(in) :: x
236     type(active), intent(inout) :: y
237     y%d=x%d*a
238     end subroutine sax_i_a_a
239    
240     !
241     ! set derivative of y to be equal to derivative of x
242     ! note: making y inout allows for already existing active
243     ! variables to become the target of a derivative assignment
244     !
245    
246     subroutine setderiv_a_a(y,x)
247     type(active), intent(inout) :: y
248     type(active), intent(in) :: x
249     y%d=x%d
250     end subroutine setderiv_a_a
251    
252     !
253 utke 1.3 ! set the derivative of y to be the negated derivative of x
254     ! note: making y inout allows for already existing active
255     ! variables to become the target of a derivative assignment
256     !
257    
258     subroutine set_neg_deriv_a_a(y,x)
259     type(active), intent(inout) :: y
260     type(active), intent(in) :: x
261     y%d = -x%d
262     end subroutine set_neg_deriv_a_a
263    
264     !
265     ! increment the derivative of y by the derivative of x
266     ! note: making y inout allows for already existing active
267     ! variables to become the target of a derivative assignment
268     !
269    
270     subroutine inc_deriv_a_a(y,x)
271     type(active), intent(inout) :: y
272     type(active), intent(in) :: x
273     y%d = y%d + x%d
274     end subroutine inc_deriv_a_a
275    
276     !
277     ! decrement the derivative of y by the derivative of x
278     ! note: making y inout allows for already existing active
279     ! variables to become the target of a derivative assignment
280     !
281    
282     subroutine dec_deriv_a_a(y,x)
283     type(active), intent(inout) :: y
284     type(active), intent(in) :: x
285     y%d = y%d - x%d
286     end subroutine dec_deriv_a_a
287    
288     !
289 utke 1.1 ! set derivative components to 0.0
290     !
291     subroutine zero_deriv_a(x)
292     type(active), intent(inout) :: x
293     x%d=0.0d0
294     end subroutine zero_deriv_a
295    
296     !
297     ! active/passive conversions
298     !
299 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
300 utke 1.1 subroutine convert_a2sp_scalar_impl(convertTo, convertFrom)
301     real(w2f__4), intent(out) :: convertTo
302     type(active), intent(in) :: convertFrom
303     convertTo=convertFrom%v
304     end subroutine
305 utke 1.2 #endif
306 utke 1.1
307     subroutine convert_a2p_scalar_impl(convertTo, convertFrom)
308     real(w2f__8), intent(out) :: convertTo
309     type(active), intent(in) :: convertFrom
310     convertTo=convertFrom%v
311     end subroutine
312    
313 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
314 utke 1.1 subroutine convert_sp2a_scalar_impl(convertTo, convertFrom)
315     real(w2f__4), intent(in) :: convertFrom
316     type(active), intent(inout) :: convertTo
317     convertTo%v=convertFrom
318     end subroutine
319 utke 1.2 #endif
320 utke 1.1
321     subroutine convert_p2a_scalar_impl(convertTo, convertFrom)
322     real(w2f__8), intent(in) :: convertFrom
323     type(active), intent(inout) :: convertTo
324     convertTo%v=convertFrom
325     end subroutine
326    
327 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
328 utke 1.1 subroutine convert_a2sp_vector_impl(convertTo, convertFrom)
329     type(active), dimension(:), intent(in) :: convertFrom
330     real(w2f__4), dimension(:), intent(out) :: convertTo
331     convertTo=convertFrom%v
332     end subroutine
333 utke 1.2 #endif
334 utke 1.1
335     subroutine convert_a2p_vector_impl(convertTo, convertFrom)
336     type(active), dimension(:), intent(in) :: convertFrom
337     real(w2f__8), dimension(:), intent(out) :: convertTo
338     convertTo=convertFrom%v
339     end subroutine
340    
341 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
342 utke 1.1 subroutine convert_sp2a_vector_impl(convertTo, convertFrom)
343     real(w2f__4), dimension(:), intent(in) :: convertFrom
344     type(active), dimension(:), intent(inout) :: convertTo
345     convertTo%v=convertFrom
346     end subroutine
347 utke 1.2 #endif
348 utke 1.1
349     subroutine convert_p2a_vector_impl(convertTo, convertFrom)
350     real(w2f__8), dimension(:), intent(in) :: convertFrom
351     type(active), dimension(:), intent(inout) :: convertTo
352     convertTo%v=convertFrom
353     end subroutine
354    
355 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
356 utke 1.1 subroutine convert_a2sp_matrix_impl(convertTo, convertFrom)
357     type(active), dimension(:,:), intent(in) :: convertFrom
358     real(w2f__4), dimension(:,:), intent(out) :: convertTo
359     convertTo=convertFrom%v
360     end subroutine
361 utke 1.2 #endif
362 utke 1.1
363     subroutine convert_a2p_matrix_impl(convertTo, convertFrom)
364     type(active), dimension(:,:), intent(in) :: convertFrom
365     real(w2f__8), dimension(:,:), intent(out) :: convertTo
366     convertTo=convertFrom%v
367     end subroutine
368    
369 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
370     subroutine convert_sp2a_matrix_impl(convertTo, convertFrom)
371     real(w2f__4), dimension(:,:), intent(in) :: convertFrom
372     type(active), dimension(:,:), intent(inout) :: convertTo
373     convertTo%v=convertFrom
374     end subroutine
375     #endif
376 utke 1.1 subroutine convert_p2a_matrix_impl(convertTo, convertFrom)
377     real(w2f__8), dimension(:,:), intent(in) :: convertFrom
378     type(active), dimension(:,:), intent(inout) :: convertTo
379     convertTo%v=convertFrom
380     end subroutine
381    
382 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
383 utke 1.1 subroutine convert_a2sp_three_tensor_impl(convertTo, convertFrom)
384     type(active), dimension(:,:,:), intent(in) :: convertFrom
385     real(w2f__4), dimension(:,:,:), intent(out) :: convertTo
386     convertTo=convertFrom%v
387     end subroutine
388 utke 1.2 #endif
389 utke 1.1
390     subroutine convert_a2p_three_tensor_impl(convertTo, convertFrom)
391     type(active), dimension(:,:,:), intent(in) :: convertFrom
392     real(w2f__8), dimension(:,:,:), intent(out) :: convertTo
393     convertTo=convertFrom%v
394     end subroutine
395    
396 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
397 utke 1.1 subroutine convert_sp2a_three_tensor_impl(convertTo, convertFrom)
398     real(w2f__4), dimension(:,:,:), intent(in) :: convertFrom
399     type(active), dimension(:,:,:), intent(inout) :: convertTo
400     convertTo%v=convertFrom
401     end subroutine
402 utke 1.2 #endif
403 utke 1.1
404     subroutine convert_p2a_three_tensor_impl(convertTo, convertFrom)
405     real(w2f__8), dimension(:,:,:), intent(in) :: convertFrom
406     type(active), dimension(:,:,:), intent(inout) :: convertTo
407     convertTo%v=convertFrom
408     end subroutine
409    
410 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
411 utke 1.1 subroutine convert_a2sp_four_tensor_impl(convertTo, convertFrom)
412     type(active), dimension(:,:,:,:), intent(in) :: convertFrom
413     real(w2f__4), dimension(:,:,:,:), intent(out) :: convertTo
414     convertTo=convertFrom%v
415     end subroutine
416 utke 1.2 #endif
417 utke 1.1
418     subroutine convert_a2p_four_tensor_impl(convertTo, convertFrom)
419     type(active), dimension(:,:,:,:), intent(in) :: convertFrom
420     real(w2f__8), dimension(:,:,:,:), intent(out) :: convertTo
421     convertTo=convertFrom%v
422     end subroutine
423    
424 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
425 utke 1.1 subroutine convert_sp2a_four_tensor_impl(convertTo, convertFrom)
426     real(w2f__4), dimension(:,:,:,:), intent(in) :: convertFrom
427     type(active), dimension(:,:,:,:), intent(inout) :: convertTo
428     convertTo%v=convertFrom
429     end subroutine
430 utke 1.2 #endif
431 utke 1.1
432     subroutine convert_p2a_four_tensor_impl(convertTo, convertFrom)
433     real(w2f__8), dimension(:,:,:,:), intent(in) :: convertFrom
434     type(active), dimension(:,:,:,:), intent(inout) :: convertTo
435     convertTo%v=convertFrom
436     end subroutine
437    
438 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
439 utke 1.1 subroutine convert_a2sp_five_tensor_impl(convertTo, convertFrom)
440     type(active), dimension(:,:,:,:,:), intent(in) :: convertFrom
441     real(w2f__4), dimension(:,:,:,:,:), intent(out) :: convertTo
442     convertTo=convertFrom%v
443     end subroutine
444 utke 1.2 #endif
445 utke 1.1
446     subroutine convert_a2p_five_tensor_impl(convertTo, convertFrom)
447     type(active), dimension(:,:,:,:,:), intent(in) :: convertFrom
448     real(w2f__8), dimension(:,:,:,:,:), intent(out) :: convertTo
449     convertTo=convertFrom%v
450     end subroutine
451    
452 utke 1.2 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
453 utke 1.1 subroutine convert_sp2a_five_tensor_impl(convertTo, convertFrom)
454     real(w2f__4), dimension(:,:,:,:,:), intent(in) :: convertFrom
455     type(active), dimension(:,:,:,:,:), intent(inout) :: convertTo
456     convertTo%v=convertFrom
457     end subroutine
458 utke 1.2 #endif
459 utke 1.1
460     subroutine convert_p2a_five_tensor_impl(convertTo, convertFrom)
461     real(w2f__8), dimension(:,:,:,:,:), intent(in) :: convertFrom
462     type(active), dimension(:,:,:,:,:), intent(inout) :: convertTo
463     convertTo%v=convertFrom
464     end subroutine
465    
466 utke 1.3 #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
467     subroutine convert_a2sp_six_tensor_impl(convertTo, convertFrom)
468     type(active), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
469     real(w2f__4), dimension(:,:,:,:,:,:), intent(out) :: convertTo
470     convertTo=convertFrom%v
471     end subroutine
472     #endif
473    
474     subroutine convert_a2p_six_tensor_impl(convertTo, convertFrom)
475     type(active), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
476     real(w2f__8), dimension(:,:,:,:,:,:), intent(out) :: convertTo
477     convertTo=convertFrom%v
478     end subroutine
479    
480     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
481     subroutine convert_sp2a_six_tensor_impl(convertTo, convertFrom)
482     real(w2f__4), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
483     type(active), dimension(:,:,:,:,:,:), intent(inout) :: convertTo
484     convertTo%v=convertFrom
485     end subroutine
486     #endif
487    
488     subroutine convert_p2a_six_tensor_impl(convertTo, convertFrom)
489     real(w2f__8), dimension(:,:,:,:,:,:), intent(in) :: convertFrom
490     type(active), dimension(:,:,:,:,:,:), intent(inout) :: convertTo
491     convertTo%v=convertFrom
492     end subroutine
493    
494     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
495     subroutine convert_a2sp_seven_tensor_impl(convertTo, convertFrom)
496     type(active), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
497     real(w2f__4), dimension(:,:,:,:,:,:,:), intent(out) :: convertTo
498     convertTo=convertFrom%v
499     end subroutine
500     #endif
501    
502     subroutine convert_a2p_seven_tensor_impl(convertTo, convertFrom)
503     type(active), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
504     real(w2f__8), dimension(:,:,:,:,:,:,:), intent(out) :: convertTo
505     convertTo=convertFrom%v
506     end subroutine
507    
508     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
509     subroutine convert_sp2a_seven_tensor_impl(convertTo, convertFrom)
510     real(w2f__4), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
511     type(active), dimension(:,:,:,:,:,:,:), intent(inout) :: convertTo
512     convertTo%v=convertFrom
513     end subroutine
514     #endif
515    
516     subroutine convert_p2a_seven_tensor_impl(convertTo, convertFrom)
517     real(w2f__8), dimension(:,:,:,:,:,:,:), intent(in) :: convertFrom
518     type(active), dimension(:,:,:,:,:,:,:), intent(inout) :: convertTo
519     convertTo%v=convertFrom
520     end subroutine
521    
522 utke 1.5 subroutine oad_allocateMatching_pv2av(toBeAllocated,allocateMatching)
523     implicit none
524     type(active), dimension(:), allocatable :: toBeAllocated
525     real(w2f__8), dimension(:) :: allocateMatching
526     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
527     end subroutine
528    
529 utke 1.4 subroutine oad_allocateMatching_av(toBeAllocated,allocateMatching)
530 utke 1.3 implicit none
531     type(active), dimension(:), allocatable :: toBeAllocated
532     type(active), dimension(:) :: allocateMatching
533 utke 1.4 if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
534     end subroutine
535    
536     subroutine oad_allocateMatching_pv(toBeAllocated,allocateMatching)
537     implicit none
538     real(w2f__8), dimension(:), allocatable :: toBeAllocated
539     type(active), dimension(:) :: allocateMatching
540     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
541     end subroutine
542    
543     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
544     subroutine oad_allocateMatching_p4bv(toBeAllocated,allocateMatching)
545     implicit none
546     real(w2f__4), dimension(:), allocatable :: toBeAllocated
547     type(active), dimension(:) :: allocateMatching
548     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching)))
549     end subroutine
550     #endif
551    
552     subroutine oad_allocateMatching_am(toBeAllocated,allocateMatching)
553     implicit none
554     type(active), dimension(:,:), allocatable :: toBeAllocated
555     type(active), dimension(:,:) :: allocateMatching
556     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
557     size(allocateMatching,2)))
558     end subroutine
559    
560     subroutine oad_allocateMatching_pm(toBeAllocated,allocateMatching)
561     implicit none
562     real(w2f__8), dimension(:,:), allocatable :: toBeAllocated
563     type(active), dimension(:,:) :: allocateMatching
564     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
565     size(allocateMatching,2)))
566     end subroutine
567    
568     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
569     subroutine oad_allocateMatching_p4bm(toBeAllocated,allocateMatching)
570     implicit none
571     real(w2f__4), dimension(:,:), allocatable :: toBeAllocated
572     type(active), dimension(:,:) :: allocateMatching
573     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
574     size(allocateMatching,2)))
575     end subroutine
576     #endif
577    
578     subroutine oad_allocateMatching_at4(toBeAllocated,allocateMatching)
579     implicit none
580     type(active), dimension(:,:,:,:), allocatable :: toBeAllocated
581     type(active), dimension(:,:,:,:) :: allocateMatching
582     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
583     size(allocateMatching,2),&
584     size(allocateMatching,3),&
585     size(allocateMatching,4)))
586 utke 1.3 end subroutine
587    
588 utke 1.4 subroutine oad_allocateMatching_pt4(toBeAllocated,allocateMatching)
589     implicit none
590     real(w2f__8), dimension(:,:,:,:), allocatable :: toBeAllocated
591     type(active), dimension(:,:,:,:) :: allocateMatching
592     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
593     size(allocateMatching,2),&
594     size(allocateMatching,3),&
595     size(allocateMatching,4)))
596     end subroutine
597    
598     subroutine oad_allocateMatching_at5(toBeAllocated,allocateMatching)
599     implicit none
600     type(active), dimension(:,:,:,:,:), allocatable :: toBeAllocated
601     type(active), dimension(:,:,:,:,:) :: allocateMatching
602     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
603     size(allocateMatching,2),&
604     size(allocateMatching,3),&
605     size(allocateMatching,4),&
606     size(allocateMatching,5)))
607     end subroutine
608    
609     subroutine oad_allocateMatching_pt5(toBeAllocated,allocateMatching)
610     implicit none
611     real(w2f__8), dimension(:,:,:,:,:), allocatable :: toBeAllocated
612     type(active), dimension(:,:,:,:,:) :: allocateMatching
613     if (.not. allocated(toBeAllocated)) allocate(toBeAllocated(size(allocateMatching,1), &
614     size(allocateMatching,2),&
615     size(allocateMatching,3),&
616     size(allocateMatching,4),&
617     size(allocateMatching,5)))
618     end subroutine
619 utke 1.5
620     subroutine oad_shapeTest_pv2av(allocatedVar,origVar)
621     implicit none
622     type(active), dimension(:), allocatable :: allocatedVar
623     real(w2f__8), dimension(:) :: origVar
624     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
625     end subroutine
626    
627     subroutine oad_shapeTest_av(allocatedVar,origVar)
628     implicit none
629     type(active), dimension(:), allocatable :: allocatedVar
630     type(active), dimension(:) :: origVar
631     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
632     end subroutine
633    
634     subroutine oad_shapeTest_pv(allocatedVar,origVar)
635     implicit none
636     real(w2f__8), dimension(:), allocatable :: allocatedVar
637     type(active), dimension(:) :: origVar
638     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
639     end subroutine
640    
641     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
642     subroutine oad_shapeTest_p4bv(allocatedVar,origVar)
643     implicit none
644     real(w2f__4), dimension(:), allocatable :: allocatedVar
645     type(active), dimension(:) :: origVar
646     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
647     end subroutine
648     #endif
649    
650     subroutine oad_shapeTest_am(allocatedVar,origVar)
651     implicit none
652     type(active), dimension(:,:), allocatable :: allocatedVar
653     type(active), dimension(:,:) :: origVar
654     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
655     end subroutine
656    
657     subroutine oad_shapeTest_pm(allocatedVar,origVar)
658     implicit none
659     real(w2f__8), dimension(:,:), allocatable :: allocatedVar
660     type(active), dimension(:,:) :: origVar
661     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
662     end subroutine
663    
664     #ifdef ALLOW_AUTODIFF_MIXED_PRECISION
665     subroutine oad_shapeTest_p4bm(allocatedVar,origVar)
666     implicit none
667     real(w2f__4), dimension(:,:), allocatable :: allocatedVar
668     type(active), dimension(:,:) :: origVar
669     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
670     end subroutine
671     #endif
672    
673     subroutine oad_shapeTest_at4(allocatedVar,origVar)
674     implicit none
675     type(active), dimension(:,:,:,:), allocatable :: allocatedVar
676     type(active), dimension(:,:,:,:) :: origVar
677     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
678     end subroutine
679    
680     subroutine oad_shapeTest_pt4(allocatedVar,origVar)
681     implicit none
682     real(w2f__8), dimension(:,:,:,:), allocatable :: allocatedVar
683     type(active), dimension(:,:,:,:) :: origVar
684     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
685     end subroutine
686    
687     subroutine oad_shapeTest_at5(allocatedVar,origVar)
688     implicit none
689     type(active), dimension(:,:,:,:,:), allocatable :: allocatedVar
690     type(active), dimension(:,:,:,:,:) :: origVar
691     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
692     end subroutine
693    
694     subroutine oad_shapeTest_pt5(allocatedVar,origVar)
695     implicit none
696     real(w2f__8), dimension(:,:,:,:,:), allocatable :: allocatedVar
697     type(active), dimension(:,:,:,:,:) :: origVar
698     if (.not. all(shape(allocatedVar)==shape(origVar))) stop "ERROR: OAD run time library detected shape change"
699     end subroutine
700 utke 1.1
701 utke 1.4 end module OAD_active

  ViewVC Help
Powered by ViewVC 1.1.22