My Project
Public Member Functions | List of all members
input_util::get_val Interface Reference

Public Member Functions

subroutine get_float_val (fval, filename, argname, line, echo, start, finish)
 
subroutine get_string_val (sval, filename, argname, line, echo, start, finish)
 
subroutine get_logical_val (lval, filename, argname, line, echo, start, finish)
 
subroutine get_integer_val (ival, filename, argname, line, echo, start, finish)
 

Detailed Description

Definition at line 43 of file mod_newinp.f90.

Member Function/Subroutine Documentation

◆ get_float_val()

subroutine input_util::get_val::get_float_val ( real(sp), intent(out)  fval,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  argname,
integer, intent(out)  line,
logical, intent(in), optional  echo,
integer, intent(in), optional  start,
integer, intent(in), optional  finish 
)

Definition at line 125 of file mod_newinp.f90.

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 

◆ get_integer_val()

subroutine input_util::get_val::get_integer_val ( integer, intent(out)  ival,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  argname,
integer, intent(out)  line,
logical, intent(in), optional  echo,
integer, intent(in), optional  start,
integer, intent(in), optional  finish 
)

Definition at line 67 of file mod_newinp.f90.

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 

◆ get_logical_val()

subroutine input_util::get_val::get_logical_val ( logical, intent(out)  lval,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  argname,
integer, intent(out)  line,
logical, intent(in), optional  echo,
integer, intent(in), optional  start,
integer, intent(in), optional  finish 
)

Definition at line 185 of file mod_newinp.f90.

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 

◆ get_string_val()

subroutine input_util::get_val::get_string_val ( character(len=*), intent(out)  sval,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  argname,
integer, intent(out)  line,
logical, intent(in), optional  echo,
integer, intent(in), optional  start,
integer, intent(in), optional  finish 
)

Definition at line 244 of file mod_newinp.f90.

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

The documentation for this interface was generated from the following file: