36 use,
intrinsic :: iso_fortran_env, only: error_unit, output_unit
57 character(len=*),
intent(in) :: fname
59 suffix_pos = scan(trim(fname),
'.', back = .true.)
64 character(len=*),
intent(in) :: fname
66 tslash_pos = scan(trim(fname),
'/', back = .true.)
71 character(len=*) :: fname
72 character(len=*) :: suffix
78 character(len=*) :: fname
79 character(len=*) :: new_fname
80 character(len=*) :: new_suffix
84 new_fname = trim(fname(1:suffix_pos))//new_suffix
95 character(len=*),
intent(in) :: fld_filename
96 integer,
intent(in) :: default_index
98 character(len=80) :: suffix
99 integer :: index, fpos, i
108 index = default_index
113 fpos = scan(trim(suffix),
'f')
114 if (fpos .eq. 1)
then
116 do i = 2, len(trim(suffix))
117 if (.not. (iachar(suffix(i:i)) >= iachar(
'0') &
118 .and. iachar(suffix(i:i)) <= iachar(
'9')))
then
127 if (len(trim(suffix)) .ne. 6) valid = .false.
129 if (valid)
read (suffix(2:),
"(I5.5)") index
137 character(len=*) :: string
138 character(len=*) :: delimiter
139 character(len=100),
allocatable :: split_str(:)
140 integer :: length, i, i2, offset, j
144 if (len(trim(string)) .eq. 0)
then
145 allocate(split_str(1))
146 split_str(1) = trim(string)
150 i = scan(string(offset:), delimiter, back = .false.)
156 allocate(split_str(length))
161 i2 = scan(trim(string(offset:)), delimiter, back = .false.)
163 split_str(j) = trim(string(offset:))
166 split_str(j) = trim(string(offset:offset+i2-2))
175 integer,
intent(in) :: i, j, k, l, lx, ly, lz
178 index = (i + lx * ((j - 1) + ly * ((k - 1) + lz * ((l - 1)))))
188 index(4) = lin_idx/(lx*ly*lz)
189 index(3) = (lin_idx-(lx*ly*lz)*index(4))/(lx*ly)
190 index(2) = (lin_idx-(lx*ly*lz)*index(4)-(lx*ly)*index(3))/lx
191 index(1) = (lin_idx-(lx*ly*lz)*index(4)-(lx*ly)*index(3)-lx*index(2))
192 index(1) = index(1) + 1
193 index(2) = index(2) + 1
194 index(3) = index(3) + 1
195 index(4) = index(4) + 1
200 integer,
intent(in) :: i, j, k, lx, ly, lz, facet
206 if (i .eq. 1) is_on = .true.
208 if (i .eq. lx) is_on = .true.
210 if (j .eq. 1) is_on = .true.
212 if (j .eq. ly) is_on = .true.
214 if (k .eq. 1) is_on = .true.
216 if (k .eq. lz) is_on = .true.
224 integer,
optional :: error_code
226 if (
present(error_code))
then
227 write(error_unit, *)
'*** ERROR ***', error_code
230 write(error_unit, *)
'*** ERROR ***'
239 character(len=*) :: error_msg
240 write(error_unit, *)
'*** ERROR: ', error_msg,
' ***'
251 character(len=*),
intent(in) :: base_type
252 character(len=*),
intent(in) :: wrong_type
253 character(len=*),
intent(in) :: known_types(:)
256 write(error_unit, *)
'*** ERROR WHEN SELECTING TYPE ***'
257 write(error_unit, *)
'Type ', wrong_type,
' does not exist for ', base_type
258 write(error_unit, *)
'Valid types are:'
259 do i = 1,
size(known_types)
260 write(error_unit, *)
" ", known_types(i)
266 character(len=*),
intent(in) :: base_type
267 character(len=*),
intent(in) :: wrong_type
268 logical,
intent(in) :: known
270 write(error_unit, *)
'*** ERROR WHEN REGISTERING TYPE ***'
271 write(error_unit, *)
'Type name ', wrong_type, &
272 ' conflicts with and already existing ', base_type,
" type"
274 write(error_unit, *)
'Please rename your custom type.'
276 write(error_unit, *)
'The already existing type is also custom.' // &
277 ' Make all custom type names unique!'
284 character(len=*) :: warning_msg
285 write(output_unit, *)
'*** WARNING: ', warning_msg,
' ***'
294 character(len=*),
intent(in) :: array(:)
295 character(len=*),
intent(in) :: sep
296 logical,
intent(in) :: prepend
297 character(:),
allocatable :: result
300 result = trim(array(1))
301 do i = 2,
size(array)
302 result = result // sep // trim(array(i))
305 if (prepend .eqv. .true.)
then
306 result = sep // result
__inline__ __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.
subroutine, public neko_type_registration_error(base_type, wrong_type, known)
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.
subroutine, public neko_type_error(base_type, wrong_type, known_types)
Reports an error allocating a type for a particular base pointer class.
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.