Changeset 12080 for utils/tools/SIREN/src/file.f90
- Timestamp:
- 2019-12-06T10:30:14+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/tools/SIREN/src/file.f90
r9598 r12080 2 2 ! NEMO system team, System and Interface for oceanic RElocable Nesting 3 3 !---------------------------------------------------------------------- 4 !5 ! MODULE: file6 4 ! 7 5 !> @brief … … 136 134 !> @author 137 135 !> J.Paul 138 ! REVISION HISTORY:136 !> 139 137 !> @date November, 2013 - Initial Version 140 138 !> @date November, 2014 141 139 !> - Fix memory leaks bug 142 140 !> 143 !> @note Software governed by the CeCILL licence ( ./LICENSE)141 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 144 142 !---------------------------------------------------------------------- 145 143 MODULE file 144 146 145 USE kind ! F90 kind parameter 147 146 USE global ! global variable … … 151 150 USE att ! attribute manager 152 151 USE var ! variable manager 152 153 153 IMPLICIT NONE 154 154 ! NOTE_avoid_public_variables_if_possible … … 272 272 273 273 CONTAINS 274 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 FUNCTION file__copy_unit(td_file) & 276 & RESULT (tf_file) 274 277 !------------------------------------------------------------------- 275 278 !> @brief … … 293 296 !> - use function instead of overload assignment operator 294 297 !> (to avoid memory leak) 295 ! 298 !> @date January, 2019 299 !> - clean variable structure 300 !> 296 301 !> @param[in] td_file file structure 297 302 !> @return copy of input file structure 298 303 !------------------------------------------------------------------- 299 FUNCTION file__copy_unit( td_file ) 300 IMPLICIT NONE 304 305 IMPLICIT NONE 306 301 307 ! Argument 302 308 TYPE(TFILE), INTENT(IN) :: td_file 309 303 310 ! function 304 TYPE(TFILE) :: file__copy_unit311 TYPE(TFILE) :: tf_file 305 312 306 313 ! local variable … … 315 322 316 323 ! copy file variable 317 file__copy_unit%c_name = TRIM(td_file%c_name)318 file__copy_unit%c_type = TRIM(td_file%c_type)324 tf_file%c_name = TRIM(td_file%c_name) 325 tf_file%c_type = TRIM(td_file%c_type) 319 326 ! file1 should be closed even if file2 is opened right now 320 file__copy_unit%i_id = 0321 file__copy_unit%l_wrt = td_file%l_wrt322 file__copy_unit%i_nvar = td_file%i_nvar323 324 file__copy_unit%c_grid = td_file%c_grid325 326 file__copy_unit%i_ew = td_file%i_ew327 file__copy_unit%i_perio= td_file%i_perio328 file__copy_unit%i_pivot= td_file%i_pivot329 330 file__copy_unit%i_depthid = td_file%i_depthid331 file__copy_unit%i_timeid = td_file%i_timeid327 tf_file%i_id = 0 328 tf_file%l_wrt = td_file%l_wrt 329 tf_file%i_nvar = td_file%i_nvar 330 331 tf_file%c_grid = td_file%c_grid 332 333 tf_file%i_ew = td_file%i_ew 334 tf_file%i_perio= td_file%i_perio 335 tf_file%i_pivot= td_file%i_pivot 336 337 tf_file%i_depthid = td_file%i_depthid 338 tf_file%i_timeid = td_file%i_timeid 332 339 333 340 ! copy variable structure 334 IF( ASSOCIATED( file__copy_unit%t_var) )THEN335 CALL var_clean( file__copy_unit%t_var(:))336 DEALLOCATE( file__copy_unit%t_var)337 ENDIF 338 IF( ASSOCIATED(td_file%t_var) .AND. file__copy_unit%i_nvar > 0 )THEN339 ALLOCATE( file__copy_unit%t_var(file__copy_unit%i_nvar) )340 DO ji=1, file__copy_unit%i_nvar341 IF( ASSOCIATED(tf_file%t_var) )THEN 342 CALL var_clean(tf_file%t_var(:)) 343 DEALLOCATE(tf_file%t_var) 344 ENDIF 345 IF( ASSOCIATED(td_file%t_var) .AND. tf_file%i_nvar > 0 )THEN 346 ALLOCATE( tf_file%t_var(tf_file%i_nvar) ) 347 DO ji=1,tf_file%i_nvar 341 348 tl_var = var_copy(td_file%t_var(ji)) 342 file__copy_unit%t_var(ji) = var_copy(tl_var) 349 tf_file%t_var(ji) = var_copy(tl_var) 350 ! clean 351 CALL var_clean(tl_var) 343 352 ENDDO 344 353 ENDIF 345 354 346 355 ! copy netcdf variable 347 file__copy_unit%i_ndim = td_file%i_ndim348 file__copy_unit%i_natt = td_file%i_natt349 file__copy_unit%i_uldid = td_file%i_uldid350 file__copy_unit%l_def = td_file%l_def356 tf_file%i_ndim = td_file%i_ndim 357 tf_file%i_natt = td_file%i_natt 358 tf_file%i_uldid = td_file%i_uldid 359 tf_file%l_def = td_file%l_def 351 360 352 361 ! copy dimension 353 file__copy_unit%t_dim(:) = dim_copy(td_file%t_dim(:))362 tf_file%t_dim(:) = dim_copy(td_file%t_dim(:)) 354 363 355 364 ! copy attribute structure 356 IF( ASSOCIATED( file__copy_unit%t_att) )THEN357 CALL att_clean( file__copy_unit%t_att(:))358 DEALLOCATE( file__copy_unit%t_att)359 ENDIF 360 IF( ASSOCIATED(td_file%t_att) .AND. file__copy_unit%i_natt > 0 )THEN361 ALLOCATE( file__copy_unit%t_att(file__copy_unit%i_natt) )362 DO ji=1, file__copy_unit%i_natt365 IF( ASSOCIATED(tf_file%t_att) )THEN 366 CALL att_clean(tf_file%t_att(:)) 367 DEALLOCATE(tf_file%t_att) 368 ENDIF 369 IF( ASSOCIATED(td_file%t_att) .AND. tf_file%i_natt > 0 )THEN 370 ALLOCATE( tf_file%t_att(tf_file%i_natt) ) 371 DO ji=1,tf_file%i_natt 363 372 tl_att = att_copy(td_file%t_att(ji)) 364 file__copy_unit%t_att(ji) = att_copy(tl_att)373 tf_file%t_att(ji) = att_copy(tl_att) 365 374 ENDDO 366 375 ENDIF … … 370 379 371 380 ! copy dimg variable 372 file__copy_unit%i_recl = td_file%i_recl373 file__copy_unit%i_n0d = td_file%i_n0d374 file__copy_unit%i_n1d = td_file%i_n1d375 file__copy_unit%i_n2d = td_file%i_n2d376 file__copy_unit%i_n3d = td_file%i_n3d377 file__copy_unit%i_rhd = td_file%i_rhd381 tf_file%i_recl = td_file%i_recl 382 tf_file%i_n0d = td_file%i_n0d 383 tf_file%i_n1d = td_file%i_n1d 384 tf_file%i_n2d = td_file%i_n2d 385 tf_file%i_n3d = td_file%i_n3d 386 tf_file%i_rhd = td_file%i_rhd 378 387 379 388 ! copy mpp variable 380 file__copy_unit%i_pid = td_file%i_pid381 file__copy_unit%i_impp = td_file%i_impp382 file__copy_unit%i_jmpp = td_file%i_jmpp383 file__copy_unit%i_lci = td_file%i_lci384 file__copy_unit%i_lcj = td_file%i_lcj385 file__copy_unit%i_ldi = td_file%i_ldi386 file__copy_unit%i_ldj = td_file%i_ldj387 file__copy_unit%i_lei = td_file%i_lei388 file__copy_unit%i_lej = td_file%i_lej389 file__copy_unit%l_ctr = td_file%l_ctr390 file__copy_unit%l_use = td_file%l_use391 file__copy_unit%i_iind = td_file%i_iind392 file__copy_unit%i_jind = td_file%i_jind389 tf_file%i_pid = td_file%i_pid 390 tf_file%i_impp = td_file%i_impp 391 tf_file%i_jmpp = td_file%i_jmpp 392 tf_file%i_lci = td_file%i_lci 393 tf_file%i_lcj = td_file%i_lcj 394 tf_file%i_ldi = td_file%i_ldi 395 tf_file%i_ldj = td_file%i_ldj 396 tf_file%i_lei = td_file%i_lei 397 tf_file%i_lej = td_file%i_lej 398 tf_file%l_ctr = td_file%l_ctr 399 tf_file%l_use = td_file%l_use 400 tf_file%i_iind = td_file%i_iind 401 tf_file%i_jind = td_file%i_jind 393 402 394 403 END FUNCTION file__copy_unit 404 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 FUNCTION file__copy_arr(td_file) & 406 & RESULT (tf_file) 395 407 !------------------------------------------------------------------- 396 408 !> @brief … … 414 426 !> - use function instead of overload assignment operator 415 427 !> (to avoid memory leak) 416 ! 428 !> 417 429 !> @param[in] td_file file structure 418 430 !> @return copy of input array of file structure 419 431 !------------------------------------------------------------------- 420 FUNCTION file__copy_arr( td_file ) 421 IMPLICIT NONE 432 433 IMPLICIT NONE 434 422 435 ! Argument 423 TYPE(TFILE), DIMENSION(:) , INTENT(IN ) :: td_file 436 TYPE(TFILE), DIMENSION(:), INTENT(IN ) :: td_file 437 424 438 ! function 425 TYPE(TFILE), DIMENSION(SIZE(td_file(:))) :: file__copy_arr439 TYPE(TFILE), DIMENSION(SIZE(td_file(:))) :: tf_file 426 440 427 441 ! loop indices … … 430 444 431 445 DO ji=1,SIZE(td_file(:)) 432 file__copy_arr(ji)=file_copy(td_file(ji))446 tf_file(ji)=file_copy(td_file(ji)) 433 447 ENDDO 434 448 435 449 END FUNCTION file__copy_arr 450 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 FUNCTION file_init(cd_file, cd_type, ld_wrt, & 452 & id_ew, id_perio, id_pivot,& 453 & cd_grid) & 454 & RESULT (tf_file) 436 455 !------------------------------------------------------------------- 437 456 !> @brief This function initialize file structure.<br/> … … 441 460 !> Optionally, you could specify:<br/> 442 461 !> - write mode (default .FALSE., ld_wrt) 443 ! %- East-West overlap (id_ew)444 ! %- NEMO periodicity index (id_perio)445 ! %- NEMO pivot point index F(0),T(1) (id_pivot)462 !> - East-West overlap (id_ew) 463 !> - NEMO periodicity index (id_perio) 464 !> - NEMO pivot point index F(0),T(1) (id_pivot) 446 465 !> - grid type (default: 'ARAKAWA-C') 447 ! 466 !> 448 467 !> @details 449 ! 468 !> 450 469 !> @author J.Paul 451 470 !> @date November, 2013 - Initial Version 452 ! 471 !> 453 472 !> @param[in] cd_file file name 454 473 !> @param[in] cd_type file type ('cdf', 'dimg') … … 460 479 !> @return file structure 461 480 !------------------------------------------------------------------- 462 TYPE(TFILE) FUNCTION file_init( cd_file, cd_type, ld_wrt, & 463 & id_ew, id_perio, id_pivot,& 464 & cd_grid) 465 IMPLICIT NONE 481 482 IMPLICIT NONE 483 466 484 ! Argument 467 485 CHARACTER(LEN=*), INTENT(IN) :: cd_file … … 473 491 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: cd_grid 474 492 493 ! function 494 TYPE(TFILE) :: tf_file 495 475 496 ! local variable 476 497 TYPE(TATT) :: tl_att … … 478 499 479 500 ! clean file 480 CALL file_clean( file_init)481 482 file_init%c_name=TRIM(ADJUSTL(cd_file))483 CALL logger_trace("FILE INIT: initialize file "//TRIM( file_init%c_name))501 CALL file_clean(tf_file) 502 503 tf_file%c_name=TRIM(ADJUSTL(cd_file)) 504 CALL logger_trace("FILE INIT: initialize file "//TRIM(tf_file%c_name)) 484 505 485 506 ! check type … … 487 508 SELECT CASE(TRIM(cd_type)) 488 509 CASE('cdf') 489 file_init%c_type='cdf'510 tf_file%c_type='cdf' 490 511 CASE('dimg') 491 file_init%c_type='dimg'512 tf_file%c_type='dimg' 492 513 CASE DEFAULT 493 514 CALL logger_error( " FILE INIT: can't initialize file "//& 494 & TRIM( file_init%c_name)//" : type unknown " )515 & TRIM(tf_file%c_name)//" : type unknown " ) 495 516 END SELECT 496 517 ELSE 497 file_init%c_type=TRIM(file_get_type(cd_file)) 518 CALL logger_debug("FILE INIT: look for file type "//TRIM(tf_file%c_name)) 519 tf_file%c_type=TRIM(file_get_type(cd_file)) 498 520 ENDIF 499 521 500 522 ! create some global attribute 501 IF( TRIM( file_init%c_type) == 'cdf' )THEN523 IF( TRIM(tf_file%c_type) == 'cdf' )THEN 502 524 tl_att=att_init("Conventions","CF-1.5") 503 CALL file_add_att( file_init,tl_att)525 CALL file_add_att(tf_file,tl_att) 504 526 ENDIF 505 527 506 tl_att=att_init("Grid",TRIM( file_init%c_grid))507 CALL file_add_att( file_init,tl_att)528 tl_att=att_init("Grid",TRIM(tf_file%c_grid)) 529 CALL file_add_att(tf_file,tl_att) 508 530 509 531 IF( PRESENT(ld_wrt) )THEN 510 file_init%l_wrt=ld_wrt532 tf_file%l_wrt=ld_wrt 511 533 ENDIF 512 534 513 535 IF( PRESENT(id_ew) )THEN 514 file_init%i_ew=id_ew536 tf_file%i_ew=id_ew 515 537 IF( id_ew >= 0 )THEN 516 538 tl_att=att_init('ew_overlap',id_ew) 517 CALL file_move_att( file_init, tl_att)539 CALL file_move_att(tf_file, tl_att) 518 540 ENDIF 519 541 ENDIF 520 542 521 543 IF( PRESENT(id_perio) )THEN 522 file_init%i_perio=id_perio544 tf_file%i_perio=id_perio 523 545 IF( id_perio >= 0 )THEN 524 546 tl_att=att_init('periodicity',id_perio) 525 CALL file_move_att( file_init, tl_att)547 CALL file_move_att(tf_file, tl_att) 526 548 ENDIF 527 549 ENDIF 528 550 529 551 IF( PRESENT(id_pivot) )THEN 530 file_init%i_pivot=id_pivot552 tf_file%i_pivot=id_pivot 531 553 IF( id_pivot > 0 )THEN 532 554 tl_att=att_init('pivot_point',id_pivot) 533 CALL file_move_att( file_init, tl_att)555 CALL file_move_att(tf_file, tl_att) 534 556 ENDIF 535 557 ENDIF 536 558 537 559 IF( PRESENT(cd_grid) )THEN 538 file_init%c_grid=cd_grid560 tf_file%c_grid=cd_grid 539 561 ENDIF 540 562 … … 543 565 544 566 END FUNCTION file_init 567 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 FUNCTION file_get_type(cd_file) & 569 & RESULT (cf_type) 545 570 !------------------------------------------------------------------- 546 571 !> @brief … … 555 580 !> @author J.Paul 556 581 !> @date November, 2013 - Initial Version 557 ! 582 !> @date January, 2019 583 !> - netcdf4 files identify as netcdf file 584 !> 558 585 !> @param[in] cd_file file name 559 586 !> @return type of file 560 587 !------------------------------------------------------------------- 561 CHARACTER(LEN=lc) FUNCTION file_get_type(cd_file) 562 IMPLICIT NONE 588 589 IMPLICIT NONE 590 563 591 ! Argument 564 592 CHARACTER(LEN=*), INTENT(IN) :: cd_file 565 593 594 ! function 595 CHARACTER(LEN=lc) :: cf_type 596 566 597 !local variable 567 598 CHARACTER(LEN=lc) :: cl_suffix … … 570 601 cl_suffix=file__get_suffix(cd_file) 571 602 SELECT CASE( TRIM(fct_lower(cl_suffix)) ) 572 CASE('.nc','.cdf' )603 CASE('.nc','.cdf','.nc4') 573 604 CALL logger_debug(" FILE GET TYPE: file "//TRIM(cd_file)//" is cdf") 574 file_get_type='cdf' 605 ! Warning : type could be change to cdf4 when opening file. 606 cf_type='cdf' 575 607 CASE('.dimg') 576 608 CALL logger_debug(" FILE GET TYPE: file "//TRIM(cd_file)//" is dimg" ) 577 file_get_type='dimg'609 cf_type='dimg' 578 610 CASE DEFAULT 579 611 CALL logger_warn(" FILE GET TYPE: type unknown, we assume file: "//& 580 612 & TRIM(cd_file)//" is dimg ") 581 file_get_type='dimg'613 cf_type='dimg' 582 614 END SELECT 583 615 584 616 END FUNCTION file_get_type 585 !------------------------------------------------------------------- 586 !> @brief This function check if variable dimension to be used 587 !> have the same length that in file structure. 617 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 FUNCTION file_check_var_dim(td_file, td_var, ld_chklen) & 619 & RESULT (lf_dim) 620 !------------------------------------------------------------------- 621 !> @brief This function check that variable dimension to be used 622 !> of both variable and file structure are convenient (axis, length). 588 623 ! 589 624 !> @details 625 !> optionaly you could choose to not check length 590 626 ! 591 627 !> @author J.Paul 592 628 !> @date November, 2013 - Initial Version 629 !> @date September, 2017 630 !> - add option to not check dimension length 593 631 ! 594 632 !> @param[in] td_file file structure 595 633 !> @param[in] td_var variable structure 634 !> @param[in] ld_chklen check length 596 635 !> @return true if dimension of variable and file structure agree 597 636 !------------------------------------------------------------------- 598 LOGICAL FUNCTION file_check_var_dim(td_file, td_var) 599 IMPLICIT NONE 637 638 IMPLICIT NONE 639 600 640 ! Argument 601 641 TYPE(TFILE), INTENT(IN) :: td_file 602 642 TYPE(TVAR), INTENT(IN) :: td_var 643 LOGICAL, INTENT(IN), OPTIONAL :: ld_chklen 644 645 ! function 646 LOGICAL :: lf_dim 603 647 604 648 ! local variable … … 606 650 LOGICAL :: ll_error 607 651 LOGICAL :: ll_warn 652 LOGICAL :: ll_chklen 653 LOGICAL :: ll_use 654 LOGICAL :: ll_len 608 655 609 656 INTEGER(i4) :: il_ind … … 612 659 INTEGER(i4) :: ji 613 660 !---------------------------------------------------------------- 614 file_check_var_dim=.TRUE. 661 662 lf_dim=.TRUE. 663 664 CALL logger_debug( " FILE CHECK VAR DIM: check: "//TRIM(td_var%c_name) ) 665 ! check dimension length 666 ll_chklen=.TRUE. 667 IF( PRESENT(ld_chklen) ) ll_chklen=ld_chklen 615 668 616 669 ! check used dimension … … 621 674 & TRIM(td_var%t_dim(ji)%c_name), & 622 675 & TRIM(td_var%t_dim(ji)%c_sname)) 676 623 677 IF( il_ind /= 0 )THEN 624 IF( td_var%t_dim(ji)%l_use .AND. & 625 & td_file%t_dim(il_ind)%l_use .AND. & 626 & td_var%t_dim(ji)%i_len /= td_file%t_dim(il_ind)%i_len )THEN 678 ll_use=(td_var%t_dim(ji)%l_use .AND. td_file%t_dim(il_ind)%l_use) 679 680 ll_len=.TRUE. 681 IF( ll_chklen )THEN 682 ! check dimension length 683 ll_len=(td_var%t_dim(ji)%i_len == td_file%t_dim(il_ind)%i_len) 684 ENDIF 685 IF( ll_use .AND. .NOT. ll_len )THEN 627 686 IF( INDEX( TRIM(td_var%c_axis), & 628 687 & TRIM(fct_upper(td_var%t_dim(ji)%c_name))) == 0 )THEN … … 659 718 CALL logger_debug( " variable dimension: "//TRIM(cl_dim) ) 660 719 661 file_check_var_dim=.FALSE.720 lf_dim=.FALSE. 662 721 663 722 CALL logger_error( & … … 683 742 684 743 END FUNCTION file_check_var_dim 744 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 745 SUBROUTINE file_add_var(td_file, td_var) 685 746 !------------------------------------------------------------------- 686 747 !> @brief This subroutine add a variable structure in a file structure.<br/> … … 698 759 !> @date September, 2015 699 760 !> - check variable dimension expected 700 ! 761 !> @date January, 2019 762 !> - clean variable structure 763 !> 701 764 !> @param[inout] td_file file structure 702 765 !> @param[in] td_var variable structure 703 766 !------------------------------------------------------------------- 704 SUBROUTINE file_add_var(td_file, td_var) 767 705 768 IMPLICIT NONE 706 769 … … 831 894 ! clean 832 895 CALL var_clean(tl_var(:)) 833 DEALLOCATE(tl_var)834 896 ENDIF 897 DEALLOCATE(tl_var) 835 898 836 899 ELSE … … 861 924 ELSE 862 925 tl_var(1)=var_copy(td_var) 926 ! remove old id 927 tl_var(1)%i_id=0 863 928 864 929 ! update dimension name in new variable … … 897 962 ! clean 898 963 CALL var_clean( tl_var(:) ) 899 DEALLOCATE(tl_var)900 964 ENDIF 965 DEALLOCATE(tl_var) 966 901 967 ENDIF 902 968 ENDIF … … 905 971 906 972 END SUBROUTINE file_add_var 973 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 974 SUBROUTINE file__del_var_name(td_file, cd_name) 907 975 !------------------------------------------------------------------- 908 976 !> @brief This subroutine delete a variable structure 909 977 !> in file structure, given variable name or standard name. 910 ! 978 !> 911 979 !> @author J.Paul 912 980 !> @date November, 2013 - Initial Version 913 981 !> @date February, 2015 914 982 !> - define local variable structure to avoid mistake with pointer 915 ! 983 !> 916 984 !> @param[inout] td_file file structure 917 985 !> @param[in] cd_name variable name or standard name 918 986 !------------------------------------------------------------------- 919 SUBROUTINE file__del_var_name(td_file, cd_name ) 987 920 988 IMPLICIT NONE 921 989 … … 950 1018 tl_var=var_copy(td_file%t_var(il_ind)) 951 1019 CALL file_del_var(td_file, tl_var) 952 1020 ! clean 1021 CALL var_clean(tl_var) 953 1022 ELSE 954 1023 … … 969 1038 970 1039 END SUBROUTINE file__del_var_name 1040 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1041 SUBROUTINE file__del_var_str(td_file, td_var) 971 1042 !------------------------------------------------------------------- 972 1043 !> @brief This subroutine delete a variable structure … … 975 1046 !> @author J.Paul 976 1047 !> @date November, 2013 - Initial Version 1048 !> @date January, 2019 1049 !> - clean variable structure 977 1050 !> 978 1051 !> @param[inout] td_file file structure 979 1052 !> @param[in] td_var variable structure 980 1053 !------------------------------------------------------------------- 981 SUBROUTINE file__del_var_str(td_file, td_var) 1054 982 1055 IMPLICIT NONE 983 1056 … … 1101 1174 ! clean 1102 1175 CALL var_clean(tl_var(:)) 1103 DEALLOCATE(tl_var)1104 1105 1176 ENDIF 1177 DEALLOCATE(tl_var) 1178 1106 1179 ENDIF 1107 1180 ENDIF … … 1109 1182 1110 1183 END SUBROUTINE file__del_var_str 1184 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1185 SUBROUTINE file_move_var(td_file, td_var) 1111 1186 !------------------------------------------------------------------- 1112 1187 !> @brief This subroutine overwrite variable structure … … 1121 1196 !> @param[in] td_var variable structure 1122 1197 !------------------------------------------------------------------- 1123 SUBROUTINE file_move_var(td_file, td_var) 1198 1124 1199 IMPLICIT NONE 1125 1200 … … 1145 1220 1146 1221 END SUBROUTINE file_move_var 1222 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1223 SUBROUTINE file_add_att(td_file, td_att) 1147 1224 !------------------------------------------------------------------- 1148 1225 !> @brief This subroutine add a global attribute … … 1152 1229 !> @author J.Paul 1153 1230 !> @date November, 2013 - Initial Version 1154 ! 1231 !> @date January, 2019 1232 !> - clean attribute structure 1233 !> 1155 1234 !> @param[inout] td_file file structure 1156 1235 !> @param[in] td_att attribute structure 1157 1236 !------------------------------------------------------------------- 1158 SUBROUTINE file_add_att(td_file, td_att) 1237 1159 1238 IMPLICIT NONE 1160 1239 … … 1234 1313 ! clean 1235 1314 CALL att_clean(tl_att(:)) 1236 DEALLOCATE(tl_att)1237 1238 1315 ENDIF 1316 DEALLOCATE(tl_att) 1317 1239 1318 ELSE 1240 1319 ! no attribute in file structure … … 1262 1341 1263 1342 END SUBROUTINE file_add_att 1343 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1344 SUBROUTINE file__del_att_name(td_file, cd_name) 1264 1345 !------------------------------------------------------------------- 1265 1346 !> @brief This subroutine delete a global attribute structure 1266 1347 !> in file structure, given attribute name. 1267 ! 1348 !> 1268 1349 !> @author J.Paul 1269 1350 !> @date November, 2013 - Initial Version … … 1271 1352 !> - define local attribute structure to avoid mistake 1272 1353 !> with pointer 1273 ! 1354 !> @date January, 2019 1355 !> - clean attribute structure 1356 !> 1274 1357 !> @param[inout] td_file file structure 1275 1358 !> @param[in] cd_name attribute name 1276 1359 !------------------------------------------------------------------- 1277 SUBROUTINE file__del_att_name(td_file, cd_name ) 1360 1278 1361 IMPLICIT NONE 1279 1362 … … 1308 1391 tl_att=att_copy(td_file%t_att(il_ind)) 1309 1392 CALL file_del_att(td_file, tl_att) 1310 1393 ! clean 1394 CALL att_clean(tl_att) 1311 1395 ELSE 1312 1396 … … 1325 1409 1326 1410 END SUBROUTINE file__del_att_name 1411 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1412 SUBROUTINE file__del_att_str(td_file, td_att) 1327 1413 !------------------------------------------------------------------- 1328 1414 !> @brief This subroutine delete a global attribute structure 1329 1415 !> from file structure, given attribute structure. 1330 ! 1416 !> 1331 1417 !> @author J.Paul 1332 1418 !> @date November, 2013 - Initial Version 1333 ! 1419 !> @date January, 2019 1420 !> - clean attribute structure 1421 !> 1334 1422 !> @param[inout] td_file file structure 1335 1423 !> @param[in] td_att attribute structure 1336 1424 !------------------------------------------------------------------- 1337 SUBROUTINE file__del_att_str(td_file, td_att) 1425 1338 1426 IMPLICIT NONE 1339 1427 … … 1415 1503 ! clean 1416 1504 CALL att_clean(tl_att(:)) 1417 DEALLOCATE(tl_att)1418 1419 1505 ENDIF 1506 DEALLOCATE(tl_att) 1507 1420 1508 ENDIF 1421 1509 ENDIF 1422 1510 1423 1511 END SUBROUTINE file__del_att_str 1512 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1513 SUBROUTINE file_move_att(td_file, td_att) 1424 1514 !------------------------------------------------------------------- 1425 1515 !> @brief This subroutine move a global attribute structure 1426 1516 !> from file structure. 1427 1517 !> @warning change attribute id in file structure. 1428 ! 1518 !> 1429 1519 !> @author J.Paul 1430 1520 !> @date November, 2013 - Initial Version 1431 ! 1521 !> 1432 1522 !> @param[inout] td_file file structure 1433 1523 !> @param[in] td_att attribute structure 1434 1524 !------------------------------------------------------------------- 1435 SUBROUTINE file_move_att(td_file, td_att) 1525 1436 1526 IMPLICIT NONE 1437 1527 … … 1463 1553 1464 1554 END SUBROUTINE file_move_att 1555 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1556 SUBROUTINE file_add_dim(td_file, td_dim) 1465 1557 !------------------------------------------------------------------- 1466 1558 !> @brief This subroutine add a dimension structure in file 1467 1559 !> structure. 1468 1560 !> Do not overwrite, if dimension already in file structure. 1469 ! 1561 !> 1470 1562 !> @author J.Paul 1471 1563 !> @date November, 2013 - Initial Version 1472 1564 !> @date September, 2014 1473 1565 !> - do not reorder dimension, before put in file 1474 ! 1566 !> 1475 1567 !> @param[inout] td_file file structure 1476 1568 !> @param[in] td_dim dimension structure 1477 1569 !------------------------------------------------------------------- 1478 SUBROUTINE file_add_dim(td_file, td_dim) 1570 1479 1571 IMPLICIT NONE 1480 1572 … … 1549 1641 1550 1642 END SUBROUTINE file_add_dim 1643 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1644 SUBROUTINE file_del_dim(td_file, td_dim) 1551 1645 !------------------------------------------------------------------- 1552 1646 !> @brief This subroutine delete a dimension structure in file … … 1555 1649 !> @author J.Paul 1556 1650 !> @date November, 2013 - Initial Version 1557 ! 1651 !> @date January, 2019 1652 !> - clean dimension structure 1653 !> 1558 1654 !> @param[inout] td_file file structure 1559 1655 !> @param[in] td_dim dimension structure 1560 1656 !------------------------------------------------------------------- 1561 SUBROUTINE file_del_dim(td_file, td_dim) 1657 1562 1658 IMPLICIT NONE 1563 1659 … … 1622 1718 ! clean 1623 1719 CALL dim_clean(tl_dim(:)) 1624 DEALLOCATE(tl_dim)1625 1720 ENDIF 1721 DEALLOCATE(tl_dim) 1722 1626 1723 ENDIF 1627 1724 ENDIF 1628 1725 1629 1726 END SUBROUTINE file_del_dim 1727 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1728 SUBROUTINE file_move_dim(td_file, td_dim) 1630 1729 !------------------------------------------------------------------- 1631 1730 !> @brief This subroutine move a dimension structure 1632 1731 !> in file structure. 1633 1732 !> @warning change dimension order in file structure. 1634 ! 1733 !> 1635 1734 !> @author J.Paul 1636 1735 !> @date November, 2013 - Initial Version 1637 ! 1736 !> 1638 1737 !> @param[inout] td_file file structure 1639 1738 !> @param[in] td_dim dimension structure 1640 1739 !------------------------------------------------------------------- 1641 SUBROUTINE file_move_dim(td_file, td_dim) 1740 1642 1741 IMPLICIT NONE 1643 1742 … … 1673 1772 1674 1773 END SUBROUTINE file_move_dim 1774 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1775 SUBROUTINE file_print(td_file) 1675 1776 !------------------------------------------------------------------- 1676 1777 !> @brief This subroutine print some information about file strucutre. 1677 ! 1778 !> 1678 1779 !> @author J.Paul 1679 1780 !> @date November, 2013 - Initial Version 1680 ! 1781 !> 1681 1782 !> @param[in] td_file file structure 1682 1783 !------------------------------------------------------------------- 1683 SUBROUTINE file_print(td_file) 1784 1684 1785 IMPLICIT NONE 1685 1786 … … 1747 1848 1748 1849 END SUBROUTINE file_print 1850 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1851 FUNCTION file__get_suffix(cd_file) & 1852 & RESULT (cf_suffix) 1749 1853 !------------------------------------------------------------------- 1750 1854 !> @brief This function get suffix of file name. … … 1753 1857 !> last '.' in file name.<br/> 1754 1858 !> If no suffix is found, return empty character. 1755 ! 1859 !> 1756 1860 !> @author J.Paul 1757 1861 !> @date November, 2013 - Initial Version 1758 ! 1862 !> 1759 1863 !> @param[in] cd_file file structure 1760 1864 !> @return suffix 1761 1865 !------------------------------------------------------------------- 1762 CHARACTER(LEN=lc) FUNCTION file__get_suffix(cd_file) 1866 1763 1867 IMPLICIT NONE 1764 1868 … … 1766 1870 CHARACTER(LEN=*), INTENT(IN) :: cd_file 1767 1871 1872 ! function 1873 CHARACTER(LEN=lc) :: cf_suffix 1874 1768 1875 ! local variable 1769 1876 INTEGER(i4) :: il_ind … … 1776 1883 IF( il_ind /= 0 )THEN 1777 1884 ! read number in basename 1778 READ( cd_file(il_ind:),'(a)' ) file__get_suffix1779 1780 IF( fct_is_num( file__get_suffix(2:)) )THEN1781 file__get_suffix=''1885 READ( cd_file(il_ind:),'(a)' ) cf_suffix 1886 1887 IF( fct_is_num(cf_suffix(2:)) )THEN 1888 cf_suffix='' 1782 1889 ENDIF 1783 1890 1784 1891 ELSE 1785 file__get_suffix=''1892 cf_suffix='' 1786 1893 ENDIF 1787 1894 1788 1895 END FUNCTION file__get_suffix 1896 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1897 FUNCTION file__get_number(cd_file) & 1898 & RESULT (cf_number) 1789 1899 !------------------------------------------------------------------- 1790 1900 !> @brief This function get number in file name without suffix. … … 1792 1902 !> Actually it get the number following the last separator. 1793 1903 !> separator could be '.' or '_'. 1794 ! 1904 !> 1795 1905 !> @author J.Paul 1796 1906 !> @date November, 2013 - Initial Version … … 1800 1910 !> - add case to not return release number 1801 1911 !> we assume release number only on one digit (ex : file_v3.5.nc) 1802 ! 1912 !> 1803 1913 !> @param[in] cd_file file name (without suffix) 1804 1914 !> @return character file number. 1805 1915 !------------------------------------------------------------------- 1806 CHARACTER(LEN=lc) FUNCTION file__get_number(cd_file) 1916 1807 1917 IMPLICIT NONE 1808 1918 1809 1919 ! Argument 1810 1920 CHARACTER(LEN=lc), INTENT(IN) :: cd_file 1921 1922 ! function 1923 CHARACTER(LEN=lc) :: cf_number 1811 1924 1812 1925 ! local variable … … 1829 1942 IF( il_indmax /= 0 )THEN 1830 1943 ! read number in basename 1831 READ( cd_file(il_indmax:),'(a)' ) file__get_number1832 1833 IF( .NOT. fct_is_num( file__get_number(2:)) )THEN1834 file__get_number=''1835 ELSEIF( LEN(TRIM( file__get_number))-1 == 8 )THEN1944 READ( cd_file(il_indmax:),'(a)' ) cf_number 1945 1946 IF( .NOT. fct_is_num(cf_number(2:)) )THEN 1947 cf_number='' 1948 ELSEIF( LEN(TRIM(cf_number))-1 == 8 )THEN 1836 1949 ! date case yyyymmdd 1837 file__get_number=''1838 ELSEIF( LEN(TRIM( file__get_number))-1 == 1 )THEN1950 cf_number='' 1951 ELSEIF( LEN(TRIM(cf_number))-1 == 1 )THEN 1839 1952 ! release number case 1840 file__get_number=''1953 cf_number='' 1841 1954 ENDIF 1842 1955 ELSE 1843 file__get_number=''1956 cf_number='' 1844 1957 ENDIF 1845 1958 1846 1959 END FUNCTION file__get_number 1960 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1961 FUNCTION file__rename_char(cd_file, id_num) & 1962 & RESULT (cf_file) 1847 1963 !------------------------------------------------------------------- 1848 1964 !> @brief This function rename file name, given processor number. … … 1850 1966 !> If no processor number is given, return file name without number 1851 1967 !> If processor number is given, return file name with new number 1852 ! 1968 !> 1853 1969 !> @author J.Paul 1854 1970 !> @date November, 2013 - Initial Version 1855 ! 1971 !> 1856 1972 !> @param[in] td_file file structure 1857 1973 !> @param[in] id_num processor number (start to 1) 1858 1974 !> @return file name 1859 1975 !------------------------------------------------------------------- 1860 CHARACTER(LEN=lc) FUNCTION file__rename_char(cd_file, id_num) 1976 1861 1977 IMPLICIT NONE 1862 1978 … … 1864 1980 CHARACTER(LEN=*), INTENT(IN) :: cd_file 1865 1981 INTEGER(i4), INTENT(IN), OPTIONAL :: id_num 1982 1983 ! function 1984 CHARACTER(LEN=lc) :: cf_file 1866 1985 1867 1986 ! local variable … … 1901 2020 ! format 1902 2021 WRITE(cl_format,'(a,i1.1,a,i1.1,a)') '(a,a,i',il_numlen,'.',il_numlen,',a)' 1903 WRITE( file__rename_char,cl_format) TRIM(cl_base),TRIM(cl_sep),id_num,TRIM(cl_suffix)2022 WRITE(cf_file,cl_format) TRIM(cl_base),TRIM(cl_sep),id_num,TRIM(cl_suffix) 1904 2023 ELSE 1905 WRITE( file__rename_char,'(a,a)') TRIM(cl_base),TRIM(cl_suffix)1906 ENDIF 1907 CALL logger_trace(" FILE RENAME : "//TRIM( file__rename_char))2024 WRITE(cf_file,'(a,a)') TRIM(cl_base),TRIM(cl_suffix) 2025 ENDIF 2026 CALL logger_trace(" FILE RENAME : "//TRIM(cf_file)) 1908 2027 1909 2028 END FUNCTION file__rename_char 2029 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2030 FUNCTION file__rename_str(td_file, id_num) & 2031 & RESULT (tf_file) 1910 2032 !------------------------------------------------------------------- 1911 2033 !> @brief This function rename file name, given file structure. … … 1913 2035 !> If no processor number is given, return file name without number 1914 2036 !> I processor number is given, return file name with new number 1915 ! 2037 !> 1916 2038 !> @author J.Paul 1917 2039 !> @date November, 2013 - Initial Version 1918 ! 2040 !> 1919 2041 !> @param[in] td_file file structure 1920 2042 !> @param[in] id_num processor number (start to 1) 1921 2043 !> @return file structure 1922 2044 !------------------------------------------------------------------- 1923 TYPE(TFILE) FUNCTION file__rename_str(td_file, id_num) 2045 1924 2046 IMPLICIT NONE 1925 2047 … … 1928 2050 INTEGER(i4), INTENT(IN), OPTIONAL :: id_num 1929 2051 2052 ! function 2053 TYPE(TFILE) :: tf_file 2054 1930 2055 ! local variable 1931 2056 CHARACTER(LEN=lc) :: cl_name … … 1935 2060 cl_name=TRIM( file_rename(td_file%c_name, id_num) ) 1936 2061 1937 file__rename_str=file_init(TRIM(cl_name), TRIM(td_file%c_type))2062 tf_file=file_init(TRIM(cl_name), TRIM(td_file%c_type)) 1938 2063 1939 2064 END FUNCTION file__rename_str 2065 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2066 FUNCTION file_add_suffix(cd_file, cd_type) & 2067 & RESULT (cf_file) 1940 2068 !------------------------------------------------------------------- 1941 2069 !> @brief This function add suffix to file name. 1942 ! 2070 !> 1943 2071 !> @author J.Paul 1944 2072 !> @date November, 2013 - Initial Version 1945 ! 2073 !> 1946 2074 !> @param[in] td_file file structure 1947 2075 !> @return file name 1948 2076 !------------------------------------------------------------------- 1949 CHARACTER(LEN=lc) FUNCTION file_add_suffix(cd_file, cd_type) 2077 1950 2078 IMPLICIT NONE 1951 2079 … … 1954 2082 CHARACTER(LEN=*), INTENT(IN) :: cd_type 1955 2083 2084 ! function 2085 CHARACTER(LEN=lc) :: cf_file 2086 1956 2087 ! local variable 1957 2088 INTEGER(i4) :: il_ind … … 1959 2090 CHARACTER(LEN=lc) :: cl_suffix 1960 2091 !---------------------------------------------------------------- 2092 1961 2093 ! get suffix 1962 2094 cl_suffix=file__get_suffix(cd_file) … … 1970 2102 SELECT CASE(TRIM(cd_type)) 1971 2103 CASE('cdf') 1972 file_add_suffix=TRIM(cl_file)//'.nc'2104 cf_file=TRIM(cl_file)//TRIM(cl_suffix) 1973 2105 CASE('dimg') 1974 2106 IF( TRIM(cl_suffix) /= '' )THEN 1975 file_add_suffix=TRIM(cl_file)//'.dimg'2107 cf_file=TRIM(cl_file)//'.dimg' 1976 2108 ELSE 1977 file_add_suffix=TRIM(cl_file)2109 cf_file=TRIM(cl_file) 1978 2110 ENDIF 1979 2111 CASE DEFAULT … … 1982 2114 1983 2115 END FUNCTION file_add_suffix 2116 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2117 SUBROUTINE file__clean_unit(td_file) 1984 2118 !------------------------------------------------------------------- 1985 2119 !> @brief 1986 2120 !> This subroutine clean file strcuture. 1987 ! 2121 !> 1988 2122 !> @author J.Paul 1989 2123 !> @date November, 2013 - Inital version 1990 ! 2124 !> @date January, 2019 2125 !> - nullify attribute structure inside file structure 2126 !> - nullify variable structure inside file structure 2127 !> 1991 2128 !> @param[inout] td_file file strcuture 1992 2129 !------------------------------------------------------------------- 1993 SUBROUTINE file__clean_unit( td_file ) 1994 IMPLICIT NONE 2130 2131 IMPLICIT NONE 2132 1995 2133 ! Argument 1996 2134 TYPE(TFILE), INTENT(INOUT) :: td_file … … 2009 2147 CALL att_clean( td_file%t_att(:) ) 2010 2148 DEALLOCATE(td_file%t_att) 2149 NULLIFY(td_file%t_att) 2011 2150 ENDIF 2012 2151 … … 2020 2159 CALL var_clean( td_file%t_var(:) ) 2021 2160 DEALLOCATE(td_file%t_var) 2161 NULLIFY(td_file%t_var) 2022 2162 ENDIF 2023 2163 … … 2026 2166 2027 2167 END SUBROUTINE file__clean_unit 2168 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2169 SUBROUTINE file__clean_arr(td_file) 2028 2170 !------------------------------------------------------------------- 2029 2171 !> @brief 2030 2172 !> This subroutine clean file array of file strcuture. 2031 ! 2173 !> 2032 2174 !> @author J.Paul 2033 2175 !> @date Marsh, 2014 - Inital version 2034 ! 2176 !> 2035 2177 !> @param[inout] td_file array file strcuture 2036 2178 !------------------------------------------------------------------- 2037 SUBROUTINE file__clean_arr( td_file ) 2038 IMPLICIT NONE 2179 2180 IMPLICIT NONE 2181 2039 2182 ! Argument 2040 2183 TYPE(TFILE), DIMENSION(:), INTENT(INOUT) :: td_file … … 2050 2193 2051 2194 END SUBROUTINE file__clean_arr 2195 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2196 FUNCTION file_get_id(td_file, cd_name) & 2197 & RESULT (if_id) 2052 2198 !------------------------------------------------------------------- 2053 2199 !> @brief This function return the file id, in a array of file 2054 2200 !> structure, given file name. 2055 ! 2201 !> 2056 2202 !> @author J.Paul 2057 2203 !> @date November, 2013 - Initial Version 2058 ! 2204 !> 2059 2205 !> @param[in] td_file array of file structure 2060 2206 !> @param[in] cd_name file name 2061 2207 !> @return file id in array of file structure (0 if not found) 2062 2208 !------------------------------------------------------------------- 2063 INTEGER(i4) FUNCTION file_get_id(td_file, cd_name) 2064 IMPLICIT NONE 2209 2210 IMPLICIT NONE 2211 2065 2212 ! Argument 2066 2213 TYPE(TFILE) , DIMENSION(:), INTENT(IN) :: td_file 2067 2214 CHARACTER(LEN=*), INTENT(IN) :: cd_name 2068 2215 2216 ! function 2217 INTEGER(i4) :: if_id 2218 2069 2219 ! local variable 2070 2220 INTEGER(i4) :: il_size … … 2073 2223 INTEGER(i4) :: ji 2074 2224 !---------------------------------------------------------------- 2075 file_get_id=02225 if_id=0 2076 2226 il_size=SIZE(td_file(:)) 2077 2227 … … 2081 2231 IF( fct_lower(td_file(ji)%c_name) == fct_lower(cd_name) )THEN 2082 2232 2083 file_get_id=td_file(ji)%i_id2233 if_id=td_file(ji)%i_id 2084 2234 EXIT 2085 2235 … … 2088 2238 2089 2239 END FUNCTION file_get_id 2240 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2241 FUNCTION file_get_unit(td_file) & 2242 & RESULT (if_unit) 2090 2243 !------------------------------------------------------------------- 2091 2244 !> @brief … … 2094 2247 !> @author J.Paul 2095 2248 !> @date September, 2014 - Initial Version 2096 ! 2249 !> 2097 2250 !> @param[in] td_file array of file 2098 2251 !------------------------------------------------------------------- 2099 FUNCTION file_get_unit(td_file) 2100 IMPLICIT NONE 2252 2253 IMPLICIT NONE 2254 2101 2255 ! Argument 2102 2256 TYPE(TFILE), DIMENSION(:), INTENT(IN ) :: td_file 2103 2257 2104 2258 ! function 2105 INTEGER(i4) :: file_get_unit2259 INTEGER(i4) :: if_unit 2106 2260 2107 2261 ! local variable … … 2109 2263 !---------------------------------------------------------------- 2110 2264 2111 file_get_unit=MAXVAL(td_file(:)%i_id)+12265 if_unit=MAXVAL(td_file(:)%i_id)+1 2112 2266 2113 2267 END FUNCTION file_get_unit 2268 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2114 2269 END MODULE file 2115 2270
Note: See TracChangeset
for help on using the changeset viewer.