91 #include "sll_errors.h"
92 #include "sll_memory.h"
93 #include "sll_working_precision.h"
116 character(len=256) :: choice
117 character(len=256) :: label
119 procedure, pass(self) :: init => init_nml_mesh_1d_cart
120 procedure, pass(self) :: init_1 => init_nml_mesh_1d_cart_1
121 procedure, pass(self) :: init_2 => init_nml_mesh_1d_cart_2
122 procedure, pass(self) :: init_3 => init_nml_mesh_1d_cart_3
123 procedure, pass(self) :: init_4 => init_nml_mesh_1d_cart_4
124 procedure, pass(self) :: init_clone => init_clone_nml_mesh_1d_cart
154 character(len=*),
intent(in) :: filename
155 sll_real64,
pointer,
intent(out) :: array(:)
156 character(len=*),
intent(in),
optional :: clone
157 sll_int32,
intent(in),
optional :: proc_id
160 character(len=256) :: err_msg
161 character(len=256) :: caller
163 if (
present(clone))
then
164 call self%init_clone(clone, filename, proc_id)
166 call self%init(filename, proc_id)
169 caller =
's_nml_mesh_1d_cart_array'
170 select case (self%choice)
190 err_msg =
'bad value for self%choice'
191 sll_error(trim(caller), trim(err_msg))
206 character(len=*),
intent(in) :: filename
207 character(len=*),
intent(in),
optional :: clone
208 sll_int32,
intent(in),
optional :: proc_id
211 sll_int32 :: proc_id_loc
213 if (
present(clone))
then
214 call self%init_clone(clone, filename, proc_id)
216 call self%init(filename, proc_id)
219 if (
present(proc_id))
then
220 proc_id_loc = proc_id
225 if (proc_id_loc == 0)
then
226 print *,
'#nml_mesh_1d_cart:'
228 print *,
'#label=', trim(self%label)
229 print *,
'#choice=', self%choice
234 #ifndef DOXYGEN_SHOULD_SKIP_THIS
236 subroutine init_clone_nml_mesh_1d_cart( &
242 character(len=*),
intent(in) :: clone
243 character(len=*),
intent(in) :: filename
244 sll_int32,
intent(in),
optional :: proc_id
246 character(len=256) :: err_msg
247 character(len=256) :: caller
249 caller =
'init_clone_nml_mesh_1d_cart'
252 call self%init_1(filename, proc_id)
254 call self%init_2(filename, proc_id)
256 call self%init_3(filename, proc_id)
258 call self%init_4(filename, proc_id)
260 err_msg =
'bad value for clone'
261 sll_error(trim(caller), trim(err_msg))
264 end subroutine init_clone_nml_mesh_1d_cart
266 subroutine init_nml_mesh_1d_cart( &
271 character(len=*),
intent(in) :: filename
272 sll_int32,
intent(in),
optional :: proc_id
274 sll_int32 :: namelist_id
277 character(len=256) :: err_msg
278 character(len=256) :: caller
279 character(len=256) :: choice
280 sll_int32 :: proc_id_loc
282 namelist /mesh_1d_cart/ &
284 caller =
'init_nml_mesh_1d_cart'
285 if (
present(proc_id))
then
286 proc_id_loc = proc_id
291 call set_default_values( &
297 file=trim(filename)//
'.nml', &
299 if (io_stat /= 0)
then
301 'failed to open first file '//trim(filename)//
'.nml'
302 sll_error(trim(caller), trim(err_msg))
305 read (namelist_id, mesh_1d_cart)
306 self%label =
"no_label"
310 end subroutine init_nml_mesh_1d_cart
312 subroutine init_nml_mesh_1d_cart_1( &
317 character(len=*),
intent(in) :: filename
318 sll_int32,
intent(in),
optional :: proc_id
320 sll_int32 :: namelist_id
323 character(len=256) :: err_msg
324 character(len=256) :: caller
325 character(len=256) :: choice_1
326 sll_int32 :: proc_id_loc
328 namelist /mesh_1d_cart_1/ &
331 caller =
'init_nml_mesh_1d_cart_1'
332 if (
present(proc_id))
then
333 proc_id_loc = proc_id
338 call set_default_values( &
344 file=trim(filename)//
'.nml', &
346 if (io_stat /= 0)
then
348 'failed to open first file '//trim(filename)//
'.nml'
349 sll_error(trim(caller), trim(err_msg))
352 read (namelist_id, mesh_1d_cart_1)
354 self%choice = choice_1
357 end subroutine init_nml_mesh_1d_cart_1
359 subroutine init_nml_mesh_1d_cart_2( &
364 character(len=*),
intent(in) :: filename
365 sll_int32,
intent(in),
optional :: proc_id
367 sll_int32 :: namelist_id
370 character(len=256) :: err_msg
371 character(len=256) :: caller
372 character(len=256) :: choice_2
373 sll_int32 :: proc_id_loc
375 namelist /mesh_1d_cart_2/ &
378 caller =
'init_nml_mesh_1d_cart_2'
379 if (
present(proc_id))
then
380 proc_id_loc = proc_id
385 call set_default_values( &
391 file=trim(filename)//
'.nml', &
393 if (io_stat /= 0)
then
395 'failed to open first file '//trim(filename)//
'.nml'
396 sll_error(trim(caller), trim(err_msg))
399 read (namelist_id, mesh_1d_cart_2)
401 self%choice = choice_2
404 end subroutine init_nml_mesh_1d_cart_2
406 subroutine init_nml_mesh_1d_cart_3( &
411 character(len=*),
intent(in) :: filename
412 sll_int32,
intent(in),
optional :: proc_id
414 sll_int32 :: namelist_id
417 character(len=256) :: err_msg
418 character(len=256) :: caller
419 character(len=256) :: choice_3
420 sll_int32 :: proc_id_loc
422 namelist /mesh_1d_cart_3/ &
425 caller =
'init_nml_mesh_1d_cart_3'
426 if (
present(proc_id))
then
427 proc_id_loc = proc_id
432 call set_default_values( &
438 file=trim(filename)//
'.nml', &
440 if (io_stat /= 0)
then
442 'failed to open first file '//trim(filename)//
'.nml'
443 sll_error(trim(caller), trim(err_msg))
446 read (namelist_id, mesh_1d_cart_3)
448 self%choice = choice_3
451 end subroutine init_nml_mesh_1d_cart_3
453 subroutine init_nml_mesh_1d_cart_4( &
458 character(len=*),
intent(in) :: filename
459 sll_int32,
intent(in),
optional :: proc_id
461 sll_int32 :: namelist_id
464 character(len=256) :: err_msg
465 character(len=256) :: caller
466 character(len=256) :: choice_4
467 sll_int32 :: proc_id_loc
469 namelist /mesh_1d_cart_4/ &
472 caller =
'init_nml_mesh_1d_cart_4'
473 if (
present(proc_id))
then
474 proc_id_loc = proc_id
479 call set_default_values( &
485 file=trim(filename)//
'.nml', &
487 if (io_stat /= 0)
then
489 'failed to open first file '//trim(filename)//
'.nml'
490 sll_error(trim(caller), trim(err_msg))
493 read (namelist_id, mesh_1d_cart_4)
495 self%choice = choice_4
498 end subroutine init_nml_mesh_1d_cart_4
500 subroutine set_default_values( &
502 character(len=256),
intent(inout) :: choice
506 end subroutine set_default_values
508 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
initialization of 1d cartesian mesh from namelist
subroutine s_nml_mesh_1d_cart_array(filename, array, clone, proc_id)
create 1d array from namelist
subroutine s_nml_mesh_1d_cart_print(filename, clone, proc_id)
print namelist info
initialization of 1d landau cartesian mesh from namelist
initialization of 1d two grid cartesian mesh from namelist
initialization of 1d uniform cartesian mesh from namelist
Some common numerical utilities.
subroutine, public sll_s_new_file_id(file_id, error)
Get a file unit number free before creating a file.