FLASH-X
Doxygen Generated Documentation From Interface Source Code
nameValueLL_get.F90
Go to the documentation of this file.
1!! NOTICE
2!! Copyright 2022 UChicago Argonne, LLC and contributors
3!!
4!! Licensed under the Apache License, Version 2.0 (the "License");
5!! you may not use this file except in compliance with the License.
6!!
7!! Unless required by applicable law or agreed to in writing, software
8!! distributed under the License is distributed on an "AS IS" BASIS,
9!! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10!! See the License for the specific language governing permissions and
11!! limitations under the License.
12!!
38
39
40subroutine nameValueLL_getReal (context, name, value, current_val, error)
41
42 use nameValueLL_data !, ONLY: context_type, nameValueLL_find, &
43 ! & name_invalid, name_real, name_int, name_str, name_log, &
44 ! & real_list_type, int_list_type, str_list_type, log_list_type
46 use Logfile_interface, ONLY : Logfile_stampMessage
47
48#include "constants.h"
49#include "Flashx_mpi_implicitNone.fh"
50
51 type (context_type),intent(in) :: context
52 character(len=*), intent(in) :: name
53 real, intent(inout) :: value
54 logical, intent(in) :: current_val
55 type (real_list_type), pointer :: node
56 character(len=MAX_STRING_LENGTH) :: buff1, buff2
57 integer, intent(out) :: error
58 integer :: myPE, ierr
59
60 call MPI_comm_rank(MPI_COMM_WORLD, myPE, ierr)
61
62 error = 0
63
64 call nameValueLL_find(context, name, node)
65
66 if (associated(node)) then
67 if (current_val) then
68 value = node%value
69 else if(.NOT. current_val) then
70 value = node%initValue
71 else
72
73 call Driver_abort("nameValueLL_getReal: logical value current_val has improper value")
74 end if
75 else
76 buff1 = "WARNING: requested real parameter '" // trim(name) // "' not found"
77 call Logfile_stampMessage(buff1)
78 if (myPE == MASTER_PE) print *,buff1
79 error = NOTFOUND
80 !call Driver_abort(buff1)
81 endif
82
83 return
84
85end subroutine nameValueLL_getReal
86
87
88
89subroutine nameValueLL_getInt (context, name, value, current_val, error)
90
91 use nameValueLL_data !, ONLY: context_type, nameValueLL_find, &
92 ! & name_invalid, name_real, name_int, name_str, name_log, &
93 ! & real_list_type, int_list_type, str_list_type, log_list_type
95 use Logfile_interface, ONLY : Logfile_stampMessage
96
97#include "constants.h"
98#include "Flashx_mpi_implicitNone.fh"
99
100 type (context_type),intent(in) :: context
101 character(len=*), intent(in) :: name
102 integer, intent(inout) :: value
103 logical, intent(in) :: current_val
104 type (int_list_type), pointer :: node
105 character(len=MAX_STRING_LENGTH) :: buff1, buff2
106 integer, intent(out) :: error
107
108 integer :: myPE, ierr
109
110 call MPI_comm_rank(MPI_COMM_WORLD, myPE, ierr)
111
112 error = NORMAL
113
114 call nameValueLL_find(context, name, node)
115 if (associated(node)) then
116 if (current_val) then
117 value = node%value
118 else if(.NOT. current_val) then
119 value = node%initValue
120 else
121 call Driver_abort("nameValueLL_getInt: logical value current_val has improper value")
122 end if
123 else
124 buff1 = "WARNING: requested integer parameter '" // trim(name) // "' not found"
125 call Logfile_stampMessage(buff1)
126 if(myPE == MASTER_PE) print *, buff1
127 error = NOTFOUND
128 !call Driver_abort(buff1)
129 endif
130
131 return
132
133end subroutine nameValueLL_getInt
134
135
136subroutine nameValueLL_getStr (context, name, value, current_val, error)
137
138 use nameValueLL_data !, ONLY: context_type, nameValueLL_find, &
139 ! & name_invalid, name_real, name_int, name_str, name_log, &
140 ! & real_list_type, int_list_type, str_list_type, log_list_type
142 use Logfile_interface, ONLY : Logfile_stampMessage
143
144#include "constants.h"
145#include "Flashx_mpi_implicitNone.fh"
146
147 type (context_type),intent(in) :: context
148 character(len=*),intent(in) :: name
149 character(len=*),intent(inout) :: value
150 logical, intent(in) :: current_val
151 type (str_list_type), pointer :: node
152 character(len=MAX_STRING_LENGTH) :: buff1, buff2
153 integer, intent(out) :: error
154 integer :: myPE, ierr
155
156 call MPI_comm_rank(MPI_COMM_WORLD, myPE, ierr)
157
158 error = NORMAL
159
160 call nameValueLL_find(context, name, node)
161 if (associated(node)) then
162 if (current_val) then
163 value = node%value
164 else if(.NOT. current_val) then
165 value = node%initValue
166 else
167 call Driver_abort("nameValueLL_getStr: logical value current_val has improper value")
168 end if
169 else
170 buff1 = "WARNING: requested string parameter '" // trim(name) // "' not found"
171 call Logfile_stampMessage(buff1)
172 if(myPE == MASTER_PE) print *, buff1
173 error = NOTFOUND
174 !call Driver_abort(buff1)
175 endif
176
177 return
178
179end subroutine nameValueLL_getStr
180
181
182
183
184
185
186subroutine nameValueLL_getLog (context, name, value, current_val, error)
187
188 use nameValueLL_data !, ONLY: context_type, nameValueLL_find, &
189 ! & name_invalid, name_real, name_int, name_str, name_log, &
190 ! & real_list_type, int_list_type, str_list_type, log_list_type
192 use Logfile_interface, ONLY : Logfile_stampMessage
193
194#include "constants.h"
195#include "Flashx_mpi_implicitNone.fh"
196
197 type (context_type),intent(in) :: context
198 character(len=*),intent(in) :: name
199 logical,intent(inout) :: value
200 logical, intent(in) :: current_val
201 type (log_list_type), pointer :: node
202 character(len=MAX_STRING_LENGTH) :: buff1, buff2
203 integer, intent(out) :: error
204 integer :: myPE, ierr
205
206 call MPI_comm_rank(MPI_COMM_WORLD, myPE, ierr)
207
208 error = 0
209
210
211 call nameValueLL_find(context, name, node)
212 if (associated(node)) then
213 if (current_val) then
214 value = node%value
215 else if(.NOT. current_val) then
216 value = node%initValue
217 else
218 call Driver_abort("nameValueLL_getLog: logical value current_val has improper value")
219 end if
220 else
221 buff1 = "WARNING: requested logical parameter '" // trim(name) // "' not found"
222 call Logfile_stampMessage(buff1)
223 if(myPE == MASTER_PE) print *, buff1
224 error = NOTFOUND
225 !call Driver_abort(buff1)
226 endif
227
228 return
229end subroutine nameValueLL_getLog
230
231
232
#define NORMAL
Definition: constants.h:456
#define MASTER_PE
Definition: constants.h:6
#define NOTFOUND
Definition: constants.h:457
subroutine nameValueLL_getInt(context, name, value, current_val, error)
subroutine nameValueLL_getLog(context, name, value, current_val, error)
subroutine nameValueLL_getReal(context, name, value, current_val, error)
subroutine nameValueLL_getStr(context, name, value, current_val, error)