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.
83 class(*),
target,
intent(in) :: data
84 real(kind=
rp),
intent(in),
optional :: t
92 class(*),
target,
intent(inout) :: data
102 character(len=*) :: fname
112 character(len=1024) :: fname
113 integer :: suffix_pos
114 character(len=5) :: id_str
116 if (this%counter .ne. -1)
then
118 write(id_str,
'(i5.5)') this%counter
119 fname = trim(this%fname(1:suffix_pos-1)) // id_str // &
120 this%fname(suffix_pos:)
130 character(len=1024) :: fname
132 fname = this%get_fname()
139 character(len=1024) :: fname
140 integer :: suffix_pos
142 fname = trim(this%fname)
149 integer,
intent(in) :: n
157 if (this%counter .eq. -1)
then
158 this%counter = this%start_counter
160 this%counter = this%counter + 1
167 integer,
intent(in) :: n
168 this%start_counter = n
182 n = this%start_counter
188 character(len=1024) :: fname
189 logical :: file_exists
190 integer :: neko_mpi_ierr
192 fname = this%get_fname()
193 file_exists = .false.
195 if (
pe_rank .eq. 0 .or. this%serial)
then
197 inquire(
file = fname, exist = file_exists)
200 if (.not. this%serial)
then
201 call mpi_bcast(file_exists, 1, mpi_logical, 0,
neko_comm, neko_mpi_ierr)
204 if (.not. file_exists)
then
205 call neko_error(
'File does not exist: ' // trim(fname))
213 logical,
intent(in) :: overwrite
214 character(len=80) :: suffix
217 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.
character(len=1024) function generic_file_get_next_output_fname(this)
Get the file name generated by the next write.
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.