5#include <PB3D_macros.h>
28 logical,
intent(in),
optional :: ind
31 character(len=11) :: empty_str =
''
32 character(len=max_str_ln) :: answer_str
38 if (
present(ind)) ind_loc = ind
42 write(*,
'(A)',advance=
'no') empty_str
44 write(*,
'(A)',advance=
'no')
'y(es)/n(o) [yes]: '
47 write(*,
'(A)',advance=
'no')
'y(es)/n(o) [no]: '
51 read (*,
'(A)') answer_str
54 select case (
strh2l(trim(answer_str)))
56 case (
'y',
'Y',
'yes',
'Yes',
'YEs',
'YES',
'yEs',
'yES',
'yeS',
'YeS')
58 case (
'n',
'N',
'no',
'No',
'NO',
'nO')
64 if (.not.ind_loc)
then
66 if (istat.ne.0)
call writo(
'In get_log, something went wrong. &
67 &Default used.',warning=.true.)
76 function get_real(lim_lo,lim_hi,ind)
result(val)
82 real(
dp),
intent(in),
optional :: lim_lo
83 real(
dp),
intent(in),
optional :: lim_hi
84 logical,
intent(in),
optional :: ind
87 character(len=11) :: empty_str =
''
90 real(
dp) :: lims_loc(2)
94 if (
present(ind)) ind_loc = ind
102 lims_loc = [-huge(1._dp),huge(1._dp)]
103 if (
present(lim_lo)) lims_loc(1) = lim_lo
104 if (
present(lim_hi)) lims_loc(2) = lim_hi
108 write(*,
'(A)',advance=
'no') empty_str
109 write(*,
'(A)',advance=
'no')
'Input a value'
110 if (
present(lim_lo).or.
present(lim_hi))
then
111 write(*,
'(A)',advance=
'no')
' ['
112 if (
present(lim_lo))
write(*,
'(A)',advance=
'no') &
114 write(*,
'(A)',advance=
'no')
'..'
115 if (
present(lim_hi))
write(*,
'(A)',advance=
'no') &
117 write(*,
'(A)',advance=
'no')
']'
119 write(*,
'(A)',advance=
'no')
': '
121 read (*,*,iostat=istat) val
124 if (istat.ne.0 .or. val.lt.lims_loc(1) .or. val.gt. &
126 write(*,
'(A)',advance=
'no') empty_str
127 write(*,
'(A)',advance=
'no')
'Choose a value between '//&
128 &trim(
r2strt(lims_loc(1)))//
' and '//&
129 &trim(
r2strt(lims_loc(2)))
139 if (.not.ind_loc)
then
141 if (istat.ne.0)
call writo(
'In get_real, something went &
142 &wrong. Default of zero used.',warning=.true.)
151 function get_int(lim_lo,lim_hi,ind)
result(val)
157 integer,
intent(in),
optional :: lim_lo
158 integer,
intent(in),
optional :: lim_hi
159 logical,
intent(in),
optional :: ind
162 character(len=11) :: empty_str =
''
165 integer :: lims_loc(2)
169 if (
present(ind)) ind_loc = ind
177 lims_loc = [-huge(1),huge(1)]
178 if (
present(lim_lo)) lims_loc(1) = lim_lo
179 if (
present(lim_hi)) lims_loc(2) = lim_hi
183 write(*,
'(A)',advance=
'no') empty_str
184 write(*,
'(A)',advance=
'no')
'Input a value'
185 if (
present(lim_lo).or.
present(lim_hi))
then
186 write(*,
'(A)',advance=
'no')
' ['
187 if (
present(lim_lo))
write(*,
'(A)',advance=
'no') &
189 write(*,
'(A)',advance=
'no')
'..'
190 if (
present(lim_hi))
write(*,
'(A)',advance=
'no') &
192 write(*,
'(A)',advance=
'no')
']'
194 write(*,
'(A)',advance=
'no')
': '
196 read (*,*,iostat=istat) val
199 if (istat.ne.0 .or. val.lt.lims_loc(1) .or. val.gt. &
201 write(*,
'(A)',advance=
'no') empty_str
202 write(*,
'(A)',advance=
'no')
'Choose a value between '//&
203 &trim(
i2str(lims_loc(1)))//
' and '//&
204 &trim(
i2str(lims_loc(2)))
214 if (.not.ind_loc)
then
216 if (istat.ne.0)
call writo(
'In get_int, something went &
217 &wrong. Default of zero used.',warning=.true.)
230 logical,
intent(in),
optional :: ind
233 character(len=11) :: empty_str =
''
236 character(len=max_str_ln) :: hidden_msg
240 write(*,
'(A)',advance=
'no') empty_str
241 write(*,
'(A)',advance=
'no')
'Paused. Press enter...'
246 if (
present(ind)) ind_loc = ind
251 read (*,
'(A)') hidden_msg
256 if (.not.ind_loc)
then
258 if (istat.ne.0)
call writo(
'In pause_prog, something went &
259 &wrong. Continuing.',warning=.true.)
263 if (trim(hidden_msg).eq.
'stop') stop 0
Wrapper function to broadcast a single variable using MPI.
Variables that have to do with HELENA quantities.
subroutine, public dealloc_hel
Deallocates HELENA quantities that are not used any more.
Numerical utilities related to giving output.
subroutine, public start_time()
Start a timer.
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
subroutine, public stop_time()
Stop a timer.
Numerical utilities related to MPI.
integer function, public wait_mpi()
Wait for all processes, wrapper to MPI barrier.
Numerical variables used by most other modules.
integer, parameter, public dp
double precision
integer, parameter, public max_str_ln
maximum length of strings
integer, public eq_style
either 1 (VMEC) or 2 (HELENA)
integer, public rank
MPI rank.
Operations concerning giving output, on the screen as well as in output files.
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
character(len(input_string)) function, public strh2l(input_string)
Convert a string to lowercase.
elemental character(len=max_str_ln) function, public r2strt(k)
Convert a real (double) to string.
Variables that concern the output of VMEC.
subroutine, public dealloc_vmec()
Deallocates VMEC quantities that are not used anymore.