38 use mpi_f08,
only: mpi_bcast, mpi_logical
43 character(len=1024),
private :: fname
44 integer,
private :: counter = -1
45 integer,
private :: start_counter = 0
47 logical :: serial = .false.
48 logical :: overwrite = .false.
81 class(*),
target,
intent(in) :: data
82 real(kind=
rp),
intent(in),
optional :: t
90 class(*),
target,
intent(inout) :: data
100 character(len=*) :: fname
110 character(len=1024) :: fname
111 integer :: suffix_pos
112 character(len=5) :: id_str
114 if (this%counter .ne. -1)
then
116 write(id_str,
'(i5.5)') this%counter
117 fname = trim(this%fname(1:suffix_pos-1)) // id_str // &
118 this%fname(suffix_pos:)
128 character(len=1024) :: fname
129 integer :: suffix_pos
131 fname = trim(this%fname)
138 integer,
intent(in) :: n
146 if (this%counter .eq. -1)
then
147 this%counter = this%start_counter
149 this%counter = this%counter + 1
156 integer,
intent(in) :: n
157 this%start_counter = n
171 n = this%start_counter
177 character(len=1024) :: fname
178 logical :: file_exists
179 integer :: neko_mpi_ierr
181 fname = this%get_fname()
182 file_exists = .false.
184 if (
pe_rank .eq. 0 .or. this%serial)
then
186 inquire(
file = fname, exist = file_exists)
189 if (.not. this%serial)
then
190 call mpi_bcast(file_exists, 1, mpi_logical, 0,
neko_comm, neko_mpi_ierr)
193 if (.not. file_exists)
then
194 call neko_error(
'File does not exist: ' // trim(fname))
202 logical,
intent(in) :: overwrite
203 character(len=80) :: suffix
206 call neko_warning(
"No set_overwrite defined for " // trim(suffix) //
" yet")
integer, public pe_rank
MPI rank.
type(mpi_comm), public neko_comm
MPI communicator.
Module for file I/O operations.
character(len=1024) function generic_file_get_fname(this)
Get a file's name.
subroutine generic_file_check_exists(this)
check if the file exists
pure integer function generic_file_get_counter(this)
Get the file counter.
subroutine generic_file_set_start_counter(this, n)
Set the file start counter to n.
subroutine generic_file_increment_counter(this)
Increment the file counter by 1.
subroutine generic_file_init(this, fname)
Generic file constructor.
character(len=1024) function generic_file_get_base_fname(this)
Get base name without counter.
pure integer function generic_file_get_start_counter(this)
Get the file start counter.
subroutine generic_file_set_overwrite(this, overwrite)
Set overwrite mode.
subroutine generic_file_set_counter(this, n)
Set the file counter to n.
integer, parameter, public rp
Global precision used in computations.
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
subroutine, public filename_suffix(fname, suffix)
Extract a filename's suffix.
pure integer function, public filename_suffix_pos(fname)
Find position (in the string) of a filename's suffix.