1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MNC_OPTIONS.h" |
5 |
|
6 |
C================================================================== |
7 |
|
8 |
SUBROUTINE MNC_DIM_INIT( |
9 |
I myThid, |
10 |
I dname, |
11 |
I dunits, |
12 |
I dlen ) |
13 |
|
14 |
implicit none |
15 |
#include "mnc_common.h" |
16 |
#include "EEPARAMS.h" |
17 |
|
18 |
C Arguments |
19 |
integer myThid |
20 |
character*(*) dname |
21 |
character*(*) dunits |
22 |
integer dlen |
23 |
|
24 |
C Functions |
25 |
integer ILNBLNK |
26 |
|
27 |
C Local Variables |
28 |
integer ind, n1,n2 |
29 |
character*(MAX_LEN_MBUF) msgbuf |
30 |
|
31 |
C Check that dname is not already used |
32 |
CALL MNC_GET_IND(myThid, MNC_MAX_ID, dname, mnc_d_names, ind) |
33 |
IF ( ind .GT. 0 ) THEN |
34 |
write(msgbuf,'(3a)') 'MNC ERROR: dimension ''', |
35 |
& dname, ''' already exists--cannot declare it twice' |
36 |
CALL print_error( msgbuf, mythid ) |
37 |
stop 'ABNORMAL END: S/R MNC_DIM_INT' |
38 |
ENDIF |
39 |
|
40 |
CALL MNC_GET_NEXT_EMPTY_IND(myThid, MNC_MAX_ID, mnc_d_names, ind) |
41 |
|
42 |
C Check that the dimension name fits in the table |
43 |
n1 = ILNBLNK(dname) |
44 |
IF ( n1 .GT. MNC_MAX_CHAR) THEN |
45 |
n1 = MNC_MAX_CHAR |
46 |
write(msgbuf,'(a)') 'MNC WARNING: dimension name too long' |
47 |
CALL print_error(msgbuf, mythid) |
48 |
ENDIF |
49 |
n2 = ILNBLNK(dunits) |
50 |
IF ( n2 .GT. MNC_MAX_CHAR) THEN |
51 |
n2 = MNC_MAX_CHAR |
52 |
write(msgbuf,'(a)') 'MNC WARNING: dimension units too long' |
53 |
CALL print_error(msgbuf, mythid) |
54 |
ENDIF |
55 |
|
56 |
C Add to tables |
57 |
mnc_d_names(ind)(1:n1) = dname(1:n1) |
58 |
mnc_d_units(ind)(1:n2) = dunits(1:n2) |
59 |
mnc_d_size(ind) = dlen |
60 |
|
61 |
RETURN |
62 |
END |
63 |
|
64 |
C================================================================== |
65 |
|
66 |
SUBROUTINE MNC_DIM_REMOVE( |
67 |
I myThid, |
68 |
I dname ) |
69 |
|
70 |
implicit none |
71 |
#include "mnc_common.h" |
72 |
#include "EEPARAMS.h" |
73 |
|
74 |
C Arguments |
75 |
integer myThid |
76 |
character*(*) dname |
77 |
|
78 |
C Functions |
79 |
integer ILNBLNK |
80 |
|
81 |
C Local Variables |
82 |
integer ind, n |
83 |
character*(MAX_LEN_MBUF) msgbuf |
84 |
|
85 |
C Check that dname is not already used |
86 |
CALL MNC_GET_IND(myThid, MNC_MAX_ID, dname, mnc_d_names, ind) |
87 |
IF ( ind .GT. 0 ) THEN |
88 |
mnc_d_names(ind)(1:MNC_MAX_CHAR) = |
89 |
& mnc_blank_name(1:MNC_MAX_CHAR) |
90 |
ENDIF |
91 |
|
92 |
RETURN |
93 |
END |