47 INTEGER,
INTENT(out) :: outInt
48 character(len=:),
allocatable :: word
49 character(len=:),
allocatable:: comment
55 read(word,
"("//format_integer//
")", iostat=err) outint
57 call logerror(
"Could not cast to TYPE INTEGER in controlParsFile: ->"//word//
"<-"//comment)
82 REAL,
INTENT(out) :: outReal
83 character(len=:),
allocatable :: word
84 character(len=:),
allocatable:: comment
90 read(word,
"("//format_real//
")", iostat=err) outreal
92 call logerror(
"Could not cast to TYPE REAL in controlParsFile: ->"//word//
"<-"//comment)
117 character(len=:),
allocatable,
INTENT(out) :: outChar
118 character(len=:),
allocatable :: word
119 character(len=:),
allocatable:: comment
126 call logerror(
"Could not cast to TYPE CHARCATER in controlParsFile: ->"//word//
"<-"//comment)
151 LOGICAL,
INTENT(out) :: outLogical
152 character(len=:),
allocatable :: word
153 character(len=:),
allocatable:: comment
159 read(word,
"("//format_logical//
")", iostat=err) outlogical
161 call logerror(
"Could not cast to TYPE LOGICAL in controlParsFile: ->"//word//
"<-"//comment)
183 INTEGER,
INTENT(in) :: err
203 INTEGER,
INTENT(in) :: err
229 character(len=:),
allocatable,
INTENT(out) :: rest
230 INTEGER,
INTENT(out) :: err
231 INTEGER,
INTENT(out) :: nvals
233 INTEGER,
dimension(10),
INTENT(out),
optional :: vec_INTEGER
234 REAL,
dimension(10),
INTENT(out),
optional :: vec_REAL
235 character(len=30),
INTENT(out),
optional :: vec_CHAR (10)
236 LOGICAL,
dimension(10),
INTENT(out),
optional :: vec_LOGICAL
238 character(len=30),
dimension(50) :: wordsvec
249 if(
present(vec_integer))
then
250 read(wordsvec(iword),
"("//format_integer//
")", iostat=err) vec_integer(iword)
251 else if (
present(vec_real))
then
252 read(wordsvec(iword),
"("//format_real//
")", iostat=err) vec_real(iword)
253 else if (
present(vec_char))
then
254 vec_char(iword) = wordsvec(iword )
255 else if (
present(vec_logical))
then
256 read(wordsvec(iword),
"("//format_logical//
")", iostat=err) vec_logical(iword)
286 character(len=:),
allocatable :: rest
287 INTEGER,
INTENT(out) :: err
288 INTEGER,
INTENT(out) :: nvals
290 INTEGER,
dimension(10),
INTENT(out),
optional :: vec_INTEGER
291 REAL,
dimension(10),
INTENT(out),
optional :: vec_REAL
292 character(len=30),
INTENT(out),
optional :: vec_char (10)
293 LOGICAL,
dimension(10),
INTENT(out),
optional :: vec_LOGICAL
295 character (len=3) :: nvalschar
296 character(len=3),
parameter :: FORMAT_INTEGER_narrow =
"I5"
301 if(
present(vec_integer))
then
306 write(
controlparsout_file%unit,
"("// nvalschar//
"("//format_integer_narrow//
") ,A)", iostat=err) &
307 ( vec_integer(i), i= 1,nvals), rest
309 else if (
present(vec_real))
then
311 ( vec_real(i), i= 1,nvals), rest
312 else if (
present(vec_char))
then
313 write(
controlparsout_file%unit,
"("// nvalschar//
"("//format_character//
") ,A)", iostat=err) &
314 ( vec_char(i), i= 1,nvals), rest
315 else if (
present(vec_logical))
then
316 write(
controlparsout_file%unit,
"("// nvalschar//
"("//format_logical//
") ,A)", iostat=err) &
317 ( vec_logical(i), i= 1,nvals), rest
348 INTEGER,
INTENT(in ):: nvals
349 INTEGER,
INTENT(in ):: repInts(30)
350 INTEGER:: i, irepInts, simuendyear
351 character (len=3) :: charvar
360 else if (mod(nvals,3) == 0 )
then
369 call logerror(
"Number of values for report interval must be 1 or multiple of 3"// charvar)
373 call loginfo(
"Output will be written")
376 write(
logmessage,
"(A,I5,A,I5)")
" every year from ",&
379 write(
logmessage,
"(A,I4,A,I5,A,I5)")
" every ",
reportintervals(i,1),
" years from ",&
384 call loginfo(
" every year for all other years")
475 INTEGER :: err, nvals
476 INTEGER :: repInts(30)
478 character(len=:),
allocatable :: dummy
479 character(len=:),
allocatable :: rest
500 call execute_command_line (
'mkdir '//
'"'//
resultpath//
'"', exitstat=err)
501 call execute_command_line (
'mkdir '//
'"'//
resultpath_h//
'"' , exitstat=err)
502 call execute_command_line (
'mkdir '//
'"'//
statepath//
'"' , exitstat=err)
513 write(
controlparsout_file%unit,
"("//format_character//
",A)", iostat=err) dummy,
" Simulation ====="
535 call loginfo(
"inoculation time set to 0, because simulation starts from initial values")
539 call logerror(
"inoculation time is zero and no initial values => no trees. Set it to >=1");
subroutine inttochar(ndigits, intvalue, charvar)
IntToChar
subroutine readcontrolpars()
ReadControlPars
character(len=:), allocatable experimentid
integer, dimension(10, 3) reportintervals
logical withseedantagonists
logical dispersaldifferent
real, dimension(nalloweddrivernames) driverdefault
character(len=:), allocatable bioclimfilename
character(len=:), allocatable e
character(len=:), allocatable specfilename
integer, dimension(10) stateoutputyears
character(len=:), allocatable boundaries
character(len=:), allocatable immifilename
integer, allocatable, parameter immigration
character(len=:), allocatable statepath
character(len=:), allocatable resultpath
type(file) controlpars_file
character(len=:), allocatable resultpath_h
type(file) controlparsout_file
subroutine loginfo(msg)
LogInfo
character(len=1024) logmessage
subroutine logerror(msg)
LogError
subroutine assignreportintervals(nvals, repints)
AssignReportIntervals
subroutine rwchar(outchar)
RWChar
subroutine rwreal(outreal)
RWReal
subroutine readwriteseveralvaluessametypefromline(nvals, err, vec_integer, vec_real, vec_char, vec_logical)
ReadWriteSeveralValuesSameTypeFromLine
subroutine checkwriteerror(err)
CheckWriteError
subroutine checkreaderror(err)
CheckReadError
subroutine readseveralvaluessametypefromline(nvals, rest, err, vec_integer, vec_real, vec_char, vec_logical)
ReadSeveralValuesSameTypeFromLine
subroutine rwlogical(outlogical)
subroutine rwinteger(outint)
RWInteger