Changeset 6625 for branches/UKMO/dev_r5518_v3.4_asm_nemovar_community/NEMOGCM/TOOLS/SIREN/src/attribute.f90
- Timestamp:
- 2016-05-26T11:08:07+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_v3.4_asm_nemovar_community/NEMOGCM/TOOLS/SIREN/src/attribute.f90
r6617 r6625 81 81 ! REVISION HISTORY: 82 82 !> @date November, 2013 - Initial Version 83 !> @date November, 2014 84 !> - Fix memory leaks bug 85 !> @date September, 2015 86 !> - manage useless (dummy) attributes 83 !> @date November, 2014 - Fix memory leaks bug 87 84 ! 88 85 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 100 97 PUBLIC :: TATT !< attribute structure 101 98 102 PRIVATE :: cm_dumatt !< dummy attribute array103 104 99 ! function and subroutine 105 100 PUBLIC :: att_init !< initialize attribute structure … … 109 104 PUBLIC :: att_get_index !< get attribute index, in an array of attribute structure 110 105 PUBLIC :: att_get_id !< get attribute id, read from file 111 PUBLIC :: att_get_dummy !< fill dummy attribute array112 PUBLIC :: att_is_dummy !< check if attribute is defined as dummy attribute113 106 114 107 PRIVATE :: att__clean_unit ! clean attribute strcuture … … 137 130 INTEGER(i4) :: i_type = 0 !< attribute type 138 131 INTEGER(i4) :: i_len = 0 !< number of value store in attribute 139 CHARACTER(LEN=lc) :: c_value = 'none'!< attribute value if type CHAR132 CHARACTER(LEN=lc) :: c_value = "none" !< attribute value if type CHAR 140 133 REAL(dp), DIMENSION(:), POINTER :: d_value => NULL() !< attribute value if type SHORT,INT,FLOAT or DOUBLE 141 134 END TYPE TATT 142 135 143 CHARACTER(LEN=lc), DIMENSION(ip_maxdum), SAVE :: cm_dumatt !< dummy attribute144 145 136 INTERFACE att_init 146 MODULE PROCEDURE att__init_c 137 MODULE PROCEDURE att__init_c 147 138 MODULE PROCEDURE att__init_dp 148 139 MODULE PROCEDURE att__init_dp_0d … … 190 181 !> @date November, 2013 - Initial Version 191 182 !> @date November, 2014 192 !> - use function instead of overload assignment operator183 !> - use function instead of overload assignment operator 193 184 !> (to avoid memory leak) 194 185 ! … … 243 234 244 235 ! local variable 245 REAL(dp) 236 REAL(dp), DIMENSION(:), ALLOCATABLE :: dl_value 246 237 !---------------------------------------------------------------- 247 238 … … 309 300 !> @author J.Paul 310 301 !> @date November, 2013 - Initial Version 311 !> @date September, 2014 312 !> - bug fix with use of id read from attribute structure 313 !> 302 !> @date September, 2014 - bug fix with use of id read from attribute structure 303 ! 314 304 !> @param[in] td_att array of attribute structure 315 305 !> @param[in] cd_name attribute name … … 365 355 366 356 att__init_c%c_name=TRIM(ADJUSTL(cd_name)) 357 367 358 att__init_c%i_type=NF90_CHAR 368 369 359 att__init_c%c_value=TRIM(ADJUSTL(cd_value)) 370 360 att__init_c%i_len=LEN( TRIM(ADJUSTL(cd_value)) ) … … 378 368 !> 379 369 !> @author J.Paul 380 !> @d ate November, 2013 - Initial Version370 !> @dtae November, 2013 - Initial Version 381 371 ! 382 372 !> @param[in] cd_name attribute name … … 1078 1068 !> @author J.Paul 1079 1069 !> @date November, 2013 - Initial Version 1080 !> @date September, 2014 1081 !> - take into account type of attribute. 1070 !> @date September, 2014 - take into account type of attribute. 1082 1071 ! 1083 1072 !> @param[in] td_att attribute structure … … 1125 1114 1126 1115 CASE(NF90_CHAR) 1127 1128 1116 cl_value=td_att%c_value 1129 1117 … … 1259 1247 1260 1248 END SUBROUTINE att__clean_arr 1261 !-------------------------------------------------------------------1262 !> @brief This subroutine fill dummy attribute array1263 !1264 !> @author J.Paul1265 !> @date September, 2015 - Initial Version1266 !> @date Marsh, 20161267 !> - close file (bugfix)1268 !1269 !> @param[in] cd_dummy dummy configuration file1270 !-------------------------------------------------------------------1271 SUBROUTINE att_get_dummy( cd_dummy )1272 IMPLICIT NONE1273 ! Argument1274 CHARACTER(LEN=*), INTENT(IN) :: cd_dummy1275 1276 ! local variable1277 INTEGER(i4) :: il_fileid1278 INTEGER(i4) :: il_status1279 1280 LOGICAL :: ll_exist1281 1282 ! loop indices1283 ! namelist1284 CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumvar1285 CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumdim1286 CHARACTER(LEN=lc), DIMENSION(ip_maxdum) :: cn_dumatt1287 1288 !----------------------------------------------------------------1289 NAMELIST /namdum/ & !< dummy namelist1290 & cn_dumvar, & !< variable name1291 & cn_dumdim, & !< dimension name1292 & cn_dumatt !< attribute name1293 !----------------------------------------------------------------1294 1295 ! init1296 cm_dumatt(:)=''1297 1298 ! read namelist1299 INQUIRE(FILE=TRIM(cd_dummy), EXIST=ll_exist)1300 IF( ll_exist )THEN1301 1302 il_fileid=fct_getunit()1303 1304 OPEN( il_fileid, FILE=TRIM(cd_dummy), &1305 & FORM='FORMATTED', &1306 & ACCESS='SEQUENTIAL', &1307 & STATUS='OLD', &1308 & ACTION='READ', &1309 & IOSTAT=il_status)1310 CALL fct_err(il_status)1311 IF( il_status /= 0 )THEN1312 CALL logger_fatal("DIM GET DUMMY: opening "//TRIM(cd_dummy))1313 ENDIF1314 1315 READ( il_fileid, NML = namdum )1316 cm_dumatt(:)=cn_dumatt(:)1317 1318 CLOSE( il_fileid )1319 1320 ENDIF1321 1322 END SUBROUTINE att_get_dummy1323 !-------------------------------------------------------------------1324 !> @brief This function check if attribute is defined as dummy attribute1325 !> in configuraton file1326 !>1327 !> @author J.Paul1328 !> @date September, 2015 - Initial Version1329 !1330 !> @param[in] td_att attribute structure1331 !> @return true if attribute is dummy attribute1332 !-------------------------------------------------------------------1333 FUNCTION att_is_dummy(td_att)1334 IMPLICIT NONE1335 1336 ! Argument1337 TYPE(TATT), INTENT(IN) :: td_att1338 1339 ! function1340 LOGICAL :: att_is_dummy1341 1342 ! loop indices1343 INTEGER(i4) :: ji1344 !----------------------------------------------------------------1345 1346 att_is_dummy=.FALSE.1347 DO ji=1,ip_maxdum1348 IF( fct_lower(td_att%c_name) == fct_lower(cm_dumatt(ji)) )THEN1349 att_is_dummy=.TRUE.1350 EXIT1351 ENDIF1352 ENDDO1353 1354 END FUNCTION att_is_dummy1355 1249 END MODULE att 1356 1250
Note: See TracChangeset
for help on using the changeset viewer.