36 real, dimension(:),
pointer :: minValues
37 real, dimension(:),
pointer :: maxValues
47 integer, dimension(:),
pointer :: minValues
48 integer, dimension(:),
pointer :: maxValues
59 & dimension(:),pointer :: validValues
76 integer :: n_real
=0, n_int
=0, n_str
=0, n_log
=0
137 context
%real_list
=> NULL()
138 context
%int_list
=> NULL()
139 context
%str_list
=> NULL()
140 context
%log_list
=> NULL()
165 character(len
=*),
intent(in) :: name
166 integer,
intent(out) :: name_type
181 if (
associated(real_test)) name_type
= name_real
182 if (
associated(int_test)) name_type
= name_int
183 if (
associated(str_test)) name_type
= name_str
184 if (
associated(log_test)) name_type
= name_log
209 character(len
=*),
intent(in) :: name
210 character(
len=len(name)) :: name_lcase
215 result => context
%real_list
216 do while (
associated(result))
217 if (result
%name
== name_lcase)
then
220 result => result
%next
231 character(len
=*),
intent(in) :: name
232 character(
len=len(name)) :: name_lcase
236 result => context
%int_list
237 do while (
associated(result))
238 if (result
%name
== name_lcase)
exit
239 result => result
%next
250 character(len
=*),
intent(in) :: name
251 character(
len=len(name)) :: name_lcase
255 result => context
%str_list
256 do while (
associated(result))
257 if (result
%name
== name_lcase)
exit
258 result => result
%next
269 character(len
=*),
intent(in) :: name
270 character(
len=len(name)) :: name_lcase
275 result => context
%log_list
276 do while (
associated(result))
277 if (result
%name
== name_lcase)
exit
278 result => result
%next
305 character(len
=*),
intent(in) :: name
306 real,
intent(in) :: value
307 integer,
intent(in) :: state
308 integer :: istat, name_type
314 call getType(context, name, name_type)
322 allocate (node,
stat=istat)
324 write (
*,
*)
'add : could not allocate'
328 node
%initValue
= value
329 node
%isConstant
= .false.
331 nullify(node
%minValues)
332 nullify(node
%maxValues)
338 node
%isConstant
= .true.
344 if (
.not. associated(context
%real_list))
then
345 context
%real_list
=> node
347 this
=> context
%real_list
348 do while (
associated(this
%next))
353 context
%n_real
= context
%n_real
+ 1
364 character(len
=*),
intent(in) :: name
365 integer,
intent(in) :: value
366 integer,
intent(in) :: state
367 integer :: istat, name_type
374 call getType(context, name, name_type)
382 allocate (node,
stat=istat)
384 write (
*,
*)
'add : could not allocate'
389 node
%initValue
= value
390 node
%isConstant
= .false.
392 nullify(node
%minValues)
393 nullify(node
%maxValues)
396 node
%isConstant
= .true.
401 if (
.not. associated(context
%int_list))
then
402 context
%int_list
=> node
404 this
=> context
%int_list
405 do while (
associated(this
%next))
410 context
%n_int
= context
%n_int
+ 1
421 character(len
=*),
intent(in) :: name, value
422 integer,
intent(in) :: state
423 integer :: istat, name_type
429 call getType(context, name, name_type)
437 allocate (node,
stat=istat)
439 write (
*,
*)
'add : could not allocate'
443 node
%initValue
= value
444 node
%isConstant
= .false.
446 nullify(node
%validValues)
449 node
%isConstant
= .true.
455 if (
.not. associated(context
%str_list))
then
456 context
%str_list
=> node
458 this
=> context
%str_list
459 do while (
associated(this
%next))
464 context
%n_str
= context
%n_str
+ 1
477 character(len
=*),
intent(in) :: name
478 logical,
intent(in) :: value
479 integer,
intent(in) :: state
480 integer :: istat, name_type
487 call getType(context, name, name_type)
495 allocate (node,
stat=istat)
497 write (
*,
*)
'add : could not allocate'
501 node
%initValue
= value
502 node
%isConstant
= .false.
505 node
%isConstant
= .true.
511 if (
.not. associated(context
%log_list))
then
512 context
%log_list
=> node
514 this
=> context
%log_list
515 do while (
associated(this
%next))
520 context
%n_log
= context
%n_log
+ 1
550 real,
intent(in) :: value
551 logical,
intent(out) :: valid
553 real,
parameter :: epsilon
= TINY(
1.0)
556 if (
associated(node))
then
557 if (node
%numValues
== 0)
then
559 else if (
.NOT. node
%isConstant)
then
560 do ctr
= 1, node
%numValues
561 if ((node
%minValues(ctr)
.le. value
+epsilon)
.and. (value
-epsilon
.le. node
%maxValues(ctr)))
then
568 call Driver_abort(
"nameValue_checkReal: invalid node given")
594 integer,
intent(in) :: value
595 logical,
intent(out) :: valid
599 if (
associated(node))
then
600 if (node
%numValues
== 0)
then
602 else if (
.NOT. node
%isConstant)
then
603 do ctr
= 1, node
%numValues
604 if ( (node
%minValues(ctr)
.le. value)
.and. (value
.le. node
%maxValues(ctr)) )
then
611 call Driver_abort(
"nameValue_checkAdd: invalid node given")
635#include "constants.h"
640 character(len
=*),
intent(in) :: value
641 character(
len=MAX_STRING_LENGTH) :: lcase
642 logical,
intent(out) :: valid
648 if (
associated(node))
then
649 if (node
%numValues
== 0)
then
651 else if (
.NOT. node
%isConstant)
then
652 do ctr
= 1, node
%numValues
653 if (
trim(node
%validValues(ctr))
== trim(lcase))
then
660 call Driver_abort(
"nameValue_checkStr: invalid node given")
#define MAX_STRING_LENGTH
subroutine makeLowercase(str)
subroutine nameValueLL_addReal(context, name, value, state)
subroutine nameValueLL_checkReal(node, value, valid)
integer, parameter name_invalid
subroutine nameValueLL_findInt(context, name, result)
integer, parameter TYPE_VAR
subroutine nameValueLL_checkStr(node, value, valid)
subroutine nameValueLL_addLog(context, name, value, state)
integer, parameter name_log
subroutine nameValueLL_findStr(context, name, result)
subroutine nameValueLL_addStr(context, name, value, state)
subroutine initContext(context)
integer, parameter NUM_MAX_RULES
subroutine nameValueLL_addInt(context, name, value, state)
integer, parameter name_int
integer, parameter name_real
integer, parameter TYPE_CONST
subroutine nameValueLL_checkInt(node, value, valid)
subroutine nameValueLL_findLog(context, name, result)
subroutine nameValueLL_findReal(context, name, result)
subroutine getType(context, name, name_type)
integer, parameter name_str