36 use,
intrinsic :: iso_fortran_env, only: error_unit, output_unit
56 character(len=*),
intent(in) :: fname
58 suffix_pos = scan(trim(fname),
'.', back = .true.)
63 character(len=*),
intent(in) :: fname
65 tslash_pos = scan(trim(fname),
'/', back = .true.)
70 character(len=*) :: fname
71 character(len=*) :: suffix
77 character(len=*) :: fname
78 character(len=*) :: new_fname
79 character(len=*) :: new_suffix
83 new_fname = trim(fname(1:suffix_pos))//new_suffix
94 character(len=*),
intent(in) :: fld_filename
95 integer,
intent(in) :: default_index
97 character(len=80) :: suffix
98 integer :: index, fpos, i
107 index = default_index
112 fpos = scan(trim(suffix),
'f')
113 if (fpos .eq. 1)
then
115 do i = 2, len(trim(suffix))
116 if (.not. (iachar(suffix(i:i)) >= iachar(
'0') &
117 .and. iachar(suffix(i:i)) <= iachar(
'9')))
then
126 if (len(trim(suffix)) .ne. 6) valid = .false.
128 if (valid)
read (suffix(2:),
"(I5.5)") index
136 character(len=*) :: string
137 character(len=*) :: delimiter
138 character(len=100),
allocatable :: split_str(:)
139 integer :: length, i, i2, offset, j
143 if (len(trim(string)) .eq. 0)
then
144 allocate(split_str(1))
145 split_str(1) = trim(string)
149 i = scan(string(offset:), delimiter, back = .false.)
155 allocate(split_str(length))
160 i2 = scan(trim(string(offset:)), delimiter, back = .false.)
162 split_str(j) = trim(string(offset:))
165 split_str(j) = trim(string(offset:offset+i2-2))
174 integer,
intent(in) :: i, j, k, l, lx, ly, lz
177 index = (i + lx * ((j - 1) + ly * ((k - 1) + lz * ((l - 1)))))
187 index(4) = lin_idx/(lx*ly*lz)
188 index(3) = (lin_idx-(lx*ly*lz)*index(4))/(lx*ly)
189 index(2) = (lin_idx-(lx*ly*lz)*index(4)-(lx*ly)*index(3))/lx
190 index(1) = (lin_idx-(lx*ly*lz)*index(4)-(lx*ly)*index(3)-lx*index(2))
191 index(1) = index(1) + 1
192 index(2) = index(2) + 1
193 index(3) = index(3) + 1
194 index(4) = index(4) + 1
199 integer,
intent(in) :: i, j, k, lx, ly, lz, facet
205 if (i .eq. 1) is_on = .true.
207 if (i .eq. lx) is_on = .true.
209 if (j .eq. 1) is_on = .true.
211 if (j .eq. ly) is_on = .true.
213 if (k .eq. 1) is_on = .true.
215 if (k .eq. lz) is_on = .true.
223 integer,
optional :: error_code
225 if (
present(error_code))
then
226 write(error_unit, *)
'*** ERROR ***', error_code
229 write(error_unit, *)
'*** ERROR ***'
238 character(len=*) :: error_msg
239 write(error_unit, *)
'*** ERROR: ', error_msg,
' ***'
245 character(len=*) :: warning_msg
246 write(output_unit, *)
'*** WARNING: ', warning_msg,
' ***'
255 character(len=*),
intent(in) :: array(:)
256 character(len=*),
intent(in) :: sep
257 logical,
intent(in) :: prepend
258 character(:),
allocatable :: result
261 result = trim(array(1))
262 do i = 2,
size(array)
263 result = result // sep // trim(array(i))
266 if (prepend .eqv. .true.)
then
267 result = sep // result
__device__ void nonlinear_index(const int idx, const int lx, int *index)
integer function, public extract_fld_file_index(fld_filename, default_index)
Extracts the index of a field file. For example, "myfield.f00045" will return 45. If the suffix of th...
character(:) function, allocatable, public concat_string_array(array, sep, prepend)
Concatenate an array of strings into one string with array items separated by spaces.
character(len=100) function, dimension(:), allocatable, public split_string(string, delimiter)
Split a string based on delimiter (tokenizer) OBS: very hacky, this should really be improved,...
pure logical function, public index_is_on_facet(i, j, k, lx, ly, lz, facet)
subroutine neko_error_msg(error_msg)
Reports an error and stops execution.
pure integer function, public linear_index(i, j, k, l, lx, ly, lz)
Compute the address of a (i,j,k,l) array with sizes (1:lx, 1:ly, 1:lz, :)
integer, parameter, public neko_fname_len
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
subroutine, public filename_chsuffix(fname, new_fname, new_suffix)
Change a filename's suffix.
subroutine, public filename_suffix(fname, suffix)
Extract a filename's suffix.
pure integer function, public filename_tslash_pos(fname)
Find position (in the string) of a filename's trailing slash.
subroutine neko_error_plain(error_code)
Reports an error and stops execution.
pure integer function, public filename_suffix_pos(fname)
Find position (in the string) of a filename's suffix.