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