1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final_restore.F,v 1.6 2012/08/10 19:36:02 jmc Exp $ |
2 |
C $Name: checkpoint65l $ |
3 |
|
4 |
#include "COST_OPTIONS.h" |
5 |
#ifdef ALLOW_AUTODIFF |
6 |
# include "AUTODIFF_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
subroutine cost_final_restore ( mythid, lastdiva ) |
10 |
|
11 |
c ================================================================== |
12 |
c SUBROUTINE cost_final_restore |
13 |
c ================================================================== |
14 |
c |
15 |
c Restore cost function value |
16 |
c This is required in conjunction with DIVA |
17 |
c heimbach@mit.edu 5-Mar-2003 |
18 |
c |
19 |
c ================================================================== |
20 |
c SUBROUTINE cost_final_restore |
21 |
c ================================================================== |
22 |
|
23 |
implicit none |
24 |
|
25 |
c == global variables == |
26 |
|
27 |
#include "EEPARAMS.h" |
28 |
#include "SIZE.h" |
29 |
|
30 |
#include "cost.h" |
31 |
|
32 |
c == routine arguments == |
33 |
|
34 |
integer mythid |
35 |
logical lastdiva |
36 |
|
37 |
# ifdef ALLOW_DIVIDED_ADJOINT |
38 |
|
39 |
c == local variables == |
40 |
logical exst |
41 |
|
42 |
integer idivbeg, idivend |
43 |
c == end of interface == |
44 |
|
45 |
c-- Each process has calculated the global part for itself. |
46 |
cph IF (myProcId .eq. 0) THEN |
47 |
_BEGIN_MASTER( mythid ) |
48 |
c |
49 |
inquire(file='divided.ctrl',exist=exst) |
50 |
if (exst) then |
51 |
open(unit=76,file='divided.ctrl',form='formatted') |
52 |
read(unit=76,fmt=*) idivbeg,idivend |
53 |
close(unit=76) |
54 |
else |
55 |
idivbeg = -2 |
56 |
endif |
57 |
c |
58 |
if ( idivbeg .EQ. 0 ) then |
59 |
lastdiva = .TRUE. |
60 |
open(unit=76,file='costfinal') |
61 |
read(76,*) fc |
62 |
close(76) |
63 |
else |
64 |
lastdiva = .FALSE. |
65 |
endif |
66 |
c |
67 |
_END_MASTER( mythid ) |
68 |
cph ENDIF |
69 |
_BARRIER |
70 |
|
71 |
#endif |
72 |
|
73 |
end |