Changeset 963 for IOIPSL/trunk


Ignore:
Timestamp:
03/31/10 17:26:11 (15 years ago)
Author:
bellier
Message:

Added the "getin_name" subroutine which allows the user
to change the name of the definition file in which
the data will be read. ("run.def" by default)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • IOIPSL/trunk/src/getincom.f90

    r536 r963  
    1313!- 
    1414PRIVATE 
    15 PUBLIC :: getin, getin_dump 
     15PUBLIC :: getin_name, getin, getin_dump 
     16!- 
     17!!-------------------------------------------------------------------- 
     18!! The "getin_name" routine allows the user to change the name 
     19!! of the definition file in which the data will be read. 
     20!! ("run.def" by default) 
     21!! 
     22!!  SUBROUTINE getin_name (file_name) 
     23!! 
     24!! OPTIONAL INPUT argument 
     25!! 
     26!! (C) file_name :  the name of the file 
     27!!                  in which the data will be read 
     28!!-------------------------------------------------------------------- 
     29!- 
    1630!- 
    1731INTERFACE getin 
     
    1933!! The "getin" routines get a variable. 
    2034!! We first check if we find it in the database 
    21 !! and if not we get it from the run.def file. 
     35!! and if not we get it from the definition file. 
    2236!! 
    2337!! SUBROUTINE getin (target,ret_val) 
     
    4155!!-------------------------------------------------------------------- 
    4256!! The "getin_dump" routine will dump the content of the database 
    43 !! into a file which has the same format as the run.def file. 
     57!! into a file which has the same format as the definition file. 
    4458!! The idea is that the user can see which parameters were used 
    4559!! and re-use the file for another run. 
     
    5771  INTEGER,SAVE      :: nbfiles 
    5872!- 
     73  INTEGER,SAVE :: allread=0 
     74  CHARACTER(LEN=100),SAVE :: def_file = 'run.def' 
     75!- 
    5976  INTEGER,PARAMETER :: i_txtslab=1000,l_n=30 
    6077  INTEGER,SAVE :: nb_lines,i_txtsize=0 
     
    7895!- 
    7996! keystatus definition 
    80 ! keystatus = 1 : Value comes from run.def 
     97! keystatus = 1 : Value comes from the file defined by 'def_file' 
    8198! keystatus = 2 : Default value is used 
    8299! keystatus = 3 : Some vector elements were taken from default 
     
    112129!- 
    113130CONTAINS 
     131!- 
     132!=== DEFINITION FILE NAME INTERFACE 
     133!- 
     134SUBROUTINE getin_name (cname) 
     135!--------------------------------------------------------------------- 
     136  IMPLICIT NONE 
     137!- 
     138  CHARACTER(LEN=*) :: cname 
     139!--------------------------------------------------------------------- 
     140  IF (allread == 0) THEN 
     141    def_file = ADJUSTL(cname) 
     142  ELSE 
     143    CALL ipslerr (3,'getin_name', & 
     144 &   'The name of the database file (any_name.def)', & 
     145 &   'must be changed *before* any attempt','to read the database.') 
     146  ENDIF 
     147!------------------------ 
     148END SUBROUTINE getin_name 
    114149!- 
    115150!=== INTEGER INTERFACE 
     
    10081043  IMPLICIT NONE 
    10091044!- 
    1010   INTEGER,SAVE :: allread=0 
    10111045  INTEGER,SAVE :: current 
    10121046!--------------------------------------------------------------------- 
     
    10211055!-- Start with reading the files 
    10221056    nbfiles = 1 
    1023     filelist(1) = 'run.def' 
     1057    filelist(1) = TRIM(def_file) 
    10241058    current = 1 
    10251059!-- 
     
    11461180!- 
    11471181  IF (check) THEN 
    1148     OPEN (UNIT=22,file='run.def.test') 
     1182    OPEN (UNIT=22,file=TRIM(def_file)//'.test') 
    11491183    DO i=1,nb_lines 
    11501184      WRITE(UNIT=22,FMT=*) targetlist(i)," : ",fichier(i) 
     
    14161450!- 
    14171451  TYPE(t_key),ALLOCATABLE,DIMENSION(:) :: tmp_key_tab 
    1418   CHARACTER(LEN=100),ALLOCATABLE :: tmp_str(:) 
    14191452!- 
    14201453  INTEGER :: ier 
     
    17871820        CASE(1) 
    17881821          WRITE(22,*) '# Values of ', & 
    1789  &          TRIM(key_tab(ikey)%keystr),' comes from the run.def.' 
     1822 &          TRIM(key_tab(ikey)%keystr),' comes from ',TRIM(def_file) 
    17901823        CASE(2) 
    17911824          WRITE(22,*) '# Values of ', & 
     
    17941827          WRITE(22,*) '# Values of ', & 
    17951828 &          TRIM(key_tab(ikey)%keystr), & 
    1796  &          ' are a mix of run.def and defaults.' 
     1829 &          ' are a mix of ',TRIM(def_file),' and defaults.' 
    17971830        CASE DEFAULT 
    17981831          WRITE(22,*) '# Dont know from where the value of ', & 
Note: See TracChangeset for help on using the changeset viewer.