module readkey_module contains real*8 function readkey_dbl(fname,key,defval,mnval,mxval,bcast) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Copyright (C) 2007 UNESCO-IHE, WL|Delft Hydraulics and Delft University ! ! Dano Roelvink, Ap van Dongeren, Ad Reniers, Jamie Lescinski, ! ! Jaap van Thiel de Vries, Robert McCall ! ! ! ! d.roelvink@unesco-ihe.org ! ! UNESCO-IHE Institute for Water Education ! ! P.O. Box 3015 ! ! 2601 DA Delft ! ! The Netherlands ! ! ! ! This library is free software; you can redistribute it and/or ! ! modify it under the terms of the GNU Lesser General Public ! ! License as published by the Free Software Foundation; either ! ! version 2.1 of the License, or (at your option) any later version. ! ! ! ! This library is distributed in the hope that it will be useful, ! ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! ! Lesser General Public License for more details. ! ! ! ! You should have received a copy of the GNU Lesser General Public ! ! License along with this library; if not, write to the Free Software ! ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 ! ! USA ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! if USEMPI then the master process will read the parameter, ! this value is subsequently broadcasted to the other processes use xmpi_module implicit none character(len=*) :: fname,key real*8 :: defval,mnval,mxval logical, intent(in), optional :: bcast character*80 :: value real*8 :: value_dbl logical :: lbcast if (present(bcast)) then lbcast = bcast else lbcast = .true. endif if (xmaster) then call readkey(fname,key,value) if (value/=' ') then read(value,'(f10.0)')value_dbl if (value_dbl>mxval) then write(*,*)'Warning: variable ',trim(key),value_dbl,' > recommended value of ',mxval elseif (value_dblmxval) then write(*,*)'Warning: variable ',trim(key),value_int,' > recommended value of ',mxval elseif (value_int0) then ikey=ikey+1 keyword(ikey)=adjustl(line(1:ic-1)) values(ikey)=adjustl(line(ic+1:80)) endif enddo nkeys=ikey close(lun) allocate(readindex(nkeys)) readindex=0 endif value=' ' do ikey=1,nkeys if (key.eq.keyword(ikey)) then value=values(ikey) readindex(ikey)=1 endif enddo ! If required, do a check whether params are not used or unknown if (key .eq. 'checkparams') then do ikey=1,nkeys if (readindex(ikey)==0) then write(*,*) 'Unknown, unused or multiple statements of parameter ',trim(keyword(ikey)),' in ',trim(fname) endif enddo endif end subroutine readkey end module readkey_module