module readkey_module use typesandkinds contains real*8 function readkey_dbl(fname,key,defval,mnval,mxval,bcast,required) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! 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 use logging_module implicit none character(len=*) :: fname,key character(slen) :: printkey real*8 :: defval,mnval,mxval logical, intent(in), optional :: bcast,required character(slen) :: value real*8 :: value_dbl logical :: lbcast,lrequired character(slen) :: fmt fmt = '(a,a,a,f0.4,a,f0.4)' if (present(bcast)) then lbcast = bcast else lbcast = .true. endif if (present(required)) then lrequired = required else lrequired = .false. endif !printkey=key printkey = ' ' printkey(2:24)=trim(key) printkey(1:1)=' ' if (xmaster) then call readkey(fname,key,value) if (value/=' ') then read(value,'(f10.0)')value_dbl if (value_dbl>mxval) then call writelog('lw','(a12,a,f0.4,a,f0.4)',(printkey),' = ',value_dbl,' Warning: value > recommended value of ',mxval) call writelog('s','(a12,a,a,f0.4)','Warning: ',trim(printkey),' > recommended value of ',mxval) elseif (value_dblmxval) then call writelog('lw',fmt,'Warning: variable ',(printkey),' ',value_int,' > recommended value of ',mxval) call writelog('s','(a12,a,a,i0)','Warning: ',trim(printkey),' > recommended value of ',mxval) elseif (value_intmxval) then call writelog('lw','(a12,a,f0.4,a,f0.4)',(printkey),' = ',value_vec(i), & ' Warning: value > recommended value of ',mxval) call writelog('s','(a12,a,a,f0.4)','Warning: ',trim(printkey),' > recommended value of ',mxval) elseif (value_vec(i)