My Project
mod_newinp.f90
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 !=======================================================================
13 ! OSCAR Input Utility Module
14 !
15 ! Copyright: 2005(c)
16 !
17 ! THIS IS A DEMONSTRATION RELEASE. THE AUTHOR(S) MAKE NO REPRESENTATION
18 ! ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY OTHER PURPOSE. IT IS
19 ! PROVIDED "AS IS" WITHOUT EXPRESSED OR IMPLIED WARRANTY.
20 !
21 ! THIS ORIGINAL HEADER MUST BE MAINTAINED IN ALL DISTRIBUTED VERSIONS
22 !
23 ! Authors: G. Cowles
24 ! School for Marine Science and Technology
25 ! University of Massachusetts-Dartmouth
26 !
27 ! Comments: OSCAR Input Module
28 !=======================================================================
29 
30 Module input_util
31 
32 Use mod_prec
33 Use mod_utils
34 Implicit None
35 
36 character(len=1), parameter :: com_char = '!'
37 
38 
39 
40 !----------------------------------------
41 ! interface definition: Overload Get_Val
42 !----------------------------------------
43 Interface get_val
44  Module Procedure get_float_val
45  Module Procedure get_string_val
46  Module Procedure get_logical_val
47  Module Procedure get_integer_val
48 End Interface
49 
50 Interface get_val_array
51  Module Procedure get_float_val_array
52  Module Procedure get_string_val_array
53  Module Procedure get_logical_val_array
54  Module Procedure get_integer_val_array
55 End Interface
56 
57 !----------------------------------------
58 ! functions
59 !----------------------------------------
60 
61 contains
62 
63  !---------------------------------------------------------------------
64  !Get_Integer_Val -> Return Integer Value
65  !---------------------------------------------------------------------
66  Subroutine get_integer_val(ival,filename,argname,line,echo,start,finish)
67  implicit none
68  integer, intent(out) :: ival
69  character(len=*), intent(in ) :: filename
70  character(len=*), intent(in ) :: argname
71  integer, intent(out) :: line
72  logical, optional,intent(in) :: echo
73  integer, optional,intent(in) :: start
74  integer, optional,intent(in) :: finish
75 
76  character(len=80) :: argval
77  character(len=80) :: argtype
78  integer :: ierr
79 
80  !make sure file exists
81  if(.not.check_exist(filename))then
82  call error('Get_Val','halt','error reading: '//trim(argname), &
83  'file: '//trim(filename)//' does not exist')
84  endif
85 
86  !check start and finish lines
87  if(present(start) .and. present(finish))then
88  if(finish < start)then
89  call error('Get_Val','halt','finish must be greater than or equal to start')
90  endif
91  endif
92 
93  !parse file for argument line
94  call extract_val_string(filename,argname,argval,ierr,line,start,finish)
95  if(ierr == 1)then
96  call error('Get_Val','halt','error reading variable: '//trim(argname), &
97  'does not exist in file: '//trim(filename))
98  endif
99 
100  !check argument type
101  call check_arg_type(argval,argtype)
102  if(trim(argtype) /= 'integer')then
103  call error('Get_Val','halt','error reading variable: '//trim(argname), &
104  'in file: '//trim(filename), &
105  'should be integer but is: '//trim(argtype))
106  endif
107 
108  ! set return value
109  read(argval,*)ival
110 
111  ! echo to screen
112  if(present(echo))then
113  if(echo)then
114  write(*,'(A20,I10)')trim(argname)//': ',ival
115  endif
116  endif
117 
118  End Subroutine get_integer_val
119 
120 
121  !---------------------------------------------------------------------
122  !Get_Float_Val -> Return Float
123  !---------------------------------------------------------------------
124  Subroutine get_float_val(fval,filename,argname,line,echo,start,finish)
125  implicit none
126  real(sp), intent(out) :: fval
127  character(len=*), intent(in ) :: filename
128  character(len=*), intent(in ) :: argname
129  integer, intent(out) :: line
130  logical, optional,intent(in) :: echo
131  integer, optional,intent(in) :: start
132  integer, optional,intent(in) :: finish
133 
134  character(len=80) :: argval
135  character(len=80) :: argtype
136  integer :: ierr
137 
138 
139  !make sure file exists
140  if(.not.check_exist(filename))then
141  call error('Get_Val','halt','error reading: '//trim(argname), &
142  'file: '//trim(filename)//' does not exist')
143  endif
144 
145  !check start and finish lines
146  if(present(start) .and. present(finish))then
147  if(finish < start)then
148  call error('Get_Val','halt','finish must be greater than or equal to start')
149  endif
150  endif
151 
152  !parse file for argument line
153  call extract_val_string(filename,argname,argval,ierr,line,start,finish)
154  if(ierr == 1)then
155  call error('Get_Val','halt','error reading variable: '//trim(argname), &
156  'does not exist in file: '//trim(filename))
157  endif
158 
159  !check argument type
160  call check_arg_type(argval,argtype)
161  if(trim(argtype) /= 'float')then
162  call error('Get_Val','halt','error reading variable: '//trim(argname), &
163  'in file: '//trim(filename), &
164  'should be float but is: '//trim(argtype))
165  endif
166 
167  ! set return value
168  read(argval,*)fval
169 
170  ! echo to screen
171  if(present(echo))then
172  if(echo)then
173  write(*,'(A20,F10.4)')trim(argname)//': ',fval
174  endif
175  end if
176 
177 
178  End Subroutine get_float_val
179 
180 
181  !---------------------------------------------------------------------
182  !Get_Logical_Val -> Return Logical
183  !---------------------------------------------------------------------
184  Subroutine get_logical_val(lval,filename,argname,line,echo,start,finish)
185  implicit none
186  logical, intent(out) :: lval
187  character(len=*), intent(in ) :: filename
188  character(len=*), intent(in ) :: argname
189  integer, intent(out) :: line
190  logical, optional,intent(in) :: echo
191  integer, optional,intent(in) :: start
192  integer, optional,intent(in) :: finish
193 
194  character(len=80) :: argval
195  character(len=80) :: argtype
196  integer :: ierr
197 
198  !make sure file exists
199  if(.not.check_exist(filename))then
200  call error('Get_Val','halt','error reading: '//trim(argname), &
201  'file: '//trim(filename)//' does not exist')
202  endif
203 
204  !check start and finish lines
205  if(present(start) .and. present(finish))then
206  if(finish < start)then
207  call error('Get_Val','halt','finish must be greater than or equal to start')
208  endif
209  endif
210 
211  !parse file for argument line
212  call extract_val_string(filename,argname,argval,ierr,line,start,finish)
213  if(ierr == 1)then
214  call error('Get_Val','halt','error reading variable: '//trim(argname), &
215  'does not exist in file: '//trim(filename))
216  endif
217 
218  !check argument type
219  call check_arg_type(argval,argtype)
220  if(trim(argtype) /= 'logical')then
221  call error('Get_Val','halt','error reading variable: '//trim(argname), &
222  'in file: '//trim(filename), &
223  'should be logical but is: '//trim(argtype))
224  endif
225 
226  ! set return value
227  lval = .false.
228  if(argval(1:1) == 'T') lval = .true.
229 
230  ! echo to screen
231  if(present(echo))then
232  if(echo)then
233  write(*,'(A20,L10)')trim(argname)//': ',lval
234  endif
235  endif
236 
237  End Subroutine get_logical_val
238 
239 
240  !---------------------------------------------------------------------
241  !Get_String_Val -> Return String
242  !---------------------------------------------------------------------
243  Subroutine get_string_val(sval,filename,argname,line,echo,start,finish)
244  implicit none
245  character(len=*), intent(out) :: sval
246  character(len=*), intent(in ) :: filename
247  character(len=*), intent(in ) :: argname
248  integer, intent(out) :: line
249  logical, optional,intent(in) :: echo
250  integer, optional,intent(in) :: start
251  integer, optional,intent(in) :: finish
252 
253  character(len=80) :: argval
254  character(len=80) :: argtype
255  integer :: ierr
256 
257  !make sure file exists
258  if(.not.check_exist(filename))then
259  call error('Get_Val','halt','error reading: '//trim(argname), &
260  'file: '//trim(filename)//' does not exist')
261  endif
262 
263  !check start and finish lines
264  if(present(start) .and. present(finish))then
265  if(finish < start)then
266  call error('Get_Val','halt','finish must be greater than or equal to start')
267  endif
268  endif
269 
270  !parse file for argument line
271  call extract_val_string(filename,argname,argval,ierr,line,start,finish)
272  if(ierr == 1)then
273  call error('Get_Val','halt','error reading variable: '//trim(argname), &
274  'does not exist in file: '//trim(filename))
275  endif
276 
277  !check argument type
278  call check_arg_type(argval,argtype)
279  if(trim(argtype) /= 'string')then
280  call error('Get_Val','halt','error reading variable: '//trim(argname), &
281  'in file: '//trim(filename), &
282  'should be string but is: '//trim(argtype))
283  endif
284 
285  ! set return value
286  sval = adjustl(trim(argval))
287 
288  ! echo to screen
289  if(present(echo))then
290  if(echo)then
291  write(*,'(A20,A20)') trim(argname)//': ',trim(sval)
292  endif
293  endif
294  End Subroutine get_string_val
295 
296 
297  !---------------------------------------------------------------------
298  !Get_Float_Val_Array -> Return Float Array
299  !---------------------------------------------------------------------
300  Subroutine get_float_val_array(fval,filename,argname,size,echo)
301  implicit none
302 
303  character(len=*), intent(in ) :: filename
304  character(len=*), intent(in ) :: argname
305  integer,intent(in) :: SIZE
306  real(sp),dimension(size), intent(out) :: fval
307  logical, optional,intent(in) :: echo
308 
309 
310 
311  character(len=80) :: argval
312  character(len=80) :: argtype
313  integer :: ierr
314  integer :: iscan
315  integer :: ntemp
316  real(sp) :: ftemp
317  real(sp) :: REALVEC(150)
318 
319  if(dbg_set(dbg_sbr)) write(ipt,*) "Start:Get_Float_Val_Array "
320 
321  !make sure file exists
322  if(.not.check_exist(filename))then
323  call error('Get_Val','halt','error reading: '//trim(argname), &
324  'file: '//trim(filename)//' does not exist')
325  endif
326 
327  !read in
328  iscan = scan_file3(filename,argname,fvec = realvec,nsze = ntemp)
329  IF(iscan /= 0)THEN
330  WRITE(ipt,*)'ERROR READING: ',trim(argname),': ',iscan
331  call error('Get_Val','halt','error reading variable: '//trim(argname), &
332  'does not exist in file: '//trim(filename))
333  END IF
334 
335  IF(ntemp > size)THEN
336  WRITE(*,*)'EXPECTED SIZE:',SIZE
337  WRITE(*,*)'AND READ: ',realvec(1:ntemp)
338  call error('Get_Val','warning','warning reading variable: '//trim(argname), &
339  'number of specified size in : '//trim(filename)//' in not eq&
340  &ual to expected size,specified size is used in the model ')
341  ELSEIF(ntemp < size)THEN
342  WRITE(*,*)'EXPECTED SIZE:',SIZE
343  WRITE(*,*)'AND READ: ',realvec
344  call error('Get_Val','halt','error reading variable: '//trim(argname), &
345  'number of specified size in : '//trim(filename)//' in not eq&
346  &ual to expected size ')
347  END IF
348 
349  fval(1:size)= realvec(1:size)
350 
351  ! echo to screen
352  if(present(echo))then
353  if(echo)then
354  write(*,'(A20,<size>F10.4)')trim(argname)//': ',fval(1:size)
355  endif
356  end if
357 
358  if(dbg_set(dbg_sbr)) write(ipt,*) "End: Get_Float_Val_Array "
359 
360  End Subroutine get_float_val_array
361 
362 
363 
364 
365 
366  !---------------------------------------------------------------------
367  !Get_Float_Val_Array -> Return Float Array
368  !---------------------------------------------------------------------
369  Subroutine get_integer_val_array(ival,filename,argname,size,echo)
370  implicit none
371 
372  character(len=*), intent(in ) :: filename
373  character(len=*), intent(in ) :: argname
374  integer,intent(in) :: SIZE
375  integer,dimension(size), intent(out) :: ival
376  logical, optional,intent(in) :: echo
377 
378 
379 
380  character(len=80) :: argval
381  character(len=80) :: argtype
382  integer :: ierr
383  integer :: iscan
384  integer :: ntemp
385  real(sp) :: ftemp
386  real(sp) :: REALVEC(150)
387 
388  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: Get_Integer_Val_Array"
389 
390  !make sure file exists
391  if(.not.check_exist(filename))then
392  call error('Get_Val','halt','error reading: '//trim(argname), &
393  'file: '//trim(filename)//' does not exist')
394  endif
395 
396  !read in
397  iscan = scan_file3(filename,argname,fvec = realvec,nsze = ntemp)
398  IF(iscan /= 0)THEN
399  WRITE(ipt,*)'ERROR READING',trim(argname),': ',iscan
400  call error('Get_Val','halt','error reading variable: '//trim(argname), &
401  'does not exist in file: '//trim(filename))
402  END IF
403  print*,ntemp, size
404  IF(ntemp > size)THEN
405  WRITE(*,*)'EXPECTED SIZE:',SIZE
406  WRITE(*,*)'AND READ: ',realvec(1:ntemp)
407  call error('Get_Val','warning','warning reading variable: '//trim(argname), &
408  'number of specified size in : '//trim(filename)//' in not eq&
409  &ual to expected size,specified size is used in the model ')
410  ELSEIF(ntemp < size)THEN
411  WRITE(*,*)'EXPECTED SIZE:',SIZE
412  WRITE(*,*)'AND READ: ',realvec
413  call error('Get_Val','halt','error reading variable: '//trim(argname), &
414  'number of specified size in : '//trim(filename)//' in not eq&
415  &ual to expected size ')
416  END IF
417 
418  ival(1:size)= realvec(1:size)
419 
420  ! echo to screen
421  if(present(echo))then
422  if(echo)then
423  write(*,'(A20,<size>I10)')trim(argname)//': ',ival(1:size)
424  endif
425  end if
426 
427  if(dbg_set(dbg_sbr)) write(ipt,*) "End: Get_Integer_Val_Array"
428 
429  End Subroutine get_integer_val_array
430 
431 
432 
433 
434  !---------------------------------------------------------------------
435  !Get_Float_Val_Array -> Return Float Array
436  !---------------------------------------------------------------------
437  Subroutine get_logical_val_array(cval,filename,argname,size,echo)
438  implicit none
439 
440  character(len=*), intent(in ) :: filename
441  character(len=*), intent(in ) :: argname
442  integer,intent(in) :: SIZE
443  logical,dimension(size), intent(out) :: cval
444  logical, optional,intent(in) :: echo
445 
446 
447 
448  character(len=80) :: argval
449  character(len=80) :: argtype
450  integer :: ierr,i
451  integer :: iscan
452  integer :: ntemp
453  real(sp) :: ftemp
454  character(len=80), dimension(100):: CHARVEC
455 
456  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: Get_Logical_Val_Array"
457 
458  !make sure file exists
459  if(.not.check_exist(filename))then
460  call error('Get_Val','halt','error reading: '//trim(argname), &
461  'file: '//trim(filename)//' does not exist')
462  endif
463 
464  !read in
465  iscan = scan_file3(filename,argname,cvec = charvec,nsze = ntemp)
466  IF(iscan /= 0)THEN
467  WRITE(ipt,*)'ERROR READING:',trim(argname),': ',iscan
468  call error('Get_Val','halt','error reading variable: '//trim(argname), &
469  'does not exist in file: '//trim(filename))
470  END IF
471 
472  IF(ntemp > size)THEN
473  WRITE(*,*)'EXPECTED SIZE:',SIZE
474  WRITE(*,*)'AND READ: ',charvec(1:ntemp)
475  call error('Get_Val','warning','warning reading variable: '//trim(argname), &
476  'number of specified size in : '//trim(filename)//' in not eq&
477  &ual to expected size,specified size is used in the model ')
478  ELSEIF(ntemp < size)THEN
479  WRITE(*,*)'EXPECTED SIZE:',SIZE
480  WRITE(*,*)'AND READ: ',charvec
481  call error('Get_Val','halt','error reading variable: '//trim(argname), &
482  'number of specified size in : '//trim(filename)//' in not eq&
483  &ual to expected size ')
484  END IF
485 
486  do i=1,size
487  IF((trim(charvec(i))== "T" .OR. trim(charvec(i))=="F").and.(len(trim(charvec(i)))==1))THEN
488  if(trim(charvec(i)) == "T")cval(i)=.true.
489  if(trim(charvec(i)) == "F")cval(i)=.false.
490  end if
491  end do
492 
493  ! echo to screen
494  if(present(echo))then
495  if(echo)then
496  write(*,'(A20,<size>L10)')trim(argname)//': ',cval(1:size)
497  endif
498  end if
499 
500  if(dbg_set(dbg_sbr)) write(ipt,*) "End: Get_Logical_Val_Array"
501 
502  End Subroutine get_logical_val_array
503 
504 
505 
506 
507 
508 
509 
510 
511  !---------------------------------------------------------------------
512  !Get_String_Val_Array -> Return String Array
513  !---------------------------------------------------------------------
514  Subroutine get_string_val_array(sval,filename,argname,size,echo)
515  implicit none
516 
517  character(len=*), intent(in ) :: filename
518  character(len=*), intent(in ) :: argname
519  integer,intent(in) :: SIZE
520  character(len=*),dimension(size), intent(out) :: sval
521  logical, optional,intent(in) :: echo
522 
523 
524 
525  character(len=80) :: argval
526  character(len=80) :: argtype
527  integer :: ierr,i
528  integer :: iscan
529  integer :: ntemp
530  real(sp) :: ftemp
531  character(len=80), dimension(100):: CHARVEC
532 
533  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: Get_String_Val_Array"
534 
535  !make sure file exists
536  if(.not.check_exist(filename))then
537  call error('Get_Val','halt','error reading: '//trim(argname), &
538  'file: '//trim(filename)//' does not exist')
539  endif
540 
541  !read in
542  iscan = scan_file3(filename,argname,cvec = charvec,nsze = ntemp)
543  IF(iscan /= 0)THEN
544  WRITE(ipt,*)'ERROR READING:',trim(argname),': ',iscan
545  call error('Get_Val','halt','error reading variable: '//trim(argname), &
546  'does not exist in file: '//trim(filename))
547  END IF
548 
549  IF(ntemp > size)THEN
550  WRITE(*,*)'EXPECTED SIZE:',SIZE
551  WRITE(*,*)'AND READ: ',charvec(1:ntemp)
552  call error('Get_Val','warning','warning reading variable: '//trim(argname), &
553  'number of specified size in : '//trim(filename)//' in not eq&
554  &ual to expected size,specified size is used in the model ')
555  ELSEIF(ntemp < size)THEN
556  WRITE(*,*)'EXPECTED SIZE:',SIZE
557  WRITE(*,*)'AND READ: ',charvec
558  call error('Get_Val','halt','error reading variable: '//trim(argname), &
559  'number of specified size in : '//trim(filename)//' in not eq&
560  &ual to expected size ')
561  END IF
562 
563 
564  sval(1:size)= charvec(1:size)
565 
566  ! echo to screen
567  if(present(echo))then
568  if(echo)then
569  write(*,'(A20,<size>A10)')trim(argname)//': ',sval(1:size)
570  endif
571  end if
572 
573  if(dbg_set(dbg_sbr)) write(ipt,*) "End: Get_String_Val_Array"
574 
575  End Subroutine get_string_val_array
576 
577 
578 
579  !---------------------------------------------------------------------
580  !Extract_Val_String:
581  ! Parse Input File for Value String Assigned to Desired Variable
582  !---------------------------------------------------------------------
583  Subroutine extract_val_string(fname,argname,argval,ierr,line,start,finish)
584  implicit none
585  character(len=* ), intent(in ) :: fname
586  character(len=* ), intent(in ) :: argname
587  character(len=80), intent(out) :: argval
588  integer, intent(out) :: ierr
589  integer, intent(out) :: line
590  integer, optional, intent(in ) :: start
591  integer, optional, intent(in ) :: finish
592  !------------------------------------------
593  character(len=80) :: temp,temp2,text_line,inpline
594  integer :: locex,eqloc,length,i,linecnt
595 
596  ierr = 0
597  open(10,file=trim(fname)) ; rewind(10)
598 
599  linecnt = 0
600  !move forward to start line if present
601  if(present(start))then
602  do i=1,start-1
603  read(10,*)
604  linecnt = linecnt + 1
605  end do
606  endif
607 
608  do while(.true.)
609  read(10,'(A)',end=20) inpline
610  linecnt = linecnt + 1
611 
612  ! determine location of comment character and remove blanks
613  locex = index(inpline,com_char)
614  if(locex == 0)locex = len_trim(inpline)+1
615  temp = inpline(1:locex-1)
616  text_line = temp
617 
618  ! set line length
619  length = len_trim(text_line)
620 
621  ! ensure "=" exist and determine location
622  eqloc = index(text_line,"=")
623 
624 
625  ! split off variable name and value strings
626  temp2 = text_line(1:eqloc-1)
627  if(adjustl(trim(temp2)) == trim(argname))then
628  argval = adjustl(text_line(eqloc+1:length))
629  line = linecnt
630  close(10)
631  return
632  endif
633 
634  ! exit if finish is present
635  if(present(finish))then
636  if(linecnt==finish)exit
637  endif
638  end do
639 
640  ! not found, return error = 1
641  20 continue
642  ierr = 1
643  close(10)
644 
645  End Subroutine extract_val_string
646 
647  !---------------------------------------------------------------------
648  !check argument type (string,float,integer,logical)
649  !---------------------------------------------------------------------
650  Subroutine check_arg_type(argval,argtype)
651  implicit none
652  character(len=80), intent(out) :: argtype
653  character(len=80), intent(in ) :: argval
654 
655  character(len=16) :: numchars
656  integer :: largval
657  integer :: dotloc
658  integer :: i
659  numchars = "0123456789+-Ee. "
660 
661  ! argument length
662  largval = len_trim(adjustl(argval))
663 
664  ! check if logical
665  if(largval == 1)then
666  if(argval(1:1) == "T" .or. argval(1:1) == "F")then
667  argtype = 'logical'
668  return
669  endif
670  endif
671 
672  ! check if it is a string (contains characters other than 0-9,+,-,E,e,.)
673  do i=1,largval
674  if(index(numchars,argval(i:i)) == 0)then
675  argtype = "string"
676  return
677  endif
678  end do
679 
680  ! check if it is a float
681  dotloc = index(argval,".")
682  if(dotloc /= 0) then
683  argtype = "float"
684  else
685  argtype = "integer"
686  end if
687 
688  End Subroutine check_arg_type
689 
690 
691  !-------------------------------------------------------
692  !Error
693  !Write Error Message to Screen
694  !-------------------------------------------------------
695  Subroutine error(subname,errtype,err1,err2,err3)
696  character(len=*) :: subname
697  character(len=*) :: errtype
698  character(len=*) :: err1
699  character(len=*), optional :: err2
700  character(len=*), optional :: err3
701 
702  if(errtype == 'halt')then
703  write(*,*)
704  write(*,*)'FATAL ERROR in subroutine: ',trim(subname)
705  write(*,*)trim(err1)
706  if(present(err2)) write(*,*)trim(err2)
707  if(present(err2)) write(*,*)trim(err3)
708  stop
709  else if(errtype == 'warning')then
710  write(*,*)
711  write(*,*)'WARNING from subroutine: ',trim(subname)
712  write(*,*)trim(err1)
713  if(present(err2)) write(*,*)trim(err2)
714  if(present(err2)) write(*,*)trim(err3)
715  else
716  write(*,*)'incorrect usage of subroutine Error'
717  write(*,*)'called from subroutine: ',trim(subname)
718  write(*,*)'errtype must be halt or warning'
719  stop
720  endif
721 
722  End Subroutine error
723 
724  !-------------------------------------------------------
725  !Check_Exist
726  !Check for Existence of a File
727  !-------------------------------------------------------
728  Function check_exist(filein) Result(fexist)
729  implicit none
730  character(len=*) :: filein
731  logical fexist
732  inquire(exist=fexist,file=filein)
733  End Function check_exist
734 
735  !-------------------------------------------------------
736  !Check_Alloc
737  !Check For Successfull Allocation of Data
738  !-------------------------------------------------------
739  Subroutine check_alloc(errorin,dsize,varname,subname)
740  implicit none
741  integer, intent(in) :: errorin
742  integer, intent(in) :: dsize
743  character(len=*), intent(in) :: varname
744  character(len=*), intent(in) :: subname
745 
746  if(errorin /= 0)then
747  write(*,*)'insufficient space to allocate array: '//trim(varname)
748  write(*,*)'in subroutine: '//trim(subname)
749  write(*,*)'tried to allocate ',dsize,' units'
750  stop
751  endif
752 
753  End Subroutine check_alloc
754 
755 
756  !-------------------------------------------------------
757  !Check_IOError
758  !Check For Successfull R/W
759  !-------------------------------------------------------
760  Subroutine check_ioerror(errorin,filename,varname)
761  implicit none
762  integer, intent(in) :: errorin
763  character(len=*), intent(in) :: filename
764  character(len=*), intent(in) :: varname
765 
766  if(errorin /= 0)then
767  write(*,*)'failed read/write of: '//trim(varname)
768  write(*,*)'from file: '//trim(filename)
769  stop
770  endif
771 
772  End Subroutine check_ioerror
773 
774 End Module input_util
character(len=1), parameter com_char
Definition: mod_newinp.f90:36
subroutine get_float_val(fval, filename, argname, line, echo, start, finish)
Definition: mod_newinp.f90:125
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
subroutine check_alloc(errorin, dsize, varname, subname)
Definition: mod_newinp.f90:740
subroutine check_arg_type(argval, argtype)
Definition: mod_newinp.f90:651
subroutine get_string_val_array(sval, filename, argname, size, echo)
Definition: mod_newinp.f90:515
subroutine get_integer_val(ival, filename, argname, line, echo, start, finish)
Definition: mod_newinp.f90:67
logical function check_exist(filein)
Definition: mod_newinp.f90:729
subroutine get_integer_val_array(ival, filename, argname, size, echo)
Definition: mod_newinp.f90:370
integer function scan_file3(FNAME, VNAME, ISCAL, FSCAL, IVEC, FVEC, CVEC, NSZE, CVAL, LVAL)
Definition: mod_utils.f90:2488
subroutine error(subname, errtype, err1, err2, err3)
Definition: mod_newinp.f90:696
subroutine get_string_val(sval, filename, argname, line, echo, start, finish)
Definition: mod_newinp.f90:244
subroutine get_logical_val_array(cval, filename, argname, size, echo)
Definition: mod_newinp.f90:438
subroutine get_logical_val(lval, filename, argname, line, echo, start, finish)
Definition: mod_newinp.f90:185
subroutine check_ioerror(errorin, filename, varname)
Definition: mod_newinp.f90:761
integer, parameter dbg_sbr
Definition: mod_utils.f90:69
subroutine get_float_val_array(fval, filename, argname, size, echo)
Definition: mod_newinp.f90:301
subroutine extract_val_string(fname, argname, argval, ierr, line, start, finish)
Definition: mod_newinp.f90:584