source: IOIPSL/trunk/src/getincom.f90 @ 1517

Last change on this file since 1517 was 1378, checked in by mmaipsl, 13 years ago

Enhancement : use ipslout number from errioipsl to redirect all prints of IOIPSL
in the local process when use with parallelization.
This variable ipslout can be modified with ipslnlf function of errioipsl module.

  • Property svn:keywords set to Id
File size: 63.7 KB
RevLine 
[386]1MODULE getincom
2!-
[11]3!$Id$
[4]4!-
[386]5! This software is governed by the CeCILL license
6! See IOIPSL/IOIPSL_License_CeCILL.txt
[4]7!---------------------------------------------------------------------
[1378]8USE errioipsl, ONLY : ipslerr,ipsldbg,ipslout
[11]9USE stringop, &
[125]10 &   ONLY : nocomma,cmpblank,strlowercase
[4]11!-
[11]12IMPLICIT NONE
[4]13!-
[11]14PRIVATE
[963]15PUBLIC :: getin_name, getin, getin_dump
[4]16!-
[963]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!-
30!-
[11]31INTERFACE getin
[125]32!!--------------------------------------------------------------------
33!! The "getin" routines get a variable.
34!! We first check if we find it in the database
[963]35!! and if not we get it from the definition file.
[125]36!!
[1313]37!! SUBROUTINE getin (targetname,ret_val)
[125]38!!
39!! INPUT
40!!
[1313]41!! (C) targetname : Name of the variable
[125]42!!
43!! OUTPUT
44!!
45!! (I/R/C/L) ret_val : scalar, vector or matrix that will contain
46!!                     that will contain the (standard)
47!!                     integer/real/character/logical values
48!!--------------------------------------------------------------------
[11]49  MODULE PROCEDURE getinrs, getinr1d, getinr2d, &
50 &                 getinis, getini1d, getini2d, &
51 &                 getincs, getinc1d, getinc2d, &
52 &                 getinls, getinl1d, getinl2d
53END INTERFACE
[4]54!-
[125]55!!--------------------------------------------------------------------
56!! The "getin_dump" routine will dump the content of the database
[963]57!! into a file which has the same format as the definition file.
[125]58!! The idea is that the user can see which parameters were used
59!! and re-use the file for another run.
60!!
61!!  SUBROUTINE getin_dump (fileprefix)
62!!
63!! OPTIONAL INPUT argument
64!!
65!! (C) fileprefix : allows the user to change the name of the file
66!!                  in which the data will be archived
67!!--------------------------------------------------------------------
68!-
[4]69  INTEGER,PARAMETER :: max_files=100
70  CHARACTER(LEN=100),DIMENSION(max_files),SAVE :: filelist
71  INTEGER,SAVE      :: nbfiles
72!-
[963]73  INTEGER,SAVE :: allread=0
74  CHARACTER(LEN=100),SAVE :: def_file = 'run.def'
75!-
[536]76  INTEGER,PARAMETER :: i_txtslab=1000,l_n=30
77  INTEGER,SAVE :: nb_lines,i_txtsize=0
78  CHARACTER(LEN=100),SAVE,ALLOCATABLE,DIMENSION(:) :: fichier
79  CHARACTER(LEN=l_n),SAVE,ALLOCATABLE,DIMENSION(:) :: targetlist
80  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: fromfile,compline
[4]81!-
[11]82  INTEGER,PARAMETER :: n_d_fmt=5,max_msgs=15
83  CHARACTER(LEN=6),SAVE :: c_i_fmt = '(I5.5)'
84!-
[4]85! The data base of parameters
86!-
87  INTEGER,PARAMETER :: memslabs=200
[11]88  INTEGER,PARAMETER :: compress_lim=20
[4]89!-
90  INTEGER,SAVE :: nb_keys=0
91  INTEGER,SAVE :: keymemsize=0
92!-
[125]93! keystr definition
94! name of a key
95!-
[4]96! keystatus definition
[963]97! keystatus = 1 : Value comes from the file defined by 'def_file'
[4]98! keystatus = 2 : Default value is used
99! keystatus = 3 : Some vector elements were taken from default
[1313]100  INTEGER,PARAMETER :: nondefault=1, default=2, vectornondefault=3
[4]101!-
102! keytype definition
[11]103! keytype = 1 : Integer
[4]104! keytype = 2 : Real
105! keytype = 3 : Character
106! keytype = 4 : Logical
107!-
[11]108  INTEGER,PARAMETER :: k_i=1, k_r=2, k_c=3, k_l=4
109!-
[4]110! Allow compression for keys (only for integer and real)
[125]111! keycompress < 0 : not compressed
[4]112! keycompress > 0 : number of repeat of the value
113!-
[125]114TYPE :: t_key
115  CHARACTER(LEN=l_n) :: keystr
116  INTEGER :: keystatus, keytype, keycompress, &
117 &           keyfromfile, keymemstart, keymemlen
118END TYPE t_key
[4]119!-
[125]120  TYPE(t_key),SAVE,ALLOCATABLE,DIMENSION(:) :: key_tab
[4]121!-
[536]122  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: i_mem
123  INTEGER,SAVE :: i_memsize=0, i_mempos=0
124  REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: r_mem
125  INTEGER,SAVE :: r_memsize=0, r_mempos=0
126  CHARACTER(LEN=100),SAVE,ALLOCATABLE,DIMENSION(:) :: c_mem
127  INTEGER,SAVE :: c_memsize=0, c_mempos=0
128  LOGICAL,SAVE,ALLOCATABLE,DIMENSION(:) :: l_mem
129  INTEGER,SAVE :: l_memsize=0, l_mempos=0
[4]130!-
131CONTAINS
132!-
[963]133!=== DEFINITION FILE NAME INTERFACE
134!-
135SUBROUTINE getin_name (cname)
136!---------------------------------------------------------------------
137  IMPLICIT NONE
138!-
139  CHARACTER(LEN=*) :: cname
140!---------------------------------------------------------------------
141  IF (allread == 0) THEN
142    def_file = ADJUSTL(cname)
143  ELSE
144    CALL ipslerr (3,'getin_name', &
145 &   'The name of the database file (any_name.def)', &
146 &   'must be changed *before* any attempt','to read the database.')
147  ENDIF
148!------------------------
149END SUBROUTINE getin_name
150!-
[11]151!=== INTEGER INTERFACE
[4]152!-
[1313]153SUBROUTINE getinis (targetname,ret_val)
[4]154!---------------------------------------------------------------------
155  IMPLICIT NONE
156!-
[1313]157  CHARACTER(LEN=*) :: targetname
[11]158  INTEGER :: ret_val
[4]159!-
[11]160  INTEGER,DIMENSION(1) :: tmp_ret_val
[1313]161  INTEGER :: pos,status=0,fileorig, size_of_in
[4]162!---------------------------------------------------------------------
163!-
[1313]164! Do we have this targetname in our database ?
[4]165!-
[1313]166  CALL get_findkey (1,targetname,pos)
[4]167!-
168  tmp_ret_val(1) = ret_val
[1313]169  size_of_in = SIZE(tmp_ret_val)
170 
[4]171!-
172  IF (pos < 0) THEN
173!-- Get the information out of the file
[1313]174    CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val)
[4]175!-- Put the data into the database
[11]176    CALL get_wdb &
[1313]177 &   (targetname,status,fileorig,1,i_val=tmp_ret_val)
[4]178  ELSE
179!-- Get the value out of the database
[1313]180    CALL get_rdb (pos,1,targetname,i_val=tmp_ret_val)
[4]181  ENDIF
182  ret_val = tmp_ret_val(1)
183!---------------------
[11]184END SUBROUTINE getinis
[4]185!===
[1313]186SUBROUTINE getini1d (targetname,ret_val)
[4]187!---------------------------------------------------------------------
188  IMPLICIT NONE
189!-
[1313]190  CHARACTER(LEN=*) :: targetname
[11]191  INTEGER,DIMENSION(:) :: ret_val
[4]192!-
[11]193  INTEGER,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
[4]194  INTEGER,SAVE :: tmp_ret_size = 0
[125]195  INTEGER :: pos,size_of_in,status=0,fileorig
[4]196!---------------------------------------------------------------------
197!-
[1313]198! Do we have this targetname in our database ?
[4]199!-
[1313]200  CALL get_findkey (1,targetname,pos)
[4]201!-
202  size_of_in = SIZE(ret_val)
203  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
204    ALLOCATE (tmp_ret_val(size_of_in))
205  ELSE IF (size_of_in > tmp_ret_size) THEN
206    DEALLOCATE (tmp_ret_val)
207    ALLOCATE (tmp_ret_val(size_of_in))
208    tmp_ret_size = size_of_in
209  ENDIF
210  tmp_ret_val(1:size_of_in) = ret_val(1:size_of_in)
211!-
212  IF (pos < 0) THEN
[11]213!-- Get the information out of the file
[1313]214    CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val)
[4]215!-- Put the data into the database
[11]216    CALL get_wdb &
[1313]217 &   (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val)
[4]218  ELSE
219!-- Get the value out of the database
[1313]220    CALL get_rdb (pos,size_of_in,targetname,i_val=tmp_ret_val)
[4]221  ENDIF
222  ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in)
223!----------------------
[11]224END SUBROUTINE getini1d
[4]225!===
[1313]226SUBROUTINE getini2d (targetname,ret_val)
[4]227!---------------------------------------------------------------------
228  IMPLICIT NONE
229!-
[1313]230  CHARACTER(LEN=*) :: targetname
[11]231  INTEGER,DIMENSION(:,:) :: ret_val
[4]232!-
[11]233  INTEGER,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
[4]234  INTEGER,SAVE :: tmp_ret_size = 0
[125]235  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig
[11]236  INTEGER :: jl,jj,ji
[4]237!---------------------------------------------------------------------
238!-
[1313]239! Do we have this targetname in our database ?
[4]240!-
[1313]241  CALL get_findkey (1,targetname,pos)
[4]242!-
243  size_of_in = SIZE(ret_val)
244  size_1 = SIZE(ret_val,1)
245  size_2 = SIZE(ret_val,2)
246  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
247    ALLOCATE (tmp_ret_val(size_of_in))
248  ELSE IF (size_of_in > tmp_ret_size) THEN
249    DEALLOCATE (tmp_ret_val)
250    ALLOCATE (tmp_ret_val(size_of_in))
251    tmp_ret_size = size_of_in
252  ENDIF
253!-
254  jl=0
255  DO jj=1,size_2
256    DO ji=1,size_1
257      jl=jl+1
258      tmp_ret_val(jl) = ret_val(ji,jj)
259    ENDDO
260  ENDDO
261!-
262  IF (pos < 0) THEN
[11]263!-- Get the information out of the file
[1313]264    CALL get_fil (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val)
[4]265!-- Put the data into the database
[11]266    CALL get_wdb &
[1313]267 &   (targetname,status,fileorig,size_of_in,i_val=tmp_ret_val)
[4]268  ELSE
269!-- Get the value out of the database
[1313]270    CALL get_rdb (pos,size_of_in,targetname,i_val=tmp_ret_val)
[4]271  ENDIF
272!-
273  jl=0
274  DO jj=1,size_2
275    DO ji=1,size_1
276      jl=jl+1
277      ret_val(ji,jj) = tmp_ret_val(jl)
278    ENDDO
279  ENDDO
280!----------------------
[11]281END SUBROUTINE getini2d
[4]282!-
[11]283!=== REAL INTERFACE
[4]284!-
[1313]285SUBROUTINE getinrs (targetname,ret_val)
[4]286!---------------------------------------------------------------------
287  IMPLICIT NONE
288!-
[1313]289  CHARACTER(LEN=*) :: targetname
[11]290  REAL :: ret_val
[4]291!-
[11]292  REAL,DIMENSION(1) :: tmp_ret_val
[1313]293  INTEGER :: pos,status=0,fileorig, size_of_in
[4]294!---------------------------------------------------------------------
295!-
[1313]296! Do we have this targetname in our database ?
[4]297!-
[1313]298  CALL get_findkey (1,targetname,pos)
[4]299!-
300  tmp_ret_val(1) = ret_val
[1313]301  size_of_in = SIZE(tmp_ret_val)
[4]302!-
303  IF (pos < 0) THEN
[11]304!-- Get the information out of the file
[1313]305    CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val)
[4]306!-- Put the data into the database
[11]307    CALL get_wdb &
[1313]308 &   (targetname,status,fileorig,1,r_val=tmp_ret_val)
[11]309  ELSE
[4]310!-- Get the value out of the database
[1313]311    CALL get_rdb (pos,1,targetname,r_val=tmp_ret_val)
[4]312  ENDIF
313  ret_val = tmp_ret_val(1)
314!---------------------
[11]315END SUBROUTINE getinrs
[4]316!===
[1313]317SUBROUTINE getinr1d (targetname,ret_val)
[4]318!---------------------------------------------------------------------
319  IMPLICIT NONE
320!-
[1313]321  CHARACTER(LEN=*) :: targetname
[11]322  REAL,DIMENSION(:) :: ret_val
[4]323!-
[11]324  REAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
[4]325  INTEGER,SAVE :: tmp_ret_size = 0
[125]326  INTEGER :: pos,size_of_in,status=0,fileorig
[4]327!---------------------------------------------------------------------
328!-
[1313]329! Do we have this targetname in our database ?
[4]330!-
[1313]331  CALL get_findkey (1,targetname,pos)
[4]332!-
333  size_of_in = SIZE(ret_val)
334  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
335    ALLOCATE (tmp_ret_val(size_of_in))
336  ELSE IF (size_of_in > tmp_ret_size) THEN
337    DEALLOCATE (tmp_ret_val)
338    ALLOCATE (tmp_ret_val(size_of_in))
339    tmp_ret_size = size_of_in
340  ENDIF
341  tmp_ret_val(1:size_of_in) = ret_val(1:size_of_in)
342!-
343  IF (pos < 0) THEN
[11]344!-- Get the information out of the file
[1313]345    CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val)
[4]346!-- Put the data into the database
[11]347    CALL get_wdb &
[1313]348 &   (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val)
[4]349  ELSE
350!-- Get the value out of the database
[1313]351    CALL get_rdb (pos,size_of_in,targetname,r_val=tmp_ret_val)
[4]352  ENDIF
353  ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in)
354!----------------------
[11]355END SUBROUTINE getinr1d
[4]356!===
[1313]357SUBROUTINE getinr2d (targetname,ret_val)
[4]358!---------------------------------------------------------------------
359  IMPLICIT NONE
360!-
[1313]361  CHARACTER(LEN=*) :: targetname
[11]362  REAL,DIMENSION(:,:) :: ret_val
[4]363!-
[11]364  REAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
[4]365  INTEGER,SAVE :: tmp_ret_size = 0
[125]366  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig
[11]367  INTEGER :: jl,jj,ji
[4]368!---------------------------------------------------------------------
369!-
[1313]370! Do we have this targetname in our database ?
[4]371!-
[1313]372  CALL get_findkey (1,targetname,pos)
[4]373!-
374  size_of_in = SIZE(ret_val)
375  size_1 = SIZE(ret_val,1)
376  size_2 = SIZE(ret_val,2)
377  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
378    ALLOCATE (tmp_ret_val(size_of_in))
379  ELSE IF (size_of_in > tmp_ret_size) THEN
380    DEALLOCATE (tmp_ret_val)
381    ALLOCATE (tmp_ret_val(size_of_in))
382    tmp_ret_size = size_of_in
383  ENDIF
384!-
385  jl=0
386  DO jj=1,size_2
387    DO ji=1,size_1
388      jl=jl+1
389      tmp_ret_val(jl) = ret_val(ji,jj)
390    ENDDO
391  ENDDO
392!-
393  IF (pos < 0) THEN
[11]394!-- Get the information out of the file
[1313]395    CALL get_fil (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val)
[4]396!-- Put the data into the database
[11]397    CALL get_wdb &
[1313]398 &   (targetname,status,fileorig,size_of_in,r_val=tmp_ret_val)
[4]399  ELSE
400!-- Get the value out of the database
[1313]401    CALL get_rdb (pos,size_of_in,targetname,r_val=tmp_ret_val)
[4]402  ENDIF
403!-
404  jl=0
405  DO jj=1,size_2
406    DO ji=1,size_1
407      jl=jl+1
408      ret_val(ji,jj) = tmp_ret_val(jl)
409    ENDDO
410  ENDDO
411!----------------------
[11]412END SUBROUTINE getinr2d
[4]413!-
[11]414!=== CHARACTER INTERFACE
[4]415!-
[1313]416SUBROUTINE getincs (targetname,ret_val)
[4]417!---------------------------------------------------------------------
418  IMPLICIT NONE
419!-
[1313]420  CHARACTER(LEN=*) :: targetname
[4]421  CHARACTER(LEN=*) :: ret_val
422!-
423  CHARACTER(LEN=100),DIMENSION(1) :: tmp_ret_val
[1313]424  INTEGER :: pos,status=0,fileorig,size_of_in
[4]425!---------------------------------------------------------------------
426!-
[1313]427! Do we have this targetname in our database ?
[4]428!-
[1313]429  CALL get_findkey (1,targetname,pos)
[4]430!-
431  tmp_ret_val(1) = ret_val
[1313]432  size_of_in = SIZE(tmp_ret_val)
[4]433!-
434  IF (pos < 0) THEN
[11]435!-- Get the information out of the file
[1313]436    CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val)
[4]437!-- Put the data into the database
[11]438    CALL get_wdb &
[1313]439 &   (targetname,status,fileorig,1,c_val=tmp_ret_val)
[4]440  ELSE
441!-- Get the value out of the database
[1313]442    CALL get_rdb (pos,1,targetname,c_val=tmp_ret_val)
[4]443  ENDIF
444  ret_val = tmp_ret_val(1)
445!---------------------
446END SUBROUTINE getincs
447!===
[1313]448SUBROUTINE getinc1d (targetname,ret_val)
[4]449!---------------------------------------------------------------------
450  IMPLICIT NONE
451!-
[1313]452  CHARACTER(LEN=*) :: targetname
[4]453  CHARACTER(LEN=*),DIMENSION(:) :: ret_val
454!-
455  CHARACTER(LEN=100),DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
456  INTEGER,SAVE :: tmp_ret_size = 0
[125]457  INTEGER :: pos,size_of_in,status=0,fileorig
[4]458!---------------------------------------------------------------------
459!-
[1313]460! Do we have this targetname in our database ?
[4]461!-
[1313]462  CALL get_findkey (1,targetname,pos)
[4]463!-
464  size_of_in = SIZE(ret_val)
465  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
466    ALLOCATE (tmp_ret_val(size_of_in))
467  ELSE IF (size_of_in > tmp_ret_size) THEN
468    DEALLOCATE (tmp_ret_val)
469    ALLOCATE (tmp_ret_val(size_of_in))
470    tmp_ret_size = size_of_in
471  ENDIF
472  tmp_ret_val(1:size_of_in) = ret_val(1:size_of_in)
473!-
474  IF (pos < 0) THEN
[11]475!-- Get the information out of the file
[1313]476    CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val)
[4]477!-- Put the data into the database
[11]478    CALL get_wdb &
[1313]479 &   (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val)
[4]480  ELSE
481!-- Get the value out of the database
[1313]482    CALL get_rdb (pos,size_of_in,targetname,c_val=tmp_ret_val)
[4]483  ENDIF
484  ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in)
485!----------------------
486END SUBROUTINE getinc1d
487!===
[1313]488SUBROUTINE getinc2d (targetname,ret_val)
[4]489!---------------------------------------------------------------------
490  IMPLICIT NONE
491!-
[1313]492  CHARACTER(LEN=*) :: targetname
[4]493  CHARACTER(LEN=*),DIMENSION(:,:) :: ret_val
494!-
495  CHARACTER(LEN=100),DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
496  INTEGER,SAVE :: tmp_ret_size = 0
[125]497  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig
[4]498  INTEGER :: jl,jj,ji
499!---------------------------------------------------------------------
500!-
[1313]501! Do we have this targetname in our database ?
[4]502!-
[1313]503  CALL get_findkey (1,targetname,pos)
[4]504!-
505  size_of_in = SIZE(ret_val)
506  size_1 = SIZE(ret_val,1)
507  size_2 = SIZE(ret_val,2)
508  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
509    ALLOCATE (tmp_ret_val(size_of_in))
510  ELSE IF (size_of_in > tmp_ret_size) THEN
511    DEALLOCATE (tmp_ret_val)
512    ALLOCATE (tmp_ret_val(size_of_in))
513    tmp_ret_size = size_of_in
514  ENDIF
515!-
516  jl=0
517  DO jj=1,size_2
518    DO ji=1,size_1
519      jl=jl+1
520      tmp_ret_val(jl) = ret_val(ji,jj)
521    ENDDO
522  ENDDO
523!-
524  IF (pos < 0) THEN
[11]525!-- Get the information out of the file
[1313]526    CALL get_fil (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val)
[4]527!-- Put the data into the database
[11]528    CALL get_wdb &
[1313]529 &   (targetname,status,fileorig,size_of_in,c_val=tmp_ret_val)
[4]530  ELSE
531!-- Get the value out of the database
[1313]532    CALL get_rdb (pos,size_of_in,targetname,c_val=tmp_ret_val)
[4]533  ENDIF
534!-
535  jl=0
536  DO jj=1,size_2
537    DO ji=1,size_1
538      jl=jl+1
539      ret_val(ji,jj) = tmp_ret_val(jl)
540    ENDDO
541  ENDDO
542!----------------------
543END SUBROUTINE getinc2d
544!-
[11]545!=== LOGICAL INTERFACE
[4]546!-
[1313]547SUBROUTINE getinls (targetname,ret_val)
[4]548!---------------------------------------------------------------------
549  IMPLICIT NONE
550!-
[1313]551  CHARACTER(LEN=*) :: targetname
[4]552  LOGICAL :: ret_val
553!-
554  LOGICAL,DIMENSION(1) :: tmp_ret_val
[1313]555  INTEGER :: pos,status=0,fileorig,size_of_in
[4]556!---------------------------------------------------------------------
557!-
[1313]558! Do we have this targetname in our database ?
[4]559!-
[1313]560  CALL get_findkey (1,targetname,pos)
[4]561!-
562  tmp_ret_val(1) = ret_val
[1313]563  size_of_in = SIZE(tmp_ret_val)
[4]564!-
565  IF (pos < 0) THEN
[11]566!-- Get the information out of the file
[1313]567    CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val)
[4]568!-- Put the data into the database
[11]569    CALL get_wdb &
[1313]570 &   (targetname,status,fileorig,1,l_val=tmp_ret_val)
[4]571  ELSE
572!-- Get the value out of the database
[1313]573    CALL get_rdb (pos,1,targetname,l_val=tmp_ret_val)
[4]574  ENDIF
575  ret_val = tmp_ret_val(1)
576!---------------------
577END SUBROUTINE getinls
578!===
[1313]579SUBROUTINE getinl1d (targetname,ret_val)
[4]580!---------------------------------------------------------------------
581  IMPLICIT NONE
582!-
[1313]583  CHARACTER(LEN=*) :: targetname
[4]584  LOGICAL,DIMENSION(:) :: ret_val
585!-
586  LOGICAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
587  INTEGER,SAVE :: tmp_ret_size = 0
[125]588  INTEGER :: pos,size_of_in,status=0,fileorig
[4]589!---------------------------------------------------------------------
590!-
[1313]591! Do we have this targetname in our database ?
[4]592!-
[1313]593  CALL get_findkey (1,targetname,pos)
[4]594!-
595  size_of_in = SIZE(ret_val)
596  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
597    ALLOCATE (tmp_ret_val(size_of_in))
598  ELSE IF (size_of_in > tmp_ret_size) THEN
599    DEALLOCATE (tmp_ret_val)
600    ALLOCATE (tmp_ret_val(size_of_in))
601    tmp_ret_size = size_of_in
602  ENDIF
603  tmp_ret_val(1:size_of_in) = ret_val(1:size_of_in)
604!-
605  IF (pos < 0) THEN
[11]606!-- Get the information out of the file
[1313]607    CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val)
[4]608!-- Put the data into the database
[11]609    CALL get_wdb &
[1313]610 &   (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val)
[4]611  ELSE
612!-- Get the value out of the database
[1313]613    CALL get_rdb (pos,size_of_in,targetname,l_val=tmp_ret_val)
[4]614  ENDIF
615  ret_val(1:size_of_in) = tmp_ret_val(1:size_of_in)
616!----------------------
617END SUBROUTINE getinl1d
618!===
[1313]619SUBROUTINE getinl2d (targetname,ret_val)
[4]620!---------------------------------------------------------------------
621  IMPLICIT NONE
622!-
[1313]623  CHARACTER(LEN=*) :: targetname
[4]624  LOGICAL,DIMENSION(:,:) :: ret_val
625!-
626  LOGICAL,DIMENSION(:),ALLOCATABLE,SAVE :: tmp_ret_val
627  INTEGER,SAVE :: tmp_ret_size = 0
[125]628  INTEGER :: pos,size_of_in,size_1,size_2,status=0,fileorig
[4]629  INTEGER :: jl,jj,ji
630!---------------------------------------------------------------------
631!-
[1313]632! Do we have this targetname in our database ?
[4]633!-
[1313]634  CALL get_findkey (1,targetname,pos)
[4]635!-
636  size_of_in = SIZE(ret_val)
637  size_1 = SIZE(ret_val,1)
638  size_2 = SIZE(ret_val,2)
639  IF (.NOT.ALLOCATED(tmp_ret_val)) THEN
640    ALLOCATE (tmp_ret_val(size_of_in))
641  ELSE IF (size_of_in > tmp_ret_size) THEN
642    DEALLOCATE (tmp_ret_val)
643    ALLOCATE (tmp_ret_val(size_of_in))
644    tmp_ret_size = size_of_in
645  ENDIF
646!-
647  jl=0
648  DO jj=1,size_2
649    DO ji=1,size_1
650      jl=jl+1
651      tmp_ret_val(jl) = ret_val(ji,jj)
652    ENDDO
653  ENDDO
654!-
655  IF (pos < 0) THEN
[11]656!-- Get the information out of the file
[1313]657    CALL get_fil (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val)
[4]658!-- Put the data into the database
[11]659    CALL get_wdb &
[1313]660 &   (targetname,status,fileorig,size_of_in,l_val=tmp_ret_val)
[4]661  ELSE
662!-- Get the value out of the database
[1313]663    CALL get_rdb (pos,size_of_in,targetname,l_val=tmp_ret_val)
[4]664  ENDIF
665!-
666  jl=0
667  DO jj=1,size_2
668    DO ji=1,size_1
669      jl=jl+1
670      ret_val(ji,jj) = tmp_ret_val(jl)
671    ENDDO
672  ENDDO
673!----------------------
674END SUBROUTINE getinl2d
675!-
[11]676!=== Generic file/database INTERFACE
[4]677!-
[1313]678SUBROUTINE get_fil (targetname,status,fileorig,nb_to_ret,i_val,r_val,c_val,l_val)
[4]679!---------------------------------------------------------------------
680!- Subroutine that will extract from the file the values
[1313]681!- attributed to the keyword targetname
[4]682!-
[1313]683!- (C) targetname    : target for which we will look in the file
[11]684!- (I) status    : tells us from where we obtained the data
685!- (I) fileorig  : index of the file from which the key comes
[1313]686!- (I) nb_to_ret : size of output vector
[11]687!- (I) i_val(:)  : INTEGER(nb_to_ret)   values
688!- (R) r_val(:)  : REAL(nb_to_ret)      values
689!- (L) l_val(:)  : LOGICAL(nb_to_ret)   values
690!- (C) c_val(:)  : CHARACTER(nb_to_ret) values
[4]691!---------------------------------------------------------------------
692  IMPLICIT NONE
693!-
[1313]694  CHARACTER(LEN=*) :: targetname
[1336]695  INTEGER,INTENT(IN) :: nb_to_ret
696  INTEGER,INTENT(OUT) :: status,fileorig
[11]697  INTEGER,DIMENSION(:),OPTIONAL          :: i_val
698  REAL,DIMENSION(:),OPTIONAL             :: r_val
699  LOGICAL,DIMENSION(:),OPTIONAL          :: l_val
700  CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_val
[4]701!-
[1313]702  INTEGER :: k_typ,it,pos,len_str,status_cnt,io_err
[11]703  CHARACTER(LEN=n_d_fmt)  :: cnt
704  CHARACTER(LEN=80) :: str_READ,str_READ_lower
705  CHARACTER(LEN=9)  :: c_vtyp
706  LOGICAL,DIMENSION(:),ALLOCATABLE :: found
707  LOGICAL :: def_beha,compressed
708  CHARACTER(LEN=10) :: c_fmt
709  INTEGER :: i_cmpval
710  REAL    :: r_cmpval
711  INTEGER :: ipos_tr,ipos_fl
[1313]712  LOGICAL :: l_dbg
[11]713!---------------------------------------------------------------------
[1313]714  CALL ipsldbg (old_status=l_dbg)
715!---------------------------------------------------------------------
[4]716!-
[11]717! Get the type of the argument
718  CALL get_qtyp (k_typ,c_vtyp,i_val,r_val,c_val,l_val)
[1313]719  IF ( (k_typ.NE.k_i) .AND. (k_typ.NE.k_r) .AND. (k_typ.NE.k_c) .AND. (k_typ.NE.k_l) ) THEN
[11]720    CALL ipslerr (3,'get_fil', &
721 &   'Internal error','Unknown type of data',' ')
[1313]722  ENDIF
[11]723!-
724! Read the file(s)
[4]725  CALL getin_read
726!-
[11]727! Allocate and initialize the memory we need
728  ALLOCATE(found(nb_to_ret))
[4]729  found(:) = .FALSE.
730!-
731! See what we find in the files read
[1314]732!---
733!-- We dont know from which file the target could come.
734!-- Thus by default we attribute it to the first file :
735  fileorig = 1
736!-
[4]737  DO it=1,nb_to_ret
738!---
739!-- First try the target as it is
[1313]740    CALL get_findkey (2,targetname,pos)
[4]741!---
742!-- Another try
743!---
744    IF (pos < 0) THEN
[11]745      WRITE(UNIT=cnt,FMT=c_i_fmt) it
[1313]746      CALL get_findkey (2,TRIM(targetname)//'__'//cnt,pos)
[4]747    ENDIF
748!---
749    IF (pos > 0) THEN
750!-----
751      found(it) = .TRUE.
752      fileorig = fromfile(pos)
[1313]753      !
754      IF (l_dbg) THEN
755         WRITE(*,*) &
756              &      'getin_fil : read key ',targetname,' from file ',fileorig,' has type ',k_typ
757      ENDIF
[4]758!-----
759!---- DECODE
760!-----
[11]761      str_READ = ADJUSTL(fichier(pos))
[4]762      str_READ_lower = str_READ
763      CALL strlowercase (str_READ_lower)
[1313]764      IF (l_dbg) THEN
765         WRITE(*,*) &
766              &      '            value    ',str_READ_lower
767      ENDIF
[4]768!-----
[11]769      IF (    (TRIM(str_READ_lower) == 'def')     &
770 &        .OR.(TRIM(str_READ_lower) == 'default') ) THEN
[4]771        def_beha = .TRUE.
772      ELSE
773        def_beha = .FALSE.
774        len_str = LEN_TRIM(str_READ)
[11]775        io_err = 0
776        SELECT CASE (k_typ)
777        CASE(k_i)
778          WRITE (UNIT=c_fmt,FMT='("(I",I3.3,")")') len_str
779          READ (UNIT=str_READ(1:len_str), &
780 &              FMT=c_fmt,IOSTAT=io_err) i_val(it)
781        CASE(k_r)
782          READ (UNIT=str_READ(1:len_str), &
783 &              FMT=*,IOSTAT=io_err) r_val(it)
784        CASE(k_c)
785          c_val(it) = str_READ(1:len_str)
786        CASE(k_l)
787          ipos_tr = -1
788          ipos_fl = -1
789          ipos_tr = MAX(INDEX(str_READ_lower,'tru'), &
790 &                      INDEX(str_READ_lower,'y'))
791          ipos_fl = MAX(INDEX(str_READ_lower,'fal'), &
792 &                      INDEX(str_READ_lower,'n'))
793          IF (ipos_tr > 0) THEN
794            l_val(it) = .TRUE.
795          ELSE IF (ipos_fl > 0) THEN
796            l_val(it) = .FALSE.
797          ELSE
798            io_err = 100
799          ENDIF
800        END SELECT
801        IF (io_err /= 0) THEN
802          CALL ipslerr (3,'get_fil', &
[1313]803 &         'Target '//TRIM(targetname), &
[11]804 &         'is not of '//TRIM(c_vtyp)//' type',' ')
[4]805        ENDIF
806      ENDIF
807!-----
[11]808      IF ( (k_typ == k_i).OR.(k_typ == k_r) ) THEN
809!-------
810!------ Is this the value of a compressed field ?
811        compressed = (compline(pos) > 0)
812        IF (compressed) THEN
813          IF (compline(pos) /= nb_to_ret) THEN
814            CALL ipslerr (2,'get_fil', &
[1313]815 &           'For key '//TRIM(targetname)//' we have a compressed field', &
[11]816 &           'which does not have the right size.', &
817 &           'We will try to fix that.')
818          ENDIF
819          IF      (k_typ == k_i) THEN
820            i_cmpval = i_val(it)
821          ELSE IF (k_typ == k_r) THEN
822            r_cmpval = r_val(it)
823          ENDIF
824        ENDIF
825      ENDIF
[4]826    ELSE
827      found(it) = .FALSE.
[11]828      def_beha = .FALSE.
829      compressed = .FALSE.
[4]830    ENDIF
831  ENDDO
832!-
[11]833  IF ( (k_typ == k_i).OR.(k_typ == k_r) ) THEN
834!---
835!-- If this is a compressed field then we will uncompress it
836    IF (compressed) THEN
837      DO it=1,nb_to_ret
838        IF (.NOT.found(it)) THEN
839          IF      (k_typ == k_i) THEN
840            i_val(it) = i_cmpval
841          ELSE IF (k_typ == k_r) THEN
[1315]842            r_val(it) = r_cmpval
[11]843          ENDIF
844          found(it) = .TRUE.
845        ENDIF
846      ENDDO
847    ENDIF
848  ENDIF
[4]849!-
[11]850! Now we set the status for what we found
[4]851  IF (def_beha) THEN
[1313]852    status = default
853    CALL ipslerr (1,'USING DEFAULT BEHAVIOUR FOR', &
854 &   TRIM(targetname),' ',' ')
[1378]855    WRITE(ipslout,*) 'USING DEFAULT BEHAVIOUR FOR ',TRIM(targetname)
[4]856  ELSE
857    status_cnt = 0
858    DO it=1,nb_to_ret
[11]859      IF (.NOT.found(it)) THEN
[4]860        status_cnt = status_cnt+1
[11]861        IF      (status_cnt <= max_msgs) THEN
[1378]862          WRITE (UNIT=ipslout,FMT='(" USING DEFAULTS : ",A)', &
[1313]863 &               ADVANCE='NO') TRIM(targetname)
[11]864          IF (nb_to_ret > 1) THEN
[1378]865            WRITE (UNIT=ipslout,FMT='("__")',ADVANCE='NO')
866            WRITE (UNIT=ipslout,FMT=c_i_fmt,ADVANCE='NO') it
[11]867          ENDIF
868          SELECT CASE (k_typ)
869          CASE(k_i)
[1378]870            WRITE (UNIT=ipslout,FMT=*) "=",i_val(it)
[11]871          CASE(k_r)
[1378]872            WRITE (UNIT=ipslout,FMT=*) "=",r_val(it)
[11]873          CASE(k_c)
[1378]874            WRITE (UNIT=ipslout,FMT=*) "=",c_val(it)
[11]875          CASE(k_l)
[1378]876            WRITE (UNIT=ipslout,FMT=*) "=",l_val(it)
[11]877          END SELECT
878        ELSE IF (status_cnt == max_msgs+1) THEN
[1378]879          WRITE (UNIT=ipslout,FMT='(" USING DEFAULTS ... ",A)')
[4]880        ENDIF
881      ENDIF
882    ENDDO
883!---
884    IF (status_cnt == 0) THEN
[1313]885      status = nondefault
[4]886    ELSE IF (status_cnt == nb_to_ret) THEN
[1313]887      status = default
[4]888    ELSE
[1313]889      status = vectornondefault
[4]890    ENDIF
891  ENDIF
[11]892! Deallocate the memory
893  DEALLOCATE(found)
[4]894!---------------------
[11]895END SUBROUTINE get_fil
896!===
[1313]897SUBROUTINE get_rdb (pos,size_of_in,targetname,i_val,r_val,c_val,l_val)
[11]898!---------------------------------------------------------------------
899!- Read the required variable in the database
900!---------------------------------------------------------------------
901  IMPLICIT NONE
[4]902!-
[11]903  INTEGER :: pos,size_of_in
[1313]904  CHARACTER(LEN=*) :: targetname
[11]905  INTEGER,DIMENSION(:),OPTIONAL          :: i_val
906  REAL,DIMENSION(:),OPTIONAL             :: r_val
907  LOGICAL,DIMENSION(:),OPTIONAL          :: l_val
908  CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_val
909!-
[125]910  INTEGER :: k_typ,k_beg,k_end
[11]911  CHARACTER(LEN=9) :: c_vtyp
912!---------------------------------------------------------------------
913!-
914! Get the type of the argument
915  CALL get_qtyp (k_typ,c_vtyp,i_val,r_val,c_val,l_val)
916  IF (     (k_typ /= k_i).AND.(k_typ /= k_r) &
917 &    .AND.(k_typ /= k_c).AND.(k_typ /= k_l) )THEN
918    CALL ipslerr (3,'get_rdb', &
919 &   'Internal error','Unknown type of data',' ')
920  ENDIF
921!-
[125]922  IF (key_tab(pos)%keytype /= k_typ) THEN
[11]923    CALL ipslerr (3,'get_rdb', &
[1313]924 &   'Wrong data type for keyword '//TRIM(targetname), &
[11]925 &   '(NOT '//TRIM(c_vtyp)//')',' ')
926  ENDIF
927!-
[125]928  IF (key_tab(pos)%keycompress > 0) THEN
929    IF (    (key_tab(pos)%keycompress /= size_of_in) &
930 &      .OR.(key_tab(pos)%keymemlen /= 1) ) THEN
[11]931      CALL ipslerr (3,'get_rdb', &
[1313]932 &     'Wrong compression length','for keyword '//TRIM(targetname),' ')
[11]933    ELSE
934      SELECT CASE (k_typ)
935      CASE(k_i)
[125]936        i_val(1:size_of_in) = i_mem(key_tab(pos)%keymemstart)
[11]937      CASE(k_r)
[125]938        r_val(1:size_of_in) = r_mem(key_tab(pos)%keymemstart)
[11]939      END SELECT
940    ENDIF
941  ELSE
[125]942    IF (key_tab(pos)%keymemlen /= size_of_in) THEN
[11]943      CALL ipslerr (3,'get_rdb', &
[1313]944 &     'Wrong array length','for keyword '//TRIM(targetname),' ')
[11]945    ELSE
[125]946      k_beg = key_tab(pos)%keymemstart
947      k_end = k_beg+key_tab(pos)%keymemlen-1
[11]948      SELECT CASE (k_typ)
949      CASE(k_i)
[125]950        i_val(1:size_of_in) = i_mem(k_beg:k_end)
[11]951      CASE(k_r)
[125]952        r_val(1:size_of_in) = r_mem(k_beg:k_end)
[11]953      CASE(k_c)
[125]954        c_val(1:size_of_in) = c_mem(k_beg:k_end)
[11]955      CASE(k_l)
[125]956        l_val(1:size_of_in) = l_mem(k_beg:k_end)
[11]957      END SELECT
958    ENDIF
959  ENDIF
960!---------------------
961END SUBROUTINE get_rdb
[4]962!===
[11]963SUBROUTINE get_wdb &
[1313]964 &  (targetname,status,fileorig,size_of_in, &
[11]965 &   i_val,r_val,c_val,l_val)
966!---------------------------------------------------------------------
967!- Write data into the data base
968!---------------------------------------------------------------------
969  IMPLICIT NONE
[4]970!-
[1313]971  CHARACTER(LEN=*) :: targetname
[125]972  INTEGER :: status,fileorig,size_of_in
[11]973  INTEGER,DIMENSION(:),OPTIONAL          :: i_val
974  REAL,DIMENSION(:),OPTIONAL             :: r_val
975  LOGICAL,DIMENSION(:),OPTIONAL          :: l_val
976  CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_val
977!-
978  INTEGER :: k_typ
979  CHARACTER(LEN=9) :: c_vtyp
[125]980  INTEGER :: k_mempos,k_memsize,k_beg,k_end
[11]981  LOGICAL :: l_cmp
[1313]982  LOGICAL :: l_dbg
[11]983!---------------------------------------------------------------------
[1313]984  CALL ipsldbg (old_status=l_dbg)
985!---------------------------------------------------------------------
[11]986!-
987! Get the type of the argument
988  CALL get_qtyp (k_typ,c_vtyp,i_val,r_val,c_val,l_val)
989  IF (     (k_typ /= k_i).AND.(k_typ /= k_r) &
990 &    .AND.(k_typ /= k_c).AND.(k_typ /= k_l) )THEN
991    CALL ipslerr (3,'get_wdb', &
992 &   'Internal error','Unknown type of data',' ')
993  ENDIF
994!-
995! First check if we have sufficiant space for the new key
996  IF (nb_keys+1 > keymemsize) THEN
997    CALL getin_allockeys ()
998  ENDIF
999!-
1000  SELECT CASE (k_typ)
1001  CASE(k_i)
1002    k_mempos = i_mempos; k_memsize = i_memsize;
1003    l_cmp = (MINVAL(i_val) == MAXVAL(i_val)) &
1004 &         .AND.(size_of_in > compress_lim)
1005  CASE(k_r)
1006    k_mempos = r_mempos; k_memsize = r_memsize;
1007    l_cmp = (MINVAL(r_val) == MAXVAL(r_val)) &
1008 &         .AND.(size_of_in > compress_lim)
1009  CASE(k_c)
1010    k_mempos = c_mempos; k_memsize = c_memsize;
1011    l_cmp = .FALSE.
1012  CASE(k_l)
1013    k_mempos = l_mempos; k_memsize = l_memsize;
1014    l_cmp = .FALSE.
1015  END SELECT
1016!-
1017! Fill out the items of the data base
1018  nb_keys = nb_keys+1
[1313]1019  key_tab(nb_keys)%keystr = targetname(1:MIN(LEN_TRIM(targetname),l_n))
[125]1020  key_tab(nb_keys)%keystatus = status
1021  key_tab(nb_keys)%keytype = k_typ
1022  key_tab(nb_keys)%keyfromfile = fileorig
1023  key_tab(nb_keys)%keymemstart = k_mempos+1
[11]1024  IF (l_cmp) THEN
[125]1025    key_tab(nb_keys)%keycompress = size_of_in
1026    key_tab(nb_keys)%keymemlen = 1
[11]1027  ELSE
[125]1028    key_tab(nb_keys)%keycompress = -1
1029    key_tab(nb_keys)%keymemlen = size_of_in
[11]1030  ENDIF
[1313]1031  IF (l_dbg) THEN
1032     WRITE(*,*) &
1033 &     "get_wdb : nb_keys ",nb_keys," key_tab keystr   ",key_tab(nb_keys)%keystr,&
1034 &                                       ",keystatus   ",key_tab(nb_keys)%keystatus,&
1035 &                                       ",keytype     ",key_tab(nb_keys)%keytype,&
1036 &                                       ",keycompress ",key_tab(nb_keys)%keycompress,&
1037 &                                       ",keyfromfile ",key_tab(nb_keys)%keyfromfile,&
1038 &                                       ",keymemstart ",key_tab(nb_keys)%keymemstart
1039  ENDIF
1040
[11]1041!-
1042! Before writing the actual size lets see if we have the space
[125]1043  IF (key_tab(nb_keys)%keymemstart+key_tab(nb_keys)%keymemlen &
1044 &    > k_memsize) THEN
1045    CALL getin_allocmem (k_typ,key_tab(nb_keys)%keymemlen)
[11]1046  ENDIF
1047!-
[125]1048  k_beg = key_tab(nb_keys)%keymemstart
1049  k_end = k_beg+key_tab(nb_keys)%keymemlen-1
[11]1050  SELECT CASE (k_typ)
1051  CASE(k_i)
[125]1052    i_mem(k_beg:k_end) = i_val(1:key_tab(nb_keys)%keymemlen)
1053    i_mempos = k_end
[11]1054  CASE(k_r)
[125]1055    r_mem(k_beg:k_end) = r_val(1:key_tab(nb_keys)%keymemlen)
1056    r_mempos = k_end
[11]1057  CASE(k_c)
[125]1058    c_mem(k_beg:k_end) = c_val(1:key_tab(nb_keys)%keymemlen)
1059    c_mempos = k_end
[11]1060  CASE(k_l)
[125]1061    l_mem(k_beg:k_end) = l_val(1:key_tab(nb_keys)%keymemlen)
1062    l_mempos = k_end
[11]1063  END SELECT
1064!---------------------
1065END SUBROUTINE get_wdb
1066!-
1067!===
1068!-
[4]1069SUBROUTINE getin_read
1070!---------------------------------------------------------------------
1071  IMPLICIT NONE
1072!-
[11]1073  INTEGER,SAVE :: current
[4]1074!---------------------------------------------------------------------
1075  IF (allread == 0) THEN
1076!-- Allocate a first set of memory.
[536]1077    CALL getin_alloctxt ()
1078    CALL getin_allockeys ()
[11]1079    CALL getin_allocmem (k_i,0)
1080    CALL getin_allocmem (k_r,0)
1081    CALL getin_allocmem (k_c,0)
1082    CALL getin_allocmem (k_l,0)
[4]1083!-- Start with reading the files
1084    nbfiles = 1
[963]1085    filelist(1) = TRIM(def_file)
[4]1086    current = 1
1087!--
1088    DO WHILE (current <= nbfiles)
1089      CALL getin_readdef (current)
1090      current = current+1
1091    ENDDO
1092    allread = 1
1093    CALL getin_checkcohe ()
1094  ENDIF
1095!------------------------
1096END SUBROUTINE getin_read
1097!-
1098!===
1099!-
1100  SUBROUTINE getin_readdef(current)
1101!---------------------------------------------------------------------
1102!- This subroutine will read the files and only keep the
1103!- the relevant information. The information is kept as it
1104!- found in the file. The data will be analysed later.
1105!---------------------------------------------------------------------
1106  IMPLICIT NONE
1107!-
1108  INTEGER :: current
1109!-
[11]1110  CHARACTER(LEN=100) :: READ_str,NEW_str,last_key,key_str
1111  CHARACTER(LEN=n_d_fmt) :: cnt
1112  CHARACTER(LEN=10) :: c_fmt
[4]1113  INTEGER :: nb_lastkey
1114!-
[11]1115  INTEGER :: eof,ptn,len_str,i,it,iund,io_err
[1313]1116  LOGICAL :: l_dbg
[4]1117!---------------------------------------------------------------------
[1313]1118  CALL ipsldbg (old_status=l_dbg)
1119!---------------------------------------------------------------------
[4]1120  eof = 0
1121  ptn = 1
1122  nb_lastkey = 0
1123!-
[1313]1124  IF (l_dbg) THEN
[1378]1125    WRITE(ipslout,*) 'getin_readdef : Open file ',TRIM(filelist(current))
[4]1126  ENDIF
1127!-
[11]1128  OPEN (UNIT=22,FILE=filelist(current),STATUS="OLD",IOSTAT=io_err)
1129  IF (io_err /= 0) THEN
1130    CALL ipslerr (2,'getin_readdef', &
1131 &  'Could not open file '//TRIM(filelist(current)),' ',' ')
1132    RETURN
1133  ENDIF
[4]1134!-
1135  DO WHILE (eof /= 1)
1136!---
1137    CALL getin_skipafew (22,READ_str,eof,nb_lastkey)
1138    len_str = LEN_TRIM(READ_str)
1139    ptn = INDEX(READ_str,'=')
1140!---
1141    IF (ptn > 0) THEN
1142!---- Get the target
1143      key_str = TRIM(ADJUSTL(READ_str(1:ptn-1)))
[11]1144!---- Make sure that a vector keyword has the right length
1145      iund = INDEX(key_str,'__')
[4]1146      IF (iund > 0) THEN
[11]1147        WRITE (UNIT=c_fmt,FMT='("(I",I3.3,")")') &
1148 &        LEN_TRIM(key_str)-iund-1
1149        READ(UNIT=key_str(iund+2:LEN_TRIM(key_str)), &
1150 &           FMT=c_fmt,IOSTAT=io_err) it
1151        IF ( (io_err == 0).AND.(it > 0) ) THEN
1152          WRITE(UNIT=cnt,FMT=c_i_fmt) it
[4]1153          key_str = key_str(1:iund+1)//cnt
1154        ELSE
[11]1155          CALL ipslerr (3,'getin_readdef', &
1156 &         'A very strange key has just been found :', &
1157 &         TRIM(key_str),' ')
[4]1158        ENDIF
1159      ENDIF
1160!---- Prepare the content
1161      NEW_str = TRIM(ADJUSTL(READ_str(ptn+1:len_str)))
1162      CALL nocomma (NEW_str)
1163      CALL cmpblank (NEW_str)
1164      NEW_str  = TRIM(ADJUSTL(NEW_str))
[1313]1165      IF (l_dbg) THEN
[1378]1166        WRITE(ipslout,*) &
[4]1167 &        '--> getin_readdef : ',TRIM(key_str),' :: ',TRIM(NEW_str)
1168      ENDIF
1169!---- Decypher the content of NEW_str
1170!-
1171!---- This has to be a new key word, thus :
1172      nb_lastkey = 0
1173!----
1174      CALL getin_decrypt (current,key_str,NEW_str,last_key,nb_lastkey)
1175!----
1176    ELSE IF (len_str > 0) THEN
1177!---- Prepare the key if we have an old one to which
1178!---- we will add the line just read
1179      IF (nb_lastkey > 0) THEN
1180        iund =  INDEX(last_key,'__')
1181        IF (iund > 0) THEN
1182!-------- We only continue a keyword, thus it is easy
1183          key_str = last_key(1:iund-1)
1184        ELSE
1185          IF (nb_lastkey /= 1) THEN
[11]1186            CALL ipslerr (3,'getin_readdef', &
1187 &           'We can not have a scalar keyword', &
1188 &           'and a vector content',' ')
[4]1189          ENDIF
1190!-------- The last keyword needs to be transformed into a vector.
[11]1191          WRITE(UNIT=cnt,FMT=c_i_fmt) 1
[4]1192          targetlist(nb_lines) = &
[11]1193 &         last_key(1:MIN(LEN_TRIM(last_key),l_n-n_d_fmt-2))//'__'//cnt
1194          key_str = last_key(1:LEN_TRIM(last_key))
[4]1195        ENDIF
1196      ENDIF
1197!---- Prepare the content
1198      NEW_str = TRIM(ADJUSTL(READ_str(1:len_str)))
1199      CALL getin_decrypt (current,key_str,NEW_str,last_key,nb_lastkey)
1200    ELSE
[11]1201!---- If we have an empty line then the keyword finishes
[4]1202      nb_lastkey = 0
[1313]1203      IF (l_dbg) THEN
[1378]1204        WRITE(ipslout,*) 'getin_readdef : Have found an emtpy line '
[4]1205      ENDIF
1206    ENDIF
1207  ENDDO
1208!-
[11]1209  CLOSE(UNIT=22)
[4]1210!-
[1313]1211  IF (l_dbg) THEN
[963]1212    OPEN (UNIT=22,file=TRIM(def_file)//'.test')
[4]1213    DO i=1,nb_lines
[11]1214      WRITE(UNIT=22,FMT=*) targetlist(i)," : ",fichier(i)
[4]1215    ENDDO
[11]1216    CLOSE(UNIT=22)
[4]1217  ENDIF
[1313]1218!-
1219  IF (l_dbg) THEN
[1378]1220     WRITE(ipslout,*) "nb_lines ",nb_lines,"nb_keys ",nb_keys
1221     WRITE(ipslout,*) "fichier ",fichier(1:nb_lines)
1222     WRITE(ipslout,*) "targetlist ",targetlist(1:nb_lines)
1223     WRITE(ipslout,*) "fromfile ",fromfile(1:nb_lines)
1224     WRITE(ipslout,*) "compline ",compline(1:nb_lines)
1225     WRITE(ipslout,*) '<-getin_readdef'
[1313]1226  ENDIF
[4]1227!---------------------------
1228END SUBROUTINE getin_readdef
1229!-
1230!===
1231!-
1232SUBROUTINE getin_decrypt(current,key_str,NEW_str,last_key,nb_lastkey)
1233!---------------------------------------------------------------------
1234!- This subroutine is going to decypher the line.
1235!- It essentialy checks how many items are included and
1236!- it they can be attached to a key.
1237!---------------------------------------------------------------------
1238  IMPLICIT NONE
1239!-
1240! ARGUMENTS
1241!-
[11]1242  INTEGER :: current,nb_lastkey
1243  CHARACTER(LEN=*) :: key_str,NEW_str,last_key
[4]1244!-
1245! LOCAL
1246!-
[11]1247  INTEGER :: len_str,blk,nbve,starpos
1248  CHARACTER(LEN=100) :: tmp_str,new_key,mult
1249  CHARACTER(LEN=n_d_fmt) :: cnt
1250  CHARACTER(LEN=10) :: c_fmt
[1313]1251  LOGICAL :: l_dbg
[4]1252!---------------------------------------------------------------------
[1313]1253  CALL ipsldbg (old_status=l_dbg)
1254!---------------------------------------------------------------------
[4]1255  len_str = LEN_TRIM(NEW_str)
1256  blk = INDEX(NEW_str(1:len_str),' ')
1257  tmp_str = NEW_str(1:len_str)
1258!-
1259! If the key is a new file then we take it up. Else
1260! we save the line and go on.
1261!-
1262  IF (INDEX(key_str,'INCLUDEDEF') > 0) THEN
1263    DO WHILE (blk > 0)
1264      IF (nbfiles+1 > max_files) THEN
[11]1265        CALL ipslerr (3,'getin_decrypt', &
1266 &       'Too many files to include',' ',' ')
[4]1267      ENDIF
1268!-----
1269      nbfiles = nbfiles+1
1270      filelist(nbfiles) = tmp_str(1:blk)
1271!-----
1272      tmp_str = TRIM(ADJUSTL(tmp_str(blk+1:LEN_TRIM(tmp_str))))
1273      blk = INDEX(tmp_str(1:LEN_TRIM(tmp_str)),' ')
1274    ENDDO
1275!---
1276    IF (nbfiles+1 > max_files) THEN
[11]1277      CALL ipslerr (3,'getin_decrypt', &
1278 &     'Too many files to include',' ',' ')
[4]1279    ENDIF
1280!---
1281    nbfiles =  nbfiles+1
1282    filelist(nbfiles) = TRIM(ADJUSTL(tmp_str))
1283!---
1284    last_key = 'INCLUDEDEF'
1285    nb_lastkey = 1
1286  ELSE
1287!-
1288!-- We are working on a new line of input
1289!-
[536]1290    IF (nb_lines+1 > i_txtsize) THEN
1291      CALL getin_alloctxt ()
1292    ENDIF
[4]1293    nb_lines = nb_lines+1
1294!-
1295!-- First we solve the issue of conpressed information. Once
1296!-- this is done all line can be handled in the same way.
1297!-
1298    starpos = INDEX(NEW_str(1:len_str),'*')
1299    IF ( (starpos > 0).AND.(tmp_str(1:1) /= '"') &
1300 &                    .AND.(tmp_str(1:1) /= "'") ) THEN
1301!-----
[11]1302      IF (INDEX(key_str(1:LEN_TRIM(key_str)),'__') > 0) THEN
1303        CALL ipslerr (3,'getin_decrypt', &
1304 &       'We can not have a compressed field of values', &
1305 &       'in a vector notation (TARGET__n).', &
1306 &       'The key at fault : '//TRIM(key_str))
[4]1307      ENDIF
1308!-
1309!---- Read the multiplied
1310!-
1311      mult = TRIM(ADJUSTL(NEW_str(1:starpos-1)))
1312!---- Construct the new string and its parameters
1313      NEW_str = TRIM(ADJUSTL(NEW_str(starpos+1:len_str)))
1314      len_str = LEN_TRIM(NEW_str)
1315      blk = INDEX(NEW_str(1:len_str),' ')
1316      IF (blk > 1) THEN
[11]1317        CALL ipslerr (2,'getin_decrypt', &
1318 &       'This is a strange behavior','you could report',' ')
[4]1319      ENDIF
[11]1320      WRITE (UNIT=c_fmt,FMT='("(I",I5.5,")")') LEN_TRIM(mult)
1321      READ(UNIT=mult,FMT=c_fmt) compline(nb_lines)
[4]1322!---
1323    ELSE
1324      compline(nb_lines) = -1
1325    ENDIF
1326!-
1327!-- If there is no space wthin the line then the target is a scalar
1328!-- or the element of a properly written vector.
[11]1329!-- (ie of the type TARGET__00001)
[4]1330!-
1331    IF (    (blk <= 1) &
1332 &      .OR.(tmp_str(1:1) == '"') &
1333 &      .OR.(tmp_str(1:1) == "'") ) THEN
1334!-
1335      IF (nb_lastkey == 0) THEN
1336!------ Save info of current keyword as a scalar
1337!------ if it is not a continuation
[11]1338        targetlist(nb_lines) = key_str(1:MIN(LEN_TRIM(key_str),l_n))
1339        last_key = key_str(1:MIN(LEN_TRIM(key_str),l_n))
[4]1340        nb_lastkey = 1
1341      ELSE
1342!------ We are continuing a vector so the keyword needs
1343!------ to get the underscores
[11]1344        WRITE(UNIT=cnt,FMT=c_i_fmt) nb_lastkey+1
[4]1345        targetlist(nb_lines) = &
[11]1346 &        key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt
1347        last_key = &
1348 &        key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt
[4]1349        nb_lastkey = nb_lastkey+1
1350      ENDIF
1351!-----
1352      fichier(nb_lines) = NEW_str(1:len_str)
1353      fromfile(nb_lines) = current
1354    ELSE
1355!-
1356!---- If there are blanks whithin the line then we are dealing
1357!---- with a vector and we need to split it in many entries
[11]1358!---- with the TARGET__n notation.
[4]1359!----
1360!---- Test if the targer is not already a vector target !
1361!-
1362      IF (INDEX(TRIM(key_str),'__') > 0) THEN
[11]1363        CALL ipslerr (3,'getin_decrypt', &
1364 &       'We have found a mixed vector notation (TARGET__n).', &
1365 &       'The key at fault : '//TRIM(key_str),' ')
[4]1366      ENDIF
1367!-
1368      nbve = nb_lastkey
1369      nbve = nbve+1
[11]1370      WRITE(UNIT=cnt,FMT=c_i_fmt) nbve
[4]1371!-
1372      DO WHILE (blk > 0)
1373!-
1374!------ Save the content of target__nbve
1375!-
1376        fichier(nb_lines) = tmp_str(1:blk)
[11]1377        new_key = &
1378 &       key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt
1379        targetlist(nb_lines) = new_key(1:MIN(LEN_TRIM(new_key),l_n))
[4]1380        fromfile(nb_lines) = current
1381!-
1382        tmp_str = TRIM(ADJUSTL(tmp_str(blk+1:LEN_TRIM(tmp_str))))
1383        blk = INDEX(TRIM(tmp_str),' ')
1384!-
[536]1385        IF (nb_lines+1 > i_txtsize) THEN
1386          CALL getin_alloctxt ()
1387        ENDIF
[4]1388        nb_lines = nb_lines+1
1389        nbve = nbve+1
[11]1390        WRITE(UNIT=cnt,FMT=c_i_fmt) nbve
[1375]1391        compline(nb_lines)=compline(nb_lines-1)
[4]1392!-
1393      ENDDO
1394!-
1395!---- Save the content of the last target
1396!-
1397      fichier(nb_lines) = tmp_str(1:LEN_TRIM(tmp_str))
[11]1398      new_key = &
1399 &      key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt
1400      targetlist(nb_lines) = new_key(1:MIN(LEN_TRIM(new_key),l_n))
[4]1401      fromfile(nb_lines) = current
1402!-
[11]1403      last_key = &
1404 &      key_str(1:MIN(LEN_TRIM(key_str),l_n-n_d_fmt-2))//'__'//cnt
[4]1405      nb_lastkey = nbve
1406!-
1407    ENDIF
1408!-
1409  ENDIF
[1313]1410
1411  IF (l_dbg) THEN
[1378]1412     WRITE(ipslout,*) "getin_decrypt ->",TRIM(NEW_str), " : "
1413     WRITE(ipslout,*) "getin_decrypt ->", nb_lines,&
[1375]1414          & SIZE(fichier), &
1415          & SIZE(fromfile), &
1416          & SIZE(filelist)
1417     IF (nb_lines > 0) THEN
[1378]1418        WRITE(ipslout,*) "getin_decrypt ->", &
[1313]1419          & TRIM(fichier(nb_lines)), &
1420          & fromfile(nb_lines), &
1421          & TRIM(filelist(fromfile(nb_lines)))
[1378]1422        WRITE(ipslout,*) "                compline : ",compline(nb_lines)
1423        WRITE(ipslout,*) "                targetlist : ",TRIM(targetlist(nb_lines))
[1375]1424     ENDIF
[1378]1425     WRITE(ipslout,*) "                last_key : ",last_key
[1313]1426  ENDIF
[4]1427!---------------------------
1428END SUBROUTINE getin_decrypt
1429!-
1430!===
1431!-
1432SUBROUTINE getin_checkcohe ()
1433!---------------------------------------------------------------------
1434!- This subroutine checks for redundancies.
1435!---------------------------------------------------------------------
1436  IMPLICIT NONE
1437!-
[125]1438  INTEGER :: line,n_k,k
[4]1439!---------------------------------------------------------------------
1440  DO line=1,nb_lines-1
1441!-
[125]1442    n_k = 0
1443    DO k=line+1,nb_lines
1444      IF (TRIM(targetlist(line)) == TRIM(targetlist(k))) THEN
1445        n_k = k
1446        EXIT
1447      ENDIF
1448    ENDDO
[4]1449!---
1450!-- IF we have found it we have a problem to solve.
1451!---
[125]1452    IF (n_k > 0) THEN
[1378]1453      WRITE(ipslout,*) 'COUNT : ',n_k
1454      WRITE(ipslout,*) &
[125]1455 &  'getin_checkcohe : Found a problem on key ',TRIM(targetlist(line))
[1378]1456      WRITE(ipslout,*) &
[125]1457 &  'getin_checkcohe : The following values were encoutered :'
[1378]1458      WRITE(ipslout,*) &
[125]1459 &  '                ',TRIM(targetlist(line)),' == ',fichier(line)
[1378]1460      WRITE(ipslout,*) &
[125]1461 &  '                ',TRIM(targetlist(k)),' == ',fichier(k)
[1378]1462      WRITE(ipslout,*) &
[125]1463 &  'getin_checkcohe : We will keep only the last value'
[1313]1464       CALL ipslerr (2,'getin_checkcohe','Found a problem on key ', &
1465 &                     TRIM(targetlist(line)), fichier(line)//" "//fichier(k))
[125]1466      targetlist(line) = ' '
[4]1467    ENDIF
1468  ENDDO
[11]1469!-----------------------------
[4]1470END SUBROUTINE getin_checkcohe
1471!-
1472!===
1473!-
1474SUBROUTINE getin_skipafew (unit,out_string,eof,nb_lastkey)
1475!---------------------------------------------------------------------
1476  IMPLICIT NONE
1477!-
[11]1478  INTEGER :: unit,eof,nb_lastkey
[4]1479  CHARACTER(LEN=100) :: dummy
1480  CHARACTER(LEN=100) :: out_string
1481  CHARACTER(LEN=1) :: first
1482!---------------------------------------------------------------------
1483  first="#"
1484  eof = 0
1485  out_string = "    "
1486!-
1487  DO WHILE (first == "#")
[11]1488    READ (UNIT=unit,FMT='(A)',ERR=9998,END=7778) dummy
[4]1489    dummy = TRIM(ADJUSTL(dummy))
1490    first=dummy(1:1)
1491    IF (first == "#") THEN
1492      nb_lastkey = 0
1493    ENDIF
1494  ENDDO
1495  out_string=dummy
1496!-
1497  RETURN
1498!-
[11]14999998 CONTINUE
1500  CALL ipslerr (3,'getin_skipafew','Error while reading file',' ',' ')
[4]1501!-
[11]15027778 CONTINUE
1503  eof = 1
[4]1504!----------------------------
1505END SUBROUTINE getin_skipafew
1506!-
1507!===
1508!-
1509SUBROUTINE getin_allockeys ()
1510!---------------------------------------------------------------------
1511  IMPLICIT NONE
1512!-
[125]1513  TYPE(t_key),ALLOCATABLE,DIMENSION(:) :: tmp_key_tab
[4]1514!-
1515  INTEGER :: ier
[11]1516  CHARACTER(LEN=20) :: c_tmp
[4]1517!---------------------------------------------------------------------
1518  IF (keymemsize == 0) THEN
[11]1519!---
[125]1520!-- Nothing exists in memory arrays and it is easy to do.
1521!---
[11]1522    WRITE (UNIT=c_tmp,FMT=*) memslabs
[125]1523    ALLOCATE(key_tab(memslabs),stat=ier)
[4]1524    IF (ier /= 0) THEN
[11]1525      CALL ipslerr (3,'getin_allockeys', &
[125]1526 &     'Can not allocate key_tab', &
[11]1527 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1528    ENDIF
1529    nb_keys = 0
1530    keymemsize = memslabs
[125]1531    key_tab(:)%keycompress = -1
[11]1532!---
[4]1533  ELSE
[11]1534!---
[4]1535!-- There is something already in the memory,
1536!-- we need to transfer and reallocate.
[11]1537!---
1538    WRITE (UNIT=c_tmp,FMT=*) keymemsize
[125]1539    ALLOCATE(tmp_key_tab(keymemsize),stat=ier)
[4]1540    IF (ier /= 0) THEN
[11]1541      CALL ipslerr (3,'getin_allockeys', &
[125]1542 &     'Can not allocate tmp_key_tab', &
[11]1543 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1544    ENDIF
[11]1545    WRITE (UNIT=c_tmp,FMT=*) keymemsize+memslabs
[125]1546    tmp_key_tab(1:keymemsize) = key_tab(1:keymemsize)
1547    DEALLOCATE(key_tab)
1548    ALLOCATE(key_tab(keymemsize+memslabs),stat=ier)
[4]1549    IF (ier /= 0) THEN
[11]1550      CALL ipslerr (3,'getin_allockeys', &
[125]1551 &     'Can not allocate key_tab', &
[11]1552 &     'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1553    ENDIF
[125]1554    key_tab(:)%keycompress = -1
1555    key_tab(1:keymemsize) = tmp_key_tab(1:keymemsize)
1556    DEALLOCATE(tmp_key_tab)
[4]1557    keymemsize = keymemsize+memslabs
1558  ENDIF
1559!-----------------------------
1560END SUBROUTINE getin_allockeys
1561!-
1562!===
1563!-
1564SUBROUTINE getin_allocmem (type,len_wanted)
1565!---------------------------------------------------------------------
1566!- Allocate the memory of the data base for all 4 types of memory
[125]1567!- INTEGER / REAL / CHARACTER / LOGICAL
[4]1568!---------------------------------------------------------------------
1569  IMPLICIT NONE
1570!-
[11]1571  INTEGER :: type,len_wanted
[4]1572!-
1573  INTEGER,ALLOCATABLE :: tmp_int(:)
[125]1574  REAL,ALLOCATABLE :: tmp_real(:)
[4]1575  CHARACTER(LEN=100),ALLOCATABLE :: tmp_char(:)
1576  LOGICAL,ALLOCATABLE :: tmp_logic(:)
1577  INTEGER :: ier
[11]1578  CHARACTER(LEN=20) :: c_tmp
[4]1579!---------------------------------------------------------------------
1580  SELECT CASE (type)
[11]1581  CASE(k_i)
1582    IF (i_memsize == 0) THEN
1583      ALLOCATE(i_mem(memslabs),stat=ier)
[4]1584      IF (ier /= 0) THEN
[11]1585        WRITE (UNIT=c_tmp,FMT=*) memslabs
1586        CALL ipslerr (3,'getin_allocmem', &
1587 &       'Unable to allocate db-memory', &
1588 &       'i_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1589      ENDIF
[11]1590      i_memsize=memslabs
[4]1591    ELSE
[11]1592      ALLOCATE(tmp_int(i_memsize),stat=ier)
[4]1593      IF (ier /= 0) THEN
[11]1594        WRITE (UNIT=c_tmp,FMT=*) i_memsize
1595        CALL ipslerr (3,'getin_allocmem', &
1596 &       'Unable to allocate tmp_int', &
1597 &       'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1598      ENDIF
[11]1599      tmp_int(1:i_memsize) = i_mem(1:i_memsize)
1600      DEALLOCATE(i_mem)
1601      ALLOCATE(i_mem(i_memsize+MAX(memslabs,len_wanted)),stat=ier)
[4]1602      IF (ier /= 0) THEN
[11]1603        WRITE (UNIT=c_tmp,FMT=*) i_memsize+MAX(memslabs,len_wanted)
1604        CALL ipslerr (3,'getin_allocmem', &
1605 &       'Unable to re-allocate db-memory', &
1606 &       'i_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1607      ENDIF
[11]1608      i_mem(1:i_memsize) = tmp_int(1:i_memsize)
1609      i_memsize = i_memsize+MAX(memslabs,len_wanted)
[4]1610      DEALLOCATE(tmp_int)
1611    ENDIF
[11]1612  CASE(k_r)
1613    IF (r_memsize == 0) THEN
1614      ALLOCATE(r_mem(memslabs),stat=ier)
[4]1615      IF (ier /= 0) THEN
[11]1616        WRITE (UNIT=c_tmp,FMT=*) memslabs
1617        CALL ipslerr (3,'getin_allocmem', &
1618 &       'Unable to allocate db-memory', &
1619 &       'r_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1620      ENDIF
[11]1621      r_memsize =  memslabs
[4]1622    ELSE
[11]1623      ALLOCATE(tmp_real(r_memsize),stat=ier)
[4]1624      IF (ier /= 0) THEN
[11]1625        WRITE (UNIT=c_tmp,FMT=*) r_memsize
1626        CALL ipslerr (3,'getin_allocmem', &
1627 &       'Unable to allocate tmp_real', &
1628 &       'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1629      ENDIF
[11]1630      tmp_real(1:r_memsize) = r_mem(1:r_memsize)
1631      DEALLOCATE(r_mem)
1632      ALLOCATE(r_mem(r_memsize+MAX(memslabs,len_wanted)),stat=ier)
[4]1633      IF (ier /= 0) THEN
[11]1634        WRITE (UNIT=c_tmp,FMT=*) r_memsize+MAX(memslabs,len_wanted)
1635        CALL ipslerr (3,'getin_allocmem', &
1636 &       'Unable to re-allocate db-memory', &
1637 &       'r_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1638      ENDIF
[11]1639      r_mem(1:r_memsize) = tmp_real(1:r_memsize)
1640      r_memsize = r_memsize+MAX(memslabs,len_wanted)
[4]1641      DEALLOCATE(tmp_real)
1642    ENDIF
[11]1643  CASE(k_c)
1644    IF (c_memsize == 0) THEN
1645      ALLOCATE(c_mem(memslabs),stat=ier)
[4]1646      IF (ier /= 0) THEN
[11]1647        WRITE (UNIT=c_tmp,FMT=*) memslabs
1648        CALL ipslerr (3,'getin_allocmem', &
1649 &       'Unable to allocate db-memory', &
1650 &       'c_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1651      ENDIF
[11]1652      c_memsize = memslabs
[4]1653    ELSE
[11]1654      ALLOCATE(tmp_char(c_memsize),stat=ier)
[4]1655      IF (ier /= 0) THEN
[11]1656        WRITE (UNIT=c_tmp,FMT=*) c_memsize
1657        CALL ipslerr (3,'getin_allocmem', &
1658 &       'Unable to allocate tmp_char', &
1659 &       'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1660      ENDIF
[11]1661      tmp_char(1:c_memsize) = c_mem(1:c_memsize)
1662      DEALLOCATE(c_mem)
1663      ALLOCATE(c_mem(c_memsize+MAX(memslabs,len_wanted)),stat=ier)
[4]1664      IF (ier /= 0) THEN
[11]1665        WRITE (UNIT=c_tmp,FMT=*) c_memsize+MAX(memslabs,len_wanted)
1666        CALL ipslerr (3,'getin_allocmem', &
1667 &       'Unable to re-allocate db-memory', &
1668 &       'c_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1669      ENDIF
[11]1670      c_mem(1:c_memsize) = tmp_char(1:c_memsize)
1671      c_memsize = c_memsize+MAX(memslabs,len_wanted)
[4]1672      DEALLOCATE(tmp_char)
1673    ENDIF
[11]1674  CASE(k_l)
1675    IF (l_memsize == 0) THEN
1676      ALLOCATE(l_mem(memslabs),stat=ier)
[4]1677      IF (ier /= 0) THEN
[11]1678        WRITE (UNIT=c_tmp,FMT=*) memslabs
1679        CALL ipslerr (3,'getin_allocmem', &
1680 &       'Unable to allocate db-memory', &
1681 &       'l_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1682      ENDIF
[11]1683      l_memsize = memslabs
[4]1684    ELSE
[11]1685      ALLOCATE(tmp_logic(l_memsize),stat=ier)
[4]1686      IF (ier /= 0) THEN
[11]1687        WRITE (UNIT=c_tmp,FMT=*) l_memsize
1688        CALL ipslerr (3,'getin_allocmem', &
1689 &       'Unable to allocate tmp_logic', &
1690 &       'to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1691      ENDIF
[11]1692      tmp_logic(1:l_memsize) = l_mem(1:l_memsize)
1693      DEALLOCATE(l_mem)
1694      ALLOCATE(l_mem(l_memsize+MAX(memslabs,len_wanted)),stat=ier)
[4]1695      IF (ier /= 0) THEN
[11]1696        WRITE (UNIT=c_tmp,FMT=*) l_memsize+MAX(memslabs,len_wanted)
1697        CALL ipslerr (3,'getin_allocmem', &
1698 &       'Unable to re-allocate db-memory', &
1699 &       'l_mem to size '//TRIM(ADJUSTL(c_tmp)),' ')
[4]1700      ENDIF
[11]1701      l_mem(1:l_memsize) = tmp_logic(1:l_memsize)
1702      l_memsize = l_memsize+MAX(memslabs,len_wanted)
[4]1703      DEALLOCATE(tmp_logic)
1704    ENDIF
1705  CASE DEFAULT
[11]1706    CALL ipslerr (3,'getin_allocmem','Unknown type of data',' ',' ')
[4]1707  END SELECT
1708!----------------------------
1709END SUBROUTINE getin_allocmem
1710!-
1711!===
1712!-
[536]1713SUBROUTINE getin_alloctxt ()
1714!---------------------------------------------------------------------
1715  IMPLICIT NONE
1716!-
1717  CHARACTER(LEN=100),ALLOCATABLE :: tmp_fic(:)
1718  CHARACTER(LEN=l_n),ALLOCATABLE :: tmp_tgl(:)
1719  INTEGER,ALLOCATABLE :: tmp_int(:)
1720!-
1721  INTEGER :: ier
1722  CHARACTER(LEN=20) :: c_tmp1,c_tmp2
1723!---------------------------------------------------------------------
1724  IF (i_txtsize == 0) THEN
1725!---
1726!-- Nothing exists in memory arrays and it is easy to do.
1727!---
1728    WRITE (UNIT=c_tmp1,FMT=*) i_txtslab
1729    ALLOCATE(fichier(i_txtslab),stat=ier)
1730    IF (ier /= 0) THEN
1731      CALL ipslerr (3,'getin_alloctxt', &
1732 &     'Can not allocate fichier', &
1733 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1734    ENDIF
1735!---
1736    ALLOCATE(targetlist(i_txtslab),stat=ier)
1737    IF (ier /= 0) THEN
1738      CALL ipslerr (3,'getin_alloctxt', &
1739 &     'Can not allocate targetlist', &
1740 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1741    ENDIF
1742!---
1743    ALLOCATE(fromfile(i_txtslab),stat=ier)
1744    IF (ier /= 0) THEN
1745      CALL ipslerr (3,'getin_alloctxt', &
1746 &     'Can not allocate fromfile', &
1747 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1748    ENDIF
1749!---
1750    ALLOCATE(compline(i_txtslab),stat=ier)
1751    IF (ier /= 0) THEN
1752      CALL ipslerr (3,'getin_alloctxt', &
1753 &     'Can not allocate compline', &
1754 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1755    ENDIF
1756!---
1757    nb_lines = 0
1758    i_txtsize = i_txtslab
1759  ELSE
1760!---
1761!-- There is something already in the memory,
1762!-- we need to transfer and reallocate.
1763!---
1764    WRITE (UNIT=c_tmp1,FMT=*) i_txtsize
1765    WRITE (UNIT=c_tmp2,FMT=*) i_txtsize+i_txtslab
1766    ALLOCATE(tmp_fic(i_txtsize),stat=ier)
1767    IF (ier /= 0) THEN
1768      CALL ipslerr (3,'getin_alloctxt', &
1769 &     'Can not allocate tmp_fic', &
1770 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1771    ENDIF
1772    tmp_fic(1:i_txtsize) = fichier(1:i_txtsize)
1773    DEALLOCATE(fichier)
1774    ALLOCATE(fichier(i_txtsize+i_txtslab),stat=ier)
1775    IF (ier /= 0) THEN
1776      CALL ipslerr (3,'getin_alloctxt', &
1777 &     'Can not allocate fichier', &
1778 &     'to size '//TRIM(ADJUSTL(c_tmp2)),' ')
1779    ENDIF
1780    fichier(1:i_txtsize) = tmp_fic(1:i_txtsize)
1781    DEALLOCATE(tmp_fic)
1782!---
1783    ALLOCATE(tmp_tgl(i_txtsize),stat=ier)
1784    IF (ier /= 0) THEN
1785      CALL ipslerr (3,'getin_alloctxt', &
1786 &     'Can not allocate tmp_tgl', &
1787 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1788    ENDIF
1789    tmp_tgl(1:i_txtsize) = targetlist(1:i_txtsize)
1790    DEALLOCATE(targetlist)
1791    ALLOCATE(targetlist(i_txtsize+i_txtslab),stat=ier)
1792    IF (ier /= 0) THEN
1793      CALL ipslerr (3,'getin_alloctxt', &
1794 &     'Can not allocate targetlist', &
1795 &     'to size '//TRIM(ADJUSTL(c_tmp2)),' ')
1796    ENDIF
1797    targetlist(1:i_txtsize) = tmp_tgl(1:i_txtsize)
1798    DEALLOCATE(tmp_tgl)
1799!---
1800    ALLOCATE(tmp_int(i_txtsize),stat=ier)
1801    IF (ier /= 0) THEN
1802      CALL ipslerr (3,'getin_alloctxt', &
1803 &     'Can not allocate tmp_int', &
1804 &     'to size '//TRIM(ADJUSTL(c_tmp1)),' ')
1805    ENDIF
1806    tmp_int(1:i_txtsize) = fromfile(1:i_txtsize)
1807    DEALLOCATE(fromfile)
1808    ALLOCATE(fromfile(i_txtsize+i_txtslab),stat=ier)
1809    IF (ier /= 0) THEN
1810      CALL ipslerr (3,'getin_alloctxt', &
1811 &     'Can not allocate fromfile', &
1812 &     'to size '//TRIM(ADJUSTL(c_tmp2)),' ')
1813    ENDIF
1814    fromfile(1:i_txtsize) = tmp_int(1:i_txtsize)
1815!---
1816    tmp_int(1:i_txtsize) = compline(1:i_txtsize)
1817    DEALLOCATE(compline)
1818    ALLOCATE(compline(i_txtsize+i_txtslab),stat=ier)
1819    IF (ier /= 0) THEN
1820      CALL ipslerr (3,'getin_alloctxt', &
1821 &     'Can not allocate compline', &
1822 &     'to size '//TRIM(ADJUSTL(c_tmp2)),' ')
1823    ENDIF
1824    compline(1:i_txtsize) = tmp_int(1:i_txtsize)
1825    DEALLOCATE(tmp_int)
1826!---
1827    i_txtsize = i_txtsize+i_txtslab
1828  ENDIF
1829!----------------------------
1830END SUBROUTINE getin_alloctxt
1831!-
1832!===
1833!-
[4]1834SUBROUTINE getin_dump (fileprefix)
1835!---------------------------------------------------------------------
1836  IMPLICIT NONE
1837!-
1838  CHARACTER(*),OPTIONAL :: fileprefix
1839!-
[11]1840  CHARACTER(LEN=80) :: usedfileprefix
[4]1841  INTEGER :: ikey,if,iff,iv
[1313]1842  INTEGER :: ios
[11]1843  CHARACTER(LEN=20) :: c_tmp
1844  CHARACTER(LEN=100) :: tmp_str,used_filename
[1313]1845  INTEGER :: io_err
1846  LOGICAL :: l_dbg
[4]1847!---------------------------------------------------------------------
[1313]1848  CALL ipsldbg (old_status=l_dbg)
1849!---------------------------------------------------------------------
[4]1850  IF (PRESENT(fileprefix)) THEN
[11]1851    usedfileprefix = fileprefix(1:MIN(LEN_TRIM(fileprefix),80))
1852  ELSE
1853    usedfileprefix = "used"
[4]1854  ENDIF
1855!-
1856  DO if=1,nbfiles
1857!---
1858    used_filename = TRIM(usedfileprefix)//'_'//TRIM(filelist(if))
[1313]1859    IF (l_dbg) THEN
[1378]1860      WRITE(ipslout,*) &
[1313]1861 &      'getin_dump : opens file : ',TRIM(used_filename),' if = ',if
[1378]1862      WRITE(ipslout,*) 'GETIN_DUMP : NUMBER OF KEYS : ',nb_keys
[4]1863    ENDIF
[1313]1864    OPEN (UNIT=22,FILE=used_filename,iostat=io_err)
1865    IF (io_err /= 0) THEN
1866       CALL ipslerr (3,'getin_dump', &
1867            &   'Could not open file :',TRIM(used_filename), &
1868            &   '')
1869    ENDIF
[11]1870!---
[4]1871!-- If this is the first file we need to add the list
1872!-- of file which belong to it
[11]1873    IF ( (if == 1).AND.(nbfiles > 1) ) THEN
1874      WRITE(22,*) '# '
1875      WRITE(22,*) '# This file is linked to the following files :'
1876      WRITE(22,*) '# '
[4]1877      DO iff=2,nbfiles
[11]1878        WRITE(22,*) 'INCLUDEDEF = ',TRIM(filelist(iff))
[4]1879      ENDDO
[11]1880      WRITE(22,*) '# '
[1313]1881      IF (l_dbg) THEN
[1378]1882         WRITE(ipslout,*) '# '
1883         WRITE(ipslout,*) '# This file is linked to the following files :'
1884         WRITE(ipslout,*) '# '
[1313]1885         DO iff=2,nbfiles
[1378]1886            WRITE(ipslout,*) 'INCLUDEDEF = ',TRIM(filelist(iff))
[1313]1887         ENDDO
[1378]1888         WRITE(ipslout,*) '# '
[1313]1889      ENDIF
[4]1890    ENDIF
1891!---
1892    DO ikey=1,nb_keys
[11]1893!-----
1894!---- Is this key from this file ?
[125]1895      IF (key_tab(ikey)%keyfromfile == if) THEN
[11]1896!-------
1897!------ Write some comments
1898        WRITE(22,*) '#'
[125]1899        SELECT CASE (key_tab(ikey)%keystatus)
[1313]1900        CASE(nondefault)
[11]1901          WRITE(22,*) '# Values of ', &
[963]1902 &          TRIM(key_tab(ikey)%keystr),' comes from ',TRIM(def_file)
[1313]1903        CASE(default)
[11]1904          WRITE(22,*) '# Values of ', &
[125]1905 &          TRIM(key_tab(ikey)%keystr),' are all defaults.'
[1313]1906        CASE(vectornondefault)
[11]1907          WRITE(22,*) '# Values of ', &
[125]1908 &          TRIM(key_tab(ikey)%keystr), &
[963]1909 &          ' are a mix of ',TRIM(def_file),' and defaults.'
[4]1910        CASE DEFAULT
[11]1911          WRITE(22,*) '# Dont know from where the value of ', &
[125]1912 &          TRIM(key_tab(ikey)%keystr),' comes.'
[4]1913        END SELECT
[11]1914        WRITE(22,*) '#'
[1313]1915        !-
1916        IF (l_dbg) THEN
[1378]1917           WRITE(ipslout,*) '#'
1918           WRITE(ipslout,*) '# Status of key ', ikey, ' : ',&
[1313]1919 &          TRIM(key_tab(ikey)%keystr),key_tab(ikey)%keystatus
1920        ENDIF
[11]1921!-------
1922!------ Write the values
[125]1923        SELECT CASE (key_tab(ikey)%keytype)
[11]1924        CASE(k_i)
[125]1925          IF (key_tab(ikey)%keymemlen == 1) THEN
1926            IF (key_tab(ikey)%keycompress < 0) THEN
[11]1927              WRITE(22,*) &
[125]1928 &              TRIM(key_tab(ikey)%keystr), &
1929 &              ' = ',i_mem(key_tab(ikey)%keymemstart)
[4]1930            ELSE
[11]1931              WRITE(22,*) &
[125]1932 &              TRIM(key_tab(ikey)%keystr), &
1933 &              ' = ',key_tab(ikey)%keycompress, &
1934 &              ' * ',i_mem(key_tab(ikey)%keymemstart)
[4]1935            ENDIF
1936          ELSE
[125]1937            DO iv=0,key_tab(ikey)%keymemlen-1
[11]1938              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1
1939              WRITE(22,*) &
[125]1940 &              TRIM(key_tab(ikey)%keystr), &
1941 &              '__',TRIM(ADJUSTL(c_tmp)), &
1942 &              ' = ',i_mem(key_tab(ikey)%keymemstart+iv)
[4]1943            ENDDO
1944          ENDIF
[11]1945        CASE(k_r)
[125]1946          IF (key_tab(ikey)%keymemlen == 1) THEN
1947            IF (key_tab(ikey)%keycompress < 0) THEN
[11]1948              WRITE(22,*) &
[125]1949 &              TRIM(key_tab(ikey)%keystr), &
1950 &              ' = ',r_mem(key_tab(ikey)%keymemstart)
[4]1951            ELSE
[11]1952              WRITE(22,*) &
[125]1953 &              TRIM(key_tab(ikey)%keystr), &
1954 &              ' = ',key_tab(ikey)%keycompress, &
1955                   & ' * ',r_mem(key_tab(ikey)%keymemstart)
[4]1956            ENDIF
1957          ELSE
[125]1958            DO iv=0,key_tab(ikey)%keymemlen-1
[11]1959              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1
1960              WRITE(22,*) &
[125]1961 &              TRIM(key_tab(ikey)%keystr),'__',TRIM(ADJUSTL(c_tmp)), &
1962 &              ' = ',r_mem(key_tab(ikey)%keymemstart+iv)
[4]1963            ENDDO
1964          ENDIF
[11]1965        CASE(k_c)
[125]1966          IF (key_tab(ikey)%keymemlen == 1) THEN
1967            tmp_str = c_mem(key_tab(ikey)%keymemstart)
1968            WRITE(22,*) TRIM(key_tab(ikey)%keystr), &
1969 &              ' = ',TRIM(tmp_str)
[4]1970          ELSE
[125]1971            DO iv=0,key_tab(ikey)%keymemlen-1
[11]1972              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1
[125]1973              tmp_str = c_mem(key_tab(ikey)%keymemstart+iv)
[11]1974              WRITE(22,*) &
[125]1975 &              TRIM(key_tab(ikey)%keystr), &
1976 &              '__',TRIM(ADJUSTL(c_tmp)), &
[11]1977 &              ' = ',TRIM(tmp_str)
[4]1978            ENDDO
1979          ENDIF
[11]1980        CASE(k_l)
[125]1981          IF (key_tab(ikey)%keymemlen == 1) THEN
1982            IF (l_mem(key_tab(ikey)%keymemstart)) THEN
1983              WRITE(22,*) TRIM(key_tab(ikey)%keystr),' = TRUE '
[4]1984            ELSE
[125]1985              WRITE(22,*) TRIM(key_tab(ikey)%keystr),' = FALSE '
[4]1986            ENDIF
1987          ELSE
[125]1988            DO iv=0,key_tab(ikey)%keymemlen-1
[11]1989              WRITE(UNIT=c_tmp,FMT=c_i_fmt) iv+1
[125]1990              IF (l_mem(key_tab(ikey)%keymemstart+iv)) THEN
1991                WRITE(22,*) TRIM(key_tab(ikey)%keystr),'__', &
[11]1992 &                          TRIM(ADJUSTL(c_tmp)),' = TRUE '
[4]1993              ELSE
[125]1994                WRITE(22,*) TRIM(key_tab(ikey)%keystr),'__', &
[11]1995 &                          TRIM(ADJUSTL(c_tmp)),' = FALSE '
[4]1996              ENDIF
1997            ENDDO
1998          ENDIF
1999        CASE DEFAULT
[11]2000          CALL ipslerr (3,'getin_dump', &
[125]2001 &         'Unknown type for variable '//TRIM(key_tab(ikey)%keystr), &
2002 &         ' ',' ')
[4]2003        END SELECT
2004      ENDIF
2005    ENDDO
2006!-
[11]2007    CLOSE(UNIT=22)
[4]2008!-
2009  ENDDO
2010!------------------------
2011END SUBROUTINE getin_dump
[11]2012!===
2013SUBROUTINE get_qtyp (k_typ,c_vtyp,i_v,r_v,c_v,l_v)
2014!---------------------------------------------------------------------
2015!- Returns the type of the argument (mutually exclusive)
2016!---------------------------------------------------------------------
2017  IMPLICIT NONE
[4]2018!-
[11]2019  INTEGER,INTENT(OUT) :: k_typ
2020  CHARACTER(LEN=*),INTENT(OUT) :: c_vtyp
2021  INTEGER,DIMENSION(:),OPTIONAL          :: i_v
2022  REAL,DIMENSION(:),OPTIONAL             :: r_v
2023  LOGICAL,DIMENSION(:),OPTIONAL          :: l_v
2024  CHARACTER(LEN=*),DIMENSION(:),OPTIONAL :: c_v
2025!---------------------------------------------------------------------
2026  k_typ = 0
2027  IF (COUNT((/PRESENT(i_v),PRESENT(r_v),PRESENT(c_v),PRESENT(l_v)/)) &
2028 &    /= 1) THEN
2029    CALL ipslerr (3,'get_qtyp', &
2030 &   'Invalid number of optional arguments','(/= 1)',' ')
2031  ENDIF
2032!-
2033  IF     (PRESENT(i_v)) THEN
2034    k_typ = k_i
2035    c_vtyp = 'INTEGER'
2036  ELSEIF (PRESENT(r_v)) THEN
2037    k_typ = k_r
2038    c_vtyp = 'REAL'
2039  ELSEIF (PRESENT(c_v)) THEN
2040    k_typ = k_c
2041    c_vtyp = 'CHARACTER'
2042  ELSEIF (PRESENT(l_v)) THEN
2043    k_typ = k_l
2044    c_vtyp = 'LOGICAL'
2045  ENDIF
2046!----------------------
2047END SUBROUTINE get_qtyp
[4]2048!===
[125]2049SUBROUTINE get_findkey (i_tab,c_key,pos)
2050!---------------------------------------------------------------------
2051!- This subroutine looks for a key in a table
2052!---------------------------------------------------------------------
2053!- INPUT
2054!-   i_tab  : 1 -> search in key_tab(1:nb_keys)%keystr
2055!-            2 -> search in targetlist(1:nb_lines)
2056!-   c_key  : Name of the key we are looking for
2057!- OUTPUT
2058!-   pos    : -1 if key not found, else value in the table
2059!---------------------------------------------------------------------
2060  IMPLICIT NONE
2061!-
2062  INTEGER,INTENT(in) :: i_tab
2063  CHARACTER(LEN=*),INTENT(in) :: c_key
2064  INTEGER,INTENT(out) :: pos
2065!-
2066  INTEGER :: ikey_max,ikey
2067  CHARACTER(LEN=l_n) :: c_q_key
2068!---------------------------------------------------------------------
2069  pos = -1
2070  IF     (i_tab == 1) THEN
2071    ikey_max = nb_keys
2072  ELSEIF (i_tab == 2) THEN
2073    ikey_max = nb_lines
2074  ELSE
2075    ikey_max = 0
2076  ENDIF
2077  IF ( ikey_max > 0 ) THEN
2078    DO ikey=1,ikey_max
2079      IF (i_tab == 1) THEN
2080        c_q_key = key_tab(ikey)%keystr
2081      ELSE
2082        c_q_key = targetlist(ikey)
2083      ENDIF
2084      IF (TRIM(c_q_key) == TRIM(c_key)) THEN
2085        pos = ikey
2086        EXIT
2087      ENDIF
2088    ENDDO
2089  ENDIF
2090!-------------------------
2091END SUBROUTINE get_findkey
2092!===
[11]2093!------------------
[4]2094END MODULE getincom
Note: See TracBrowser for help on using the repository browser.