Changeset 125 for IOIPSL/trunk


Ignore:
Timestamp:
08/08/07 15:15:02 (17 years ago)
Author:
bellier
Message:

JB: new version (using fortran 90 features)

File:
1 edited

Legend:

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

    r11 r125  
    55USE errioipsl, ONLY : ipslerr 
    66USE stringop, & 
    7  &   ONLY : nocomma,cmpblank,strlowercase,gensig,find_sig 
     7 &   ONLY : nocomma,cmpblank,strlowercase 
    88!- 
    99IMPLICIT NONE 
     
    1313!- 
    1414INTERFACE getin 
     15!!-------------------------------------------------------------------- 
     16!! The "getin" routines get a variable. 
     17!! We first check if we find it in the database 
     18!! and if not we get it from the run.def file. 
     19!! 
     20!! SUBROUTINE getin (target,ret_val) 
     21!! 
     22!! INPUT 
     23!! 
     24!! (C) target : Name of the variable 
     25!! 
     26!! OUTPUT 
     27!! 
     28!! (I/R/C/L) ret_val : scalar, vector or matrix that will contain 
     29!!                     that will contain the (standard) 
     30!!                     integer/real/character/logical values 
     31!!-------------------------------------------------------------------- 
    1532  MODULE PROCEDURE getinrs, getinr1d, getinr2d, & 
    1633 &                 getinis, getini1d, getini2d, & 
     
    1936END INTERFACE 
    2037!- 
     38!!-------------------------------------------------------------------- 
     39!! The "getin_dump" routine will dump the content of the database 
     40!! into a file which has the same format as the run.def file. 
     41!! The idea is that the user can see which parameters were used 
     42!! and re-use the file for another run. 
     43!! 
     44!!  SUBROUTINE getin_dump (fileprefix) 
     45!! 
     46!! OPTIONAL INPUT argument 
     47!! 
     48!! (C) fileprefix : allows the user to change the name of the file 
     49!!                  in which the data will be archived 
     50!!-------------------------------------------------------------------- 
     51!- 
    2152  INTEGER,PARAMETER :: max_files=100 
    2253  CHARACTER(LEN=100),DIMENSION(max_files),SAVE :: filelist 
     
    2657  INTEGER,SAVE :: nb_lines 
    2758  CHARACTER(LEN=100),DIMENSION(max_lines),SAVE :: fichier 
    28   INTEGER,DIMENSION(max_lines),SAVE :: targetsiglist,fromfile,compline 
    29   CHARACTER(LEN=l_n),DIMENSION(max_lines),SAVE  :: targetlist 
     59  INTEGER,DIMENSION(max_lines),SAVE :: fromfile,compline 
     60  CHARACTER(LEN=l_n),DIMENSION(max_lines),SAVE :: targetlist 
    3061!- 
    3162  INTEGER,PARAMETER :: n_d_fmt=5,max_msgs=15 
     
    3970  INTEGER,SAVE :: nb_keys=0 
    4071  INTEGER,SAVE :: keymemsize=0 
    41   INTEGER,SAVE,ALLOCATABLE :: keysig(:) 
    42   CHARACTER(LEN=l_n),SAVE,ALLOCATABLE :: keystr(:) 
     72!- 
     73! keystr definition 
     74! name of a key 
    4375!- 
    4476! keystatus definition 
     
    4678! keystatus = 2 : Default value is used 
    4779! keystatus = 3 : Some vector elements were taken from default 
    48 !- 
    49   INTEGER,SAVE,ALLOCATABLE :: keystatus(:) 
    5080!- 
    5181! keytype definition 
     
    5787  INTEGER,PARAMETER :: k_i=1, k_r=2, k_c=3, k_l=4 
    5888!- 
    59   INTEGER,SAVE,ALLOCATABLE :: keytype(:) 
    60 !- 
    6189! Allow compression for keys (only for integer and real) 
    62 ! keycompress < 0 : not compresses 
     90! keycompress < 0 : not compressed 
    6391! keycompress > 0 : number of repeat of the value 
    6492!- 
    65   INTEGER,SAVE,ALLOCATABLE :: keycompress(:) 
    66   INTEGER,SAVE,ALLOCATABLE :: keyfromfile(:) 
    67 !- 
    68   INTEGER,SAVE,ALLOCATABLE :: keymemstart(:) 
    69   INTEGER,SAVE,ALLOCATABLE :: keymemlen(:) 
     93TYPE :: t_key 
     94  CHARACTER(LEN=l_n) :: keystr 
     95  INTEGER :: keystatus, keytype, keycompress, & 
     96 &           keyfromfile, keymemstart, keymemlen 
     97END TYPE t_key 
     98!- 
     99  TYPE(t_key),SAVE,ALLOCATABLE,DIMENSION(:) :: key_tab 
    70100!- 
    71101  INTEGER,SAVE,ALLOCATABLE :: i_mem(:) 
     
    84114SUBROUTINE getinis (target,ret_val) 
    85115!--------------------------------------------------------------------- 
    86 !- Get a interer scalar. We first check if we find it 
    87 !- in the database and if not we get it from the run.def 
    88 !- 
    89 !- getini1d and getini2d are written on the same pattern 
    90 !--------------------------------------------------------------------- 
    91116  IMPLICIT NONE 
    92117!- 
     
    95120!- 
    96121  INTEGER,DIMENSION(1) :: tmp_ret_val 
    97   INTEGER :: target_sig,pos,status=0,fileorig 
    98 !--------------------------------------------------------------------- 
    99 !- 
    100 ! Compute the signature of the target 
    101 !- 
    102   CALL gensig (target,target_sig) 
     122  INTEGER :: pos,status=0,fileorig 
     123!--------------------------------------------------------------------- 
    103124!- 
    104125! Do we have this target in our database ? 
    105126!- 
    106   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     127  CALL get_findkey (1,target,pos) 
    107128!- 
    108129  tmp_ret_val(1) = ret_val 
     
    113134!-- Put the data into the database 
    114135    CALL get_wdb & 
    115  &   (target,target_sig,status,fileorig,1,i_val=tmp_ret_val) 
     136 &   (target,status,fileorig,1,i_val=tmp_ret_val) 
    116137  ELSE 
    117138!-- Get the value out of the database 
     
    124145SUBROUTINE getini1d (target,ret_val) 
    125146!--------------------------------------------------------------------- 
    126 !- See getinis for details. It is the same thing but for a vector 
    127 !--------------------------------------------------------------------- 
    128147  IMPLICIT NONE 
    129148!- 
     
    133152  INTEGER,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    134153  INTEGER,SAVE :: tmp_ret_size = 0 
    135   INTEGER :: target_sig,pos,size_of_in,status=0,fileorig 
    136 !--------------------------------------------------------------------- 
    137 !- 
    138 ! Compute the signature of the target 
    139 !- 
    140   CALL gensig (target,target_sig) 
     154  INTEGER :: pos,size_of_in,status=0,fileorig 
     155!--------------------------------------------------------------------- 
    141156!- 
    142157! Do we have this target in our database ? 
    143158!- 
    144   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     159  CALL get_findkey (1,target,pos) 
    145160!- 
    146161  size_of_in = SIZE(ret_val) 
     
    159174!-- Put the data into the database 
    160175    CALL get_wdb & 
    161  &   (target,target_sig,status,fileorig,size_of_in,i_val=tmp_ret_val) 
     176 &   (target,status,fileorig,size_of_in,i_val=tmp_ret_val) 
    162177  ELSE 
    163178!-- Get the value out of the database 
     
    170185SUBROUTINE getini2d (target,ret_val) 
    171186!--------------------------------------------------------------------- 
    172 !- See getinis for details. It is the same thing but for a matrix 
    173 !--------------------------------------------------------------------- 
    174187  IMPLICIT NONE 
    175188!- 
     
    179192  INTEGER,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    180193  INTEGER,SAVE :: tmp_ret_size = 0 
    181   INTEGER :: target_sig,pos,size_of_in,size_1,size_2,status=0,fileorig 
     194  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig 
    182195  INTEGER :: jl,jj,ji 
    183196!--------------------------------------------------------------------- 
    184197!- 
    185 ! Compute the signature of the target 
    186 !- 
    187   CALL gensig (target,target_sig) 
    188 !- 
    189198! Do we have this target in our database ? 
    190199!- 
    191   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     200  CALL get_findkey (1,target,pos) 
    192201!- 
    193202  size_of_in = SIZE(ret_val) 
     
    215224!-- Put the data into the database 
    216225    CALL get_wdb & 
    217  &   (target,target_sig,status,fileorig,size_of_in,i_val=tmp_ret_val) 
     226 &   (target,status,fileorig,size_of_in,i_val=tmp_ret_val) 
    218227  ELSE 
    219228!-- Get the value out of the database 
     
    235244SUBROUTINE getinrs (target,ret_val) 
    236245!--------------------------------------------------------------------- 
    237 !-  Get a real scalar. We first check if we find it 
    238 !-  in the database and if not we get it from the run.def 
    239 !- 
    240 !-  getinr1d and getinr2d are written on the same pattern 
    241 !--------------------------------------------------------------------- 
    242246  IMPLICIT NONE 
    243247!- 
     
    246250!- 
    247251  REAL,DIMENSION(1) :: tmp_ret_val 
    248   INTEGER :: target_sig,pos,status=0,fileorig 
    249 !--------------------------------------------------------------------- 
    250 !- 
    251 ! Compute the signature of the target 
    252 !- 
    253   CALL gensig (target,target_sig) 
     252  INTEGER :: pos,status=0,fileorig 
     253!--------------------------------------------------------------------- 
    254254!- 
    255255! Do we have this target in our database ? 
    256256!- 
    257   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     257  CALL get_findkey (1,target,pos) 
    258258!- 
    259259  tmp_ret_val(1) = ret_val 
     
    264264!-- Put the data into the database 
    265265    CALL get_wdb & 
    266  &   (target,target_sig,status,fileorig,1,r_val=tmp_ret_val) 
     266 &   (target,status,fileorig,1,r_val=tmp_ret_val) 
    267267  ELSE 
    268268!-- Get the value out of the database 
     
    275275SUBROUTINE getinr1d (target,ret_val) 
    276276!--------------------------------------------------------------------- 
    277 !- See getinrs for details. It is the same thing but for a vector 
    278 !--------------------------------------------------------------------- 
    279277  IMPLICIT NONE 
    280278!- 
     
    284282  REAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    285283  INTEGER,SAVE :: tmp_ret_size = 0 
    286   INTEGER :: target_sig,pos,size_of_in,status=0,fileorig 
    287 !--------------------------------------------------------------------- 
    288 !- 
    289 ! Compute the signature of the target 
    290 !- 
    291   CALL gensig (target,target_sig) 
     284  INTEGER :: pos,size_of_in,status=0,fileorig 
     285!--------------------------------------------------------------------- 
    292286!- 
    293287! Do we have this target in our database ? 
    294288!- 
    295   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     289  CALL get_findkey (1,target,pos) 
    296290!- 
    297291  size_of_in = SIZE(ret_val) 
     
    310304!-- Put the data into the database 
    311305    CALL get_wdb & 
    312  &   (target,target_sig,status,fileorig,size_of_in,r_val=tmp_ret_val) 
     306 &   (target,status,fileorig,size_of_in,r_val=tmp_ret_val) 
    313307  ELSE 
    314308!-- Get the value out of the database 
     
    321315SUBROUTINE getinr2d (target,ret_val) 
    322316!--------------------------------------------------------------------- 
    323 !- See getinrs for details. It is the same thing but for a matrix 
    324 !--------------------------------------------------------------------- 
    325317  IMPLICIT NONE 
    326318!- 
     
    330322  REAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    331323  INTEGER,SAVE :: tmp_ret_size = 0 
    332   INTEGER :: target_sig,pos,size_of_in,size_1,size_2,status=0,fileorig 
     324  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig 
    333325  INTEGER :: jl,jj,ji 
    334326!--------------------------------------------------------------------- 
    335327!- 
    336 ! Compute the signature of the target 
    337 !- 
    338   CALL gensig (target,target_sig) 
    339 !- 
    340328! Do we have this target in our database ? 
    341329!- 
    342   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     330  CALL get_findkey (1,target,pos) 
    343331!- 
    344332  size_of_in = SIZE(ret_val) 
     
    366354!-- Put the data into the database 
    367355    CALL get_wdb & 
    368  &   (target,target_sig,status,fileorig,size_of_in,r_val=tmp_ret_val) 
     356 &   (target,status,fileorig,size_of_in,r_val=tmp_ret_val) 
    369357  ELSE 
    370358!-- Get the value out of the database 
     
    386374SUBROUTINE getincs (target,ret_val) 
    387375!--------------------------------------------------------------------- 
    388 !- Get a CHARACTER scalar. We first check if we find it 
    389 !- in the database and if not we get it from the run.def 
    390 !- 
    391 !- getinc1d and getinc2d are written on the same pattern 
    392 !--------------------------------------------------------------------- 
    393376  IMPLICIT NONE 
    394377!- 
     
    397380!- 
    398381  CHARACTER(LEN=100),DIMENSION(1) :: tmp_ret_val 
    399   INTEGER :: target_sig,pos,status=0,fileorig 
    400 !--------------------------------------------------------------------- 
    401 !- 
    402 ! Compute the signature of the target 
    403 !- 
    404   CALL gensig (target,target_sig) 
     382  INTEGER :: pos,status=0,fileorig 
     383!--------------------------------------------------------------------- 
    405384!- 
    406385! Do we have this target in our database ? 
    407386!- 
    408   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     387  CALL get_findkey (1,target,pos) 
    409388!- 
    410389  tmp_ret_val(1) = ret_val 
     
    415394!-- Put the data into the database 
    416395    CALL get_wdb & 
    417  &   (target,target_sig,status,fileorig,1,c_val=tmp_ret_val) 
     396 &   (target,status,fileorig,1,c_val=tmp_ret_val) 
    418397  ELSE 
    419398!-- Get the value out of the database 
     
    426405SUBROUTINE getinc1d (target,ret_val) 
    427406!--------------------------------------------------------------------- 
    428 !- See getincs for details. It is the same thing but for a vector 
    429 !--------------------------------------------------------------------- 
    430407  IMPLICIT NONE 
    431408!- 
     
    435412  CHARACTER(LEN=100),DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    436413  INTEGER,SAVE :: tmp_ret_size = 0 
    437   INTEGER :: target_sig,pos,size_of_in,status=0,fileorig 
    438 !--------------------------------------------------------------------- 
    439 !- 
    440 ! Compute the signature of the target 
    441 !- 
    442   CALL gensig (target,target_sig) 
     414  INTEGER :: pos,size_of_in,status=0,fileorig 
     415!--------------------------------------------------------------------- 
    443416!- 
    444417! Do we have this target in our database ? 
    445418!- 
    446   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     419  CALL get_findkey (1,target,pos) 
    447420!- 
    448421  size_of_in = SIZE(ret_val) 
     
    461434!-- Put the data into the database 
    462435    CALL get_wdb & 
    463  &   (target,target_sig,status,fileorig,size_of_in,c_val=tmp_ret_val) 
     436 &   (target,status,fileorig,size_of_in,c_val=tmp_ret_val) 
    464437  ELSE 
    465438!-- Get the value out of the database 
     
    472445SUBROUTINE getinc2d (target,ret_val) 
    473446!--------------------------------------------------------------------- 
    474 !- See getincs for details. It is the same thing but for a matrix 
    475 !--------------------------------------------------------------------- 
    476447  IMPLICIT NONE 
    477448!- 
     
    481452  CHARACTER(LEN=100),DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    482453  INTEGER,SAVE :: tmp_ret_size = 0 
    483   INTEGER :: target_sig,pos,size_of_in,size_1,size_2,status=0,fileorig 
     454  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig 
    484455  INTEGER :: jl,jj,ji 
    485456!--------------------------------------------------------------------- 
    486457!- 
    487 ! Compute the signature of the target 
    488 !- 
    489   CALL gensig (target,target_sig) 
    490 !- 
    491458! Do we have this target in our database ? 
    492459!- 
    493   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     460  CALL get_findkey (1,target,pos) 
    494461!- 
    495462  size_of_in = SIZE(ret_val) 
     
    517484!-- Put the data into the database 
    518485    CALL get_wdb & 
    519  &   (target,target_sig,status,fileorig,size_of_in,c_val=tmp_ret_val) 
     486 &   (target,status,fileorig,size_of_in,c_val=tmp_ret_val) 
    520487  ELSE 
    521488!-- Get the value out of the database 
     
    537504SUBROUTINE getinls (target,ret_val) 
    538505!--------------------------------------------------------------------- 
    539 !- Get a logical scalar. We first check if we find it 
    540 !- in the database and if not we get it from the run.def 
    541 !- 
    542 !- getinl1d and getinl2d are written on the same pattern 
    543 !--------------------------------------------------------------------- 
    544506  IMPLICIT NONE 
    545507!- 
     
    548510!- 
    549511  LOGICAL,DIMENSION(1) :: tmp_ret_val 
    550   INTEGER :: target_sig,pos,status=0,fileorig 
    551 !--------------------------------------------------------------------- 
    552 !- 
    553 ! Compute the signature of the target 
    554 !- 
    555   CALL gensig (target,target_sig) 
     512  INTEGER :: pos,status=0,fileorig 
     513!--------------------------------------------------------------------- 
    556514!- 
    557515! Do we have this target in our database ? 
    558516!- 
    559   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     517  CALL get_findkey (1,target,pos) 
    560518!- 
    561519  tmp_ret_val(1) = ret_val 
     
    566524!-- Put the data into the database 
    567525    CALL get_wdb & 
    568  &   (target,target_sig,status,fileorig,1,l_val=tmp_ret_val) 
     526 &   (target,status,fileorig,1,l_val=tmp_ret_val) 
    569527  ELSE 
    570528!-- Get the value out of the database 
     
    577535SUBROUTINE getinl1d (target,ret_val) 
    578536!--------------------------------------------------------------------- 
    579 !- See getinls for details. It is the same thing but for a vector 
    580 !--------------------------------------------------------------------- 
    581537  IMPLICIT NONE 
    582538!- 
     
    586542  LOGICAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    587543  INTEGER,SAVE :: tmp_ret_size = 0 
    588   INTEGER :: target_sig,pos,size_of_in,status=0,fileorig 
    589 !--------------------------------------------------------------------- 
    590 !- 
    591 ! Compute the signature of the target 
    592 !- 
    593   CALL gensig (target,target_sig) 
     544  INTEGER :: pos,size_of_in,status=0,fileorig 
     545!--------------------------------------------------------------------- 
    594546!- 
    595547! Do we have this target in our database ? 
    596548!- 
    597   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     549  CALL get_findkey (1,target,pos) 
    598550!- 
    599551  size_of_in = SIZE(ret_val) 
     
    612564!-- Put the data into the database 
    613565    CALL get_wdb & 
    614  &   (target,target_sig,status,fileorig,size_of_in,l_val=tmp_ret_val) 
     566 &   (target,status,fileorig,size_of_in,l_val=tmp_ret_val) 
    615567  ELSE 
    616568!-- Get the value out of the database 
     
    623575SUBROUTINE getinl2d (target,ret_val) 
    624576!--------------------------------------------------------------------- 
    625 !- See getinls for details. It is the same thing but for a matrix 
    626 !--------------------------------------------------------------------- 
    627577  IMPLICIT NONE 
    628578!- 
     
    632582  LOGICAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val 
    633583  INTEGER,SAVE :: tmp_ret_size = 0 
    634   INTEGER :: target_sig,pos,size_of_in,size_1,size_2,status=0,fileorig 
     584  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig 
    635585  INTEGER :: jl,jj,ji 
    636586!--------------------------------------------------------------------- 
    637587!- 
    638 ! Compute the signature of the target 
    639 !- 
    640   CALL gensig (target,target_sig) 
    641 !- 
    642588! Do we have this target in our database ? 
    643589!- 
    644   CALL find_sig (nb_keys,keystr,target,keysig,target_sig,pos) 
     590  CALL get_findkey (1,target,pos) 
    645591!- 
    646592  size_of_in = SIZE(ret_val) 
     
    668614!-- Put the data into the database 
    669615    CALL get_wdb & 
    670  &   (target,target_sig,status,fileorig,size_of_in,l_val=tmp_ret_val) 
     616 &   (target,status,fileorig,size_of_in,l_val=tmp_ret_val) 
    671617  ELSE 
    672618!-- Get the value out of the database 
     
    710656  INTEGER :: k_typ,nb_to_ret,it,pos,len_str,status_cnt,io_err 
    711657  CHARACTER(LEN=n_d_fmt)  :: cnt 
    712   CHARACTER(LEN=37) :: full_target 
    713658  CHARACTER(LEN=80) :: str_READ,str_READ_lower 
    714659  CHARACTER(LEN=9)  :: c_vtyp 
    715   INTEGER :: full_target_sig 
    716660  LOGICAL,DIMENSION(:),ALLOCATABLE :: found 
    717661  LOGICAL :: def_beha,compressed 
     
    749693!--- 
    750694!-- First try the target as it is 
    751     full_target = target 
    752     CALL gensig (full_target,full_target_sig) 
    753     CALL find_sig (nb_lines,targetlist,full_target, & 
    754  &                 targetsiglist,full_target_sig,pos) 
     695    CALL get_findkey (2,target,pos) 
    755696!--- 
    756697!-- Another try 
     
    758699    IF (pos < 0) THEN 
    759700      WRITE(UNIT=cnt,FMT=c_i_fmt) it 
    760       full_target = TRIM(target)//'__'//cnt 
    761       CALL gensig (full_target,full_target_sig) 
    762       CALL find_sig (nb_lines,targetlist,full_target, & 
    763  &                   targetsiglist,full_target_sig,pos) 
     701      CALL get_findkey (2,TRIM(target)//'__'//cnt,pos) 
    764702    ENDIF 
    765703!--- 
     
    818756      ENDIF 
    819757!----- 
    820       targetsiglist(pos) = -1 
    821 !----- 
    822758      IF ( (k_typ == k_i).OR.(k_typ == k_r) ) THEN 
    823759!------- 
     
    919855  CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_val 
    920856!- 
    921   INTEGER :: k_typ 
     857  INTEGER :: k_typ,k_beg,k_end 
    922858  CHARACTER(LEN=9) :: c_vtyp 
    923859!--------------------------------------------------------------------- 
     
    931867  ENDIF 
    932868!- 
    933   IF (keytype(pos) /= k_typ) THEN 
     869  IF (key_tab(pos)%keytype /= k_typ) THEN 
    934870    CALL ipslerr (3,'get_rdb', & 
    935871 &   'Wrong data type for keyword '//TRIM(target), & 
     
    937873  ENDIF 
    938874!- 
    939   IF (keycompress(pos) > 0) THEN 
    940     IF (    (keycompress(pos) /= size_of_in) & 
    941  &      .OR.(keymemlen(pos) /= 1) ) THEN 
     875  IF (key_tab(pos)%keycompress > 0) THEN 
     876    IF (    (key_tab(pos)%keycompress /= size_of_in) & 
     877 &      .OR.(key_tab(pos)%keymemlen /= 1) ) THEN 
    942878      CALL ipslerr (3,'get_rdb', & 
    943879 &     'Wrong compression length','for keyword '//TRIM(target),' ') 
     
    945881      SELECT CASE (k_typ) 
    946882      CASE(k_i) 
    947         i_val(1:size_of_in) = i_mem(keymemstart(pos)) 
     883        i_val(1:size_of_in) = i_mem(key_tab(pos)%keymemstart) 
    948884      CASE(k_r) 
    949         r_val(1:size_of_in) = r_mem(keymemstart(pos)) 
     885        r_val(1:size_of_in) = r_mem(key_tab(pos)%keymemstart) 
    950886      END SELECT 
    951887    ENDIF 
    952888  ELSE 
    953     IF (keymemlen(pos) /= size_of_in) THEN 
     889    IF (key_tab(pos)%keymemlen /= size_of_in) THEN 
    954890      CALL ipslerr (3,'get_rdb', & 
    955891 &     'Wrong array length','for keyword '//TRIM(target),' ') 
    956892    ELSE 
     893      k_beg = key_tab(pos)%keymemstart 
     894      k_end = k_beg+key_tab(pos)%keymemlen-1 
    957895      SELECT CASE (k_typ) 
    958896      CASE(k_i) 
    959         i_val(1:size_of_in) = & 
    960  &        i_mem(keymemstart(pos):keymemstart(pos)+keymemlen(pos)-1) 
     897        i_val(1:size_of_in) = i_mem(k_beg:k_end) 
    961898      CASE(k_r) 
    962         r_val(1:size_of_in) = & 
    963  &        r_mem(keymemstart(pos):keymemstart(pos)+keymemlen(pos)-1) 
     899        r_val(1:size_of_in) = r_mem(k_beg:k_end) 
    964900      CASE(k_c) 
    965         c_val(1:size_of_in) = & 
    966  &        c_mem(keymemstart(pos):keymemstart(pos)+keymemlen(pos)-1) 
     901        c_val(1:size_of_in) = c_mem(k_beg:k_end) 
    967902      CASE(k_l) 
    968         l_val(1:size_of_in) = & 
    969  &        l_mem(keymemstart(pos):keymemstart(pos)+keymemlen(pos)-1) 
     903        l_val(1:size_of_in) = l_mem(k_beg:k_end) 
    970904      END SELECT 
    971905    ENDIF 
     
    975909!=== 
    976910SUBROUTINE get_wdb & 
    977  &  (target,target_sig,status,fileorig,size_of_in, & 
     911 &  (target,status,fileorig,size_of_in, & 
    978912 &   i_val,r_val,c_val,l_val) 
    979913!--------------------------------------------------------------------- 
     
    983917!- 
    984918  CHARACTER(LEN=*) :: target 
    985   INTEGER :: target_sig,status,fileorig,size_of_in 
     919  INTEGER :: status,fileorig,size_of_in 
    986920  INTEGER,DIMENSION(:),OPTIONAL          :: i_val 
    987921  REAL,DIMENSION(:),OPTIONAL             :: r_val 
     
    991925  INTEGER :: k_typ 
    992926  CHARACTER(LEN=9) :: c_vtyp 
    993   INTEGER :: k_mempos,k_memsize,k_len 
     927  INTEGER :: k_mempos,k_memsize,k_beg,k_end 
    994928  LOGICAL :: l_cmp 
    995929!--------------------------------------------------------------------- 
     
    1027961! Fill out the items of the data base 
    1028962  nb_keys = nb_keys+1 
    1029   keysig(nb_keys) = target_sig 
    1030   keystr(nb_keys) = target(1:MIN(LEN_TRIM(target),l_n)) 
    1031   keystatus(nb_keys) = status 
    1032   keytype(nb_keys) = k_typ 
    1033   keyfromfile(nb_keys) = fileorig 
    1034   keymemstart(nb_keys) = k_mempos+1 
     963  key_tab(nb_keys)%keystr = target(1:MIN(LEN_TRIM(target),l_n)) 
     964  key_tab(nb_keys)%keystatus = status 
     965  key_tab(nb_keys)%keytype = k_typ 
     966  key_tab(nb_keys)%keyfromfile = fileorig 
     967  key_tab(nb_keys)%keymemstart = k_mempos+1 
    1035968  IF (l_cmp) THEN 
    1036     keycompress(nb_keys) = size_of_in 
    1037     keymemlen(nb_keys) = 1 
     969    key_tab(nb_keys)%keycompress = size_of_in 
     970    key_tab(nb_keys)%keymemlen = 1 
    1038971  ELSE 
    1039     keycompress(nb_keys) = -1 
    1040     keymemlen(nb_keys) = size_of_in 
     972    key_tab(nb_keys)%keycompress = -1 
     973    key_tab(nb_keys)%keymemlen = size_of_in 
    1041974  ENDIF 
    1042975!- 
    1043976! Before writing the actual size lets see if we have the space 
    1044   IF (keymemstart(nb_keys)+keymemlen(nb_keys) > k_memsize) THEN 
    1045     CALL getin_allocmem (k_typ,keymemlen(nb_keys)) 
    1046   ENDIF 
    1047 !- 
    1048   k_len = keymemstart(nb_keys)+keymemlen(nb_keys)-1 
     977  IF (key_tab(nb_keys)%keymemstart+key_tab(nb_keys)%keymemlen & 
     978 &    > k_memsize) THEN 
     979    CALL getin_allocmem (k_typ,key_tab(nb_keys)%keymemlen) 
     980  ENDIF 
     981!- 
     982  k_beg = key_tab(nb_keys)%keymemstart 
     983  k_end = k_beg+key_tab(nb_keys)%keymemlen-1 
    1049984  SELECT CASE (k_typ) 
    1050985  CASE(k_i) 
    1051     i_mem(keymemstart(nb_keys):k_len) = i_val(1:keymemlen(nb_keys)) 
    1052     i_mempos = k_len 
     986    i_mem(k_beg:k_end) = i_val(1:key_tab(nb_keys)%keymemlen) 
     987    i_mempos = k_end 
    1053988  CASE(k_r) 
    1054     r_mem(keymemstart(nb_keys):k_len) = r_val(1:keymemlen(nb_keys)) 
    1055     r_mempos = k_len 
     989    r_mem(k_beg:k_end) = r_val(1:key_tab(nb_keys)%keymemlen) 
     990    r_mempos = k_end 
    1056991  CASE(k_c) 
    1057     c_mem(keymemstart(nb_keys):k_len) = c_val(1:keymemlen(nb_keys)) 
    1058     c_mempos = k_len 
     992    c_mem(k_beg:k_end) = c_val(1:key_tab(nb_keys)%keymemlen) 
     993    c_mempos = k_end 
    1059994  CASE(k_l) 
    1060     l_mem(keymemstart(nb_keys):k_len) = l_val(1:keymemlen(nb_keys)) 
    1061     l_mempos = k_len 
     995    l_mem(k_beg:k_end) = l_val(1:key_tab(nb_keys)%keymemlen) 
     996    l_mempos = k_end 
    1062997  END SELECT 
    1063998!--------------------- 
     
    11901125          targetlist(nb_lines) = & 
    11911126 &         last_key(1:MIN(LEN_TRIM(last_key),l_n-n_d_fmt-2))//'__'//cnt 
    1192           CALL gensig (targetlist(nb_lines),targetsiglist(nb_lines)) 
    11931127          key_str = last_key(1:LEN_TRIM(last_key)) 
    11941128        ENDIF 
     
    13401274      ENDIF 
    13411275!----- 
    1342       CALL gensig (targetlist(nb_lines),targetsiglist(nb_lines)) 
    13431276      fichier(nb_lines) = NEW_str(1:len_str) 
    13441277      fromfile(nb_lines) = current 
     
    13691302 &       key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt 
    13701303        targetlist(nb_lines) = new_key(1:MIN(LEN_TRIM(new_key),l_n)) 
    1371         CALL gensig (targetlist(nb_lines),targetsiglist(nb_lines)) 
    13721304        fromfile(nb_lines) = current 
    13731305!- 
     
    13931325 &      key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt 
    13941326      targetlist(nb_lines) = new_key(1:MIN(LEN_TRIM(new_key),l_n)) 
    1395       CALL gensig (targetlist(nb_lines),targetsiglist(nb_lines)) 
    13961327      fromfile(nb_lines) = current 
    13971328!- 
     
    14141345  IMPLICIT NONE 
    14151346!- 
    1416   INTEGER :: line,found 
     1347  INTEGER :: line,n_k,k 
    14171348!--------------------------------------------------------------------- 
    14181349  DO line=1,nb_lines-1 
    14191350!- 
    1420     CALL find_sig & 
    1421  &    (nb_lines-line,targetlist(line+1:nb_lines),targetlist(line), & 
    1422  &     targetsiglist(line+1:nb_lines),targetsiglist(line),found) 
     1351    n_k = 0 
     1352    DO k=line+1,nb_lines 
     1353      IF (TRIM(targetlist(line)) == TRIM(targetlist(k))) THEN 
     1354        n_k = k 
     1355        EXIT 
     1356      ENDIF 
     1357    ENDDO 
    14231358!--- 
    14241359!-- IF we have found it we have a problem to solve. 
    14251360!--- 
    1426     IF (found > 0) THEN 
    1427       WRITE(*,*) 'COUNT : ', & 
    1428  &  COUNT(ABS(targetsiglist(line+1:nb_lines)-targetsiglist(line)) < 1) 
    1429 !----- 
     1361    IF (n_k > 0) THEN 
     1362      WRITE(*,*) 'COUNT : ',n_k 
    14301363      WRITE(*,*) & 
    1431  & 'getin_checkcohe : Found a problem on key ',TRIM(targetlist(line)) 
     1364 &  'getin_checkcohe : Found a problem on key ',TRIM(targetlist(line)) 
    14321365      WRITE(*,*) & 
    1433  & 'getin_checkcohe : The following values were encoutered :' 
     1366 &  'getin_checkcohe : The following values were encoutered :' 
    14341367      WRITE(*,*) & 
    1435  & '                ',TRIM(targetlist(line)), & 
    1436  &               targetsiglist(line),' == ',fichier(line) 
     1368 &  '                ',TRIM(targetlist(line)),' == ',fichier(line) 
    14371369      WRITE(*,*) & 
    1438  & '                ',TRIM(targetlist(line+found)), & 
    1439  &               targetsiglist(line+found),' == ',fichier(line+found) 
     1370 &  '                ',TRIM(targetlist(k)),' == ',fichier(k) 
    14401371      WRITE(*,*) & 
    1441  & 'getin_checkcohe : We will keep only the last value' 
    1442 !----- 
    1443       targetsiglist(line) = 1 
     1372 &  'getin_checkcohe : We will keep only the last value' 
     1373      targetlist(line) = ' ' 
    14441374    ENDIF 
    14451375  ENDDO 
     
    14881418  IMPLICIT NONE 
    14891419!- 
     1420  TYPE(t_key),ALLOCATABLE,DIMENSION(:) :: tmp_key_tab 
    14901421  INTEGER,ALLOCATABLE :: tmp_int(:) 
    14911422  CHARACTER(LEN=100),ALLOCATABLE :: tmp_str(:) 
     
    14941425  CHARACTER(LEN=20) :: c_tmp 
    14951426!--------------------------------------------------------------------- 
    1496 !- 
    1497 ! Either nothing exists in these arrays and it is easy to do 
    1498 !- 
    14991427  IF (keymemsize == 0) THEN 
    15001428!--- 
     1429!-- Nothing exists in memory arrays and it is easy to do. 
     1430!--- 
    15011431    WRITE (UNIT=c_tmp,FMT=*) memslabs 
    1502 !--- 
    1503     ALLOCATE(keysig(memslabs),stat=ier) 
     1432    ALLOCATE(key_tab(memslabs),stat=ier) 
    15041433    IF (ier /= 0) THEN 
    15051434      CALL ipslerr (3,'getin_allockeys', & 
    1506  &     'Can not allocate keysig', & 
     1435 &     'Can not allocate key_tab', & 
    15071436 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    15081437    ENDIF 
    1509 !--- 
    1510     ALLOCATE(keystr(memslabs),stat=ier) 
     1438    nb_keys = 0 
     1439    keymemsize = memslabs 
     1440    key_tab(:)%keycompress = -1 
     1441!--- 
     1442  ELSE 
     1443!--- 
     1444!-- There is something already in the memory, 
     1445!-- we need to transfer and reallocate. 
     1446!--- 
     1447    WRITE (UNIT=c_tmp,FMT=*) keymemsize 
     1448    ALLOCATE(tmp_key_tab(keymemsize),stat=ier) 
    15111449    IF (ier /= 0) THEN 
    15121450      CALL ipslerr (3,'getin_allockeys', & 
    1513  &     'Can not allocate keystr', & 
     1451 &     'Can not allocate tmp_key_tab', & 
    15141452 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    15151453    ENDIF 
    1516 !--- 
    1517     ALLOCATE(keystatus(memslabs),stat=ier) 
     1454    WRITE (UNIT=c_tmp,FMT=*) keymemsize+memslabs 
     1455    tmp_key_tab(1:keymemsize) = key_tab(1:keymemsize) 
     1456    DEALLOCATE(key_tab) 
     1457    ALLOCATE(key_tab(keymemsize+memslabs),stat=ier) 
    15181458    IF (ier /= 0) THEN 
    15191459      CALL ipslerr (3,'getin_allockeys', & 
    1520  &     'Can not allocate keystatus', & 
     1460 &     'Can not allocate key_tab', & 
    15211461 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    15221462    ENDIF 
    1523 !--- 
    1524     ALLOCATE(keytype(memslabs),stat=ier) 
    1525     IF (ier /= 0) THEN 
    1526       CALL ipslerr (3,'getin_allockeys', & 
    1527  &     'Can not allocate keytype', & 
    1528  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1529     ENDIF 
    1530 !--- 
    1531     ALLOCATE(keycompress(memslabs),stat=ier) 
    1532     IF (ier /= 0) THEN 
    1533       CALL ipslerr (3,'getin_allockeys', & 
    1534  &     'Can not allocate keycompress', & 
    1535  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1536     ENDIF 
    1537 !--- 
    1538     ALLOCATE(keyfromfile(memslabs),stat=ier) 
    1539     IF (ier /= 0) THEN 
    1540       CALL ipslerr (3,'getin_allockeys', & 
    1541  &     'Can not allocate keyfromfile', & 
    1542  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1543     ENDIF 
    1544 !--- 
    1545     ALLOCATE(keymemstart(memslabs),stat=ier) 
    1546     IF (ier /= 0) THEN 
    1547       CALL ipslerr (3,'getin_allockeys', & 
    1548  &     'Can not allocate keymemstart', & 
    1549  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1550     ENDIF 
    1551 !--- 
    1552     ALLOCATE(keymemlen(memslabs),stat=ier) 
    1553     IF (ier /= 0) THEN 
    1554       CALL ipslerr (3,'getin_allockeys', & 
    1555  &     'Can not allocate keymemlen', & 
    1556  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1557     ENDIF 
    1558 !--- 
    1559     nb_keys = 0 
    1560     keymemsize = memslabs 
    1561     keycompress(:) = -1 
    1562 !--- 
    1563   ELSE 
    1564 !--- 
    1565 !-- There is something already in the memory, 
    1566 !-- we need to transfer and reallocate. 
    1567 !--- 
    1568     WRITE (UNIT=c_tmp,FMT=*) keymemsize 
    1569 !--- 
    1570     ALLOCATE(tmp_str(keymemsize),stat=ier) 
    1571     IF (ier /= 0) THEN 
    1572       CALL ipslerr (3,'getin_allockeys', & 
    1573  &     'Can not allocate tmp_str', & 
    1574  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1575     ENDIF 
    1576 !--- 
    1577     ALLOCATE(tmp_int(keymemsize),stat=ier) 
    1578     IF (ier /= 0) THEN 
    1579       CALL ipslerr (3,'getin_allockeys', & 
    1580  &     'Can not allocate tmp_int', & 
    1581  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1582     ENDIF 
    1583 !--- 
    1584     WRITE (UNIT=c_tmp,FMT=*) keymemsize+memslabs 
    1585 !--- 
    1586     tmp_int(1:keymemsize) = keysig(1:keymemsize) 
    1587     DEALLOCATE(keysig) 
    1588     ALLOCATE(keysig(keymemsize+memslabs),stat=ier) 
    1589     IF (ier /= 0) THEN 
    1590       CALL ipslerr (3,'getin_allockeys', & 
    1591  &     'Can not allocate keysig', & 
    1592  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1593     ENDIF 
    1594     keysig(1:keymemsize) = tmp_int(1:keymemsize) 
    1595 !--- 
    1596     tmp_str(1:keymemsize) = keystr(1:keymemsize) 
    1597     DEALLOCATE(keystr) 
    1598     ALLOCATE(keystr(keymemsize+memslabs),stat=ier) 
    1599     IF (ier /= 0) THEN 
    1600       CALL ipslerr (3,'getin_allockeys', & 
    1601  &     'Can not allocate keystr', & 
    1602  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1603     ENDIF 
    1604     keystr(1:keymemsize) = tmp_str(1:keymemsize) 
    1605 !--- 
    1606     tmp_int(1:keymemsize) = keystatus(1:keymemsize) 
    1607     DEALLOCATE(keystatus) 
    1608     ALLOCATE(keystatus(keymemsize+memslabs),stat=ier) 
    1609     IF (ier /= 0) THEN 
    1610       CALL ipslerr (3,'getin_allockeys', & 
    1611  &     'Can not allocate keystatus', & 
    1612  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1613     ENDIF 
    1614     keystatus(1:keymemsize) = tmp_int(1:keymemsize) 
    1615 !--- 
    1616     tmp_int(1:keymemsize) = keytype(1:keymemsize) 
    1617     DEALLOCATE(keytype) 
    1618     ALLOCATE(keytype(keymemsize+memslabs),stat=ier) 
    1619     IF (ier /= 0) THEN 
    1620       CALL ipslerr (3,'getin_allockeys', & 
    1621  &     'Can not allocate keytype', & 
    1622  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1623     ENDIF 
    1624     keytype(1:keymemsize) = tmp_int(1:keymemsize) 
    1625 !--- 
    1626     tmp_int(1:keymemsize) = keycompress(1:keymemsize) 
    1627     DEALLOCATE(keycompress) 
    1628     ALLOCATE(keycompress(keymemsize+memslabs),stat=ier) 
    1629     IF (ier /= 0) THEN 
    1630       CALL ipslerr (3,'getin_allockeys', & 
    1631  &     'Can not allocate keycompress', & 
    1632  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1633     ENDIF 
    1634     keycompress(:) = -1 
    1635     keycompress(1:keymemsize) = tmp_int(1:keymemsize) 
    1636 !--- 
    1637     tmp_int(1:keymemsize) = keyfromfile(1:keymemsize) 
    1638     DEALLOCATE(keyfromfile) 
    1639     ALLOCATE(keyfromfile(keymemsize+memslabs),stat=ier) 
    1640     IF (ier /= 0) THEN 
    1641       CALL ipslerr (3,'getin_allockeys', & 
    1642  &     'Can not allocate keyfromfile', & 
    1643  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1644     ENDIF 
    1645     keyfromfile(1:keymemsize) = tmp_int(1:keymemsize) 
    1646 !--- 
    1647     tmp_int(1:keymemsize) = keymemstart(1:keymemsize) 
    1648     DEALLOCATE(keymemstart) 
    1649     ALLOCATE(keymemstart(keymemsize+memslabs),stat=ier) 
    1650     IF (ier /= 0) THEN 
    1651       CALL ipslerr (3,'getin_allockeys', & 
    1652  &     'Can not allocate keymemstart', & 
    1653  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1654     ENDIF 
    1655     keymemstart(1:keymemsize) = tmp_int(1:keymemsize) 
    1656 !--- 
    1657     tmp_int(1:keymemsize) = keymemlen(1:keymemsize) 
    1658     DEALLOCATE(keymemlen) 
    1659     ALLOCATE(keymemlen(keymemsize+memslabs),stat=ier) 
    1660     IF (ier /= 0) THEN 
    1661       CALL ipslerr (3,'getin_allockeys', & 
    1662  &     'Can not allocate keymemlen', & 
    1663  &     'to size '//TRIM(ADJUSTL(c_tmp)),' ') 
    1664     ENDIF 
    1665     keymemlen(1:keymemsize) = tmp_int(1:keymemsize) 
    1666 !--- 
     1463    key_tab(:)%keycompress = -1 
     1464    key_tab(1:keymemsize) = tmp_key_tab(1:keymemsize) 
     1465    DEALLOCATE(tmp_key_tab) 
    16671466    keymemsize = keymemsize+memslabs 
    1668 !--- 
    1669     DEALLOCATE(tmp_int) 
    1670     DEALLOCATE(tmp_str) 
    16711467  ENDIF 
    16721468!----------------------------- 
     
    16781474!--------------------------------------------------------------------- 
    16791475!- Allocate the memory of the data base for all 4 types of memory 
    1680 !- INTEGER / REAL / CHAR / LOGICAL 
     1476!- INTEGER / REAL / CHARACTER / LOGICAL 
    16811477!--------------------------------------------------------------------- 
    16821478  IMPLICIT NONE 
     
    16851481!- 
    16861482  INTEGER,ALLOCATABLE :: tmp_int(:) 
     1483  REAL,ALLOCATABLE :: tmp_real(:) 
    16871484  CHARACTER(LEN=100),ALLOCATABLE :: tmp_char(:) 
    1688   REAL,ALLOCATABLE :: tmp_real(:) 
    16891485  LOGICAL,ALLOCATABLE :: tmp_logic(:) 
    16901486  INTEGER :: ier 
     
    18251621!- 
    18261622SUBROUTINE getin_dump (fileprefix) 
    1827 !--------------------------------------------------------------------- 
    1828 !- This subroutine will dump the content of the database into  file 
    1829 !- which has the same format as the run.def. The idea is that the user 
    1830 !- can see which parameters were used and re-use the file for another 
    1831 !- run. 
    1832 !- 
    1833 !- The argument file allows the user to change the name of the file 
    1834 !- in which the data will be archived 
    18351623!--------------------------------------------------------------------- 
    18361624  IMPLICIT NONE 
     
    18751663!----- 
    18761664!---- Is this key from this file ? 
    1877       IF (keyfromfile(ikey) == if) THEN 
     1665      IF (key_tab(ikey)%keyfromfile == if) THEN 
    18781666!------- 
    18791667!------ Write some comments 
    18801668        WRITE(22,*) '#' 
    1881         SELECT CASE (keystatus(ikey)) 
     1669        SELECT CASE (key_tab(ikey)%keystatus) 
    18821670        CASE(1) 
    18831671          WRITE(22,*) '# Values of ', & 
    1884  &          TRIM(keystr(ikey)),' comes from the run.def.' 
     1672 &          TRIM(key_tab(ikey)%keystr),' comes from the run.def.' 
    18851673        CASE(2) 
    18861674          WRITE(22,*) '# Values of ', & 
    1887  &          TRIM(keystr(ikey)),' are all defaults.' 
     1675 &          TRIM(key_tab(ikey)%keystr),' are all defaults.' 
    18881676        CASE(3) 
    18891677          WRITE(22,*) '# Values of ', & 
    1890  &          TRIM(keystr(ikey)),' are a mix of run.def and defaults.' 
     1678 &          TRIM(key_tab(ikey)%keystr), & 
     1679 &          ' are a mix of run.def and defaults.' 
    18911680        CASE DEFAULT 
    18921681          WRITE(22,*) '# Dont know from where the value of ', & 
    1893  &          TRIM(keystr(ikey)),' comes.' 
     1682 &          TRIM(key_tab(ikey)%keystr),' comes.' 
    18941683        END SELECT 
    18951684        WRITE(22,*) '#' 
    18961685!------- 
    18971686!------ Write the values 
    1898         SELECT CASE (keytype(ikey)) 
     1687        SELECT CASE (key_tab(ikey)%keytype) 
    18991688        CASE(k_i) 
    1900           IF (keymemlen(ikey) == 1) THEN 
    1901             IF (keycompress(ikey) < 0) THEN 
     1689          IF (key_tab(ikey)%keymemlen == 1) THEN 
     1690            IF (key_tab(ikey)%keycompress < 0) THEN 
    19021691              WRITE(22,*) & 
    1903  &              TRIM(keystr(ikey)),' = ',i_mem(keymemstart(ikey)) 
     1692 &              TRIM(key_tab(ikey)%keystr), & 
     1693 &              ' = ',i_mem(key_tab(ikey)%keymemstart) 
    19041694            ELSE 
    19051695              WRITE(22,*) & 
    1906  &              TRIM(keystr(ikey)),' = ',keycompress(ikey), & 
    1907  &              ' * ',i_mem(keymemstart(ikey)) 
     1696 &              TRIM(key_tab(ikey)%keystr), & 
     1697 &              ' = ',key_tab(ikey)%keycompress, & 
     1698 &              ' * ',i_mem(key_tab(ikey)%keymemstart) 
    19081699            ENDIF 
    19091700          ELSE 
    1910             DO iv=0,keymemlen(ikey)-1 
     1701            DO iv=0,key_tab(ikey)%keymemlen-1 
    19111702              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1 
    19121703              WRITE(22,*) & 
    1913  &              TRIM(keystr(ikey)),'__',TRIM(ADJUSTL(c_tmp)), & 
    1914  &              ' = ',i_mem(keymemstart(ikey)+iv) 
     1704 &              TRIM(key_tab(ikey)%keystr), & 
     1705 &              '__',TRIM(ADJUSTL(c_tmp)), & 
     1706 &              ' = ',i_mem(key_tab(ikey)%keymemstart+iv) 
    19151707            ENDDO 
    19161708          ENDIF 
    19171709        CASE(k_r) 
    1918           IF (keymemlen(ikey) == 1) THEN 
    1919             IF (keycompress(ikey) < 0) THEN 
     1710          IF (key_tab(ikey)%keymemlen == 1) THEN 
     1711            IF (key_tab(ikey)%keycompress < 0) THEN 
    19201712              WRITE(22,*) & 
    1921  &              TRIM(keystr(ikey)),' = ',r_mem(keymemstart(ikey)) 
     1713 &              TRIM(key_tab(ikey)%keystr), & 
     1714 &              ' = ',r_mem(key_tab(ikey)%keymemstart) 
    19221715            ELSE 
    19231716              WRITE(22,*) & 
    1924  &              TRIM(keystr(ikey)),' = ',keycompress(ikey),& 
    1925                    & ' * ',r_mem(keymemstart(ikey)) 
     1717 &              TRIM(key_tab(ikey)%keystr), & 
     1718 &              ' = ',key_tab(ikey)%keycompress, & 
     1719                   & ' * ',r_mem(key_tab(ikey)%keymemstart) 
    19261720            ENDIF 
    19271721          ELSE 
    1928             DO iv=0,keymemlen(ikey)-1 
     1722            DO iv=0,key_tab(ikey)%keymemlen-1 
    19291723              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1 
    19301724              WRITE(22,*) & 
    1931  &              TRIM(keystr(ikey)),'__',TRIM(ADJUSTL(c_tmp)), & 
    1932  &              ' = ',r_mem(keymemstart(ikey)+iv) 
     1725 &              TRIM(key_tab(ikey)%keystr),'__',TRIM(ADJUSTL(c_tmp)), & 
     1726 &              ' = ',r_mem(key_tab(ikey)%keymemstart+iv) 
    19331727            ENDDO 
    19341728          ENDIF 
    19351729        CASE(k_c) 
    1936           IF (keymemlen(ikey) == 1) THEN 
    1937             tmp_str = c_mem(keymemstart(ikey)) 
    1938             WRITE(22,*) TRIM(keystr(ikey)),' = ',TRIM(tmp_str) 
     1730          IF (key_tab(ikey)%keymemlen == 1) THEN 
     1731            tmp_str = c_mem(key_tab(ikey)%keymemstart) 
     1732            WRITE(22,*) TRIM(key_tab(ikey)%keystr), & 
     1733 &              ' = ',TRIM(tmp_str) 
    19391734          ELSE 
    1940             DO iv=0,keymemlen(ikey)-1 
     1735            DO iv=0,key_tab(ikey)%keymemlen-1 
    19411736              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1 
    1942               tmp_str = c_mem(keymemstart(ikey)+iv) 
     1737              tmp_str = c_mem(key_tab(ikey)%keymemstart+iv) 
    19431738              WRITE(22,*) & 
    1944  &              TRIM(keystr(ikey)),'__',TRIM(ADJUSTL(c_tmp)), & 
     1739 &              TRIM(key_tab(ikey)%keystr), & 
     1740 &              '__',TRIM(ADJUSTL(c_tmp)), & 
    19451741 &              ' = ',TRIM(tmp_str) 
    19461742            ENDDO 
    19471743          ENDIF 
    19481744        CASE(k_l) 
    1949           IF (keymemlen(ikey) == 1) THEN 
    1950             IF (l_mem(keymemstart(ikey))) THEN 
    1951               WRITE(22,*) TRIM(keystr(ikey)),' = TRUE ' 
     1745          IF (key_tab(ikey)%keymemlen == 1) THEN 
     1746            IF (l_mem(key_tab(ikey)%keymemstart)) THEN 
     1747              WRITE(22,*) TRIM(key_tab(ikey)%keystr),' = TRUE ' 
    19521748            ELSE 
    1953               WRITE(22,*) TRIM(keystr(ikey)),' = FALSE ' 
     1749              WRITE(22,*) TRIM(key_tab(ikey)%keystr),' = FALSE ' 
    19541750            ENDIF 
    19551751          ELSE 
    1956             DO iv=0,keymemlen(ikey)-1 
     1752            DO iv=0,key_tab(ikey)%keymemlen-1 
    19571753              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1 
    1958               IF (l_mem(keymemstart(ikey)+iv)) THEN 
    1959                 WRITE(22,*) TRIM(keystr(ikey)),'__', & 
     1754              IF (l_mem(key_tab(ikey)%keymemstart+iv)) THEN 
     1755                WRITE(22,*) TRIM(key_tab(ikey)%keystr),'__', & 
    19601756 &                          TRIM(ADJUSTL(c_tmp)),' = TRUE ' 
    19611757              ELSE 
    1962                 WRITE(22,*) TRIM(keystr(ikey)),'__', & 
     1758                WRITE(22,*) TRIM(key_tab(ikey)%keystr),'__', & 
    19631759 &                          TRIM(ADJUSTL(c_tmp)),' = FALSE ' 
    19641760              ENDIF 
     
    19671763        CASE DEFAULT 
    19681764          CALL ipslerr (3,'getin_dump', & 
    1969  &         'Unknown type for variable '//TRIM(keystr(ikey)),' ',' ') 
     1765 &         'Unknown type for variable '//TRIM(key_tab(ikey)%keystr), & 
     1766 &         ' ',' ') 
    19701767        END SELECT 
    19711768      ENDIF 
     
    20141811END SUBROUTINE get_qtyp 
    20151812!=== 
     1813SUBROUTINE get_findkey (i_tab,c_key,pos) 
     1814!--------------------------------------------------------------------- 
     1815!- This subroutine looks for a key in a table 
     1816!--------------------------------------------------------------------- 
     1817!- INPUT 
     1818!-   i_tab  : 1 -> search in key_tab(1:nb_keys)%keystr 
     1819!-            2 -> search in targetlist(1:nb_lines) 
     1820!-   c_key  : Name of the key we are looking for 
     1821!- OUTPUT 
     1822!-   pos    : -1 if key not found, else value in the table 
     1823!--------------------------------------------------------------------- 
     1824  IMPLICIT NONE 
     1825!- 
     1826  INTEGER,INTENT(in) :: i_tab 
     1827  CHARACTER(LEN=*),INTENT(in) :: c_key 
     1828  INTEGER,INTENT(out) :: pos 
     1829!- 
     1830  INTEGER :: ikey_max,ikey 
     1831  CHARACTER(LEN=l_n) :: c_q_key 
     1832!--------------------------------------------------------------------- 
     1833  pos = -1 
     1834  IF     (i_tab == 1) THEN 
     1835    ikey_max = nb_keys 
     1836  ELSEIF (i_tab == 2) THEN 
     1837    ikey_max = nb_lines 
     1838  ELSE 
     1839    ikey_max = 0 
     1840  ENDIF 
     1841  IF ( ikey_max > 0 ) THEN 
     1842    DO ikey=1,ikey_max 
     1843      IF (i_tab == 1) THEN 
     1844        c_q_key = key_tab(ikey)%keystr 
     1845      ELSE 
     1846        c_q_key = targetlist(ikey) 
     1847      ENDIF 
     1848      IF (TRIM(c_q_key) == TRIM(c_key)) THEN 
     1849        pos = ikey 
     1850        EXIT 
     1851      ENDIF 
     1852    ENDDO 
     1853  ENDIF 
     1854!------------------------- 
     1855END SUBROUTINE get_findkey 
     1856!=== 
    20161857!------------------ 
    20171858END MODULE getincom 
Note: See TracChangeset for help on using the changeset viewer.