Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from dftbplus:main #309

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/dftbp/common/file.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ module dftbp_common_file
contains


!> Sets the file opening options according to a C-style mode string
!> Sets the file opening options according to a C-style mode string.
subroutine TOpenOptions_setMode(this, mode, ioStat, ioMsg)

!> Instance.
!> Instance
class(TOpenOptions), intent(inout) :: this

!> C-like mode string ("r", "r+", "w", "w+", "a", "a+" followed by optional "t" or "b")
Expand Down Expand Up @@ -331,7 +331,7 @@ subroutine TFileDescr_connectToFile(this, file, options, mode, ioStat, ioMsg)
end subroutine TFileDescr_connectToFile


!> Connects the descriptor to an existing file unit
!> Connects the descriptor to an existing file unit.
subroutine TFileDescr_connectToUnit(this, unit)

!> File descriptor on exit
Expand All @@ -346,7 +346,7 @@ subroutine TFileDescr_connectToUnit(this, unit)
end subroutine TFileDescr_connectToUnit


!> Finalizes (closes) a file
!> Finalizes (closes) a file.
elemental impure subroutine TFileDescr_disconnect(this)

!> Instance
Expand Down Expand Up @@ -382,7 +382,7 @@ elemental function TFileDescr_isConnected(this) result(connected)
end function TFileDescr_isConnected


!> Assignment (should never be called as it stops the code)
!> Assignment (should never be called as it stops the code).
elemental impure subroutine TFileDescr_assign(lhs, rhs)

!> Right hand side of the assignment
Expand All @@ -396,16 +396,17 @@ elemental impure subroutine TFileDescr_assign(lhs, rhs)
end subroutine TFileDescr_assign


! Finalizes the instance
! Finalizes the instance.
elemental impure subroutine TFileDescr_final_(this)

type(TFileDescr), intent(inout) :: this

call this%disconnect()

end subroutine TFileDescr_final_


!> Convenience wrapper connecting a file descriptor to a file
!> Convenience wrapper connecting a file descriptor to a file.
subroutine openFile(fileDescr, file, options, mode, ioStat, ioMsg)

!> File descriptor connected to the open file
Expand All @@ -424,7 +425,7 @@ subroutine openFile(fileDescr, file, options, mode, ioStat, ioMsg)
!! * "w+": readwrite (file created or truncated if it already exists)
!! * "a": append-write (file opened if exists, otherwise created, positioned at the end)
!! * "a+": append-read/write (file opened if exists, otherwise created, positioned at the end)
!! The values above can be followed by "t" for text/unformatted mode (default) or "b" for
!! The values above can be followed by "t" for text/formatted mode (default) or "b" for
!! binary/unformatted mode.
!!
!! When arguments options and mode are both specified, the resulting options are determined by
Expand All @@ -442,7 +443,7 @@ subroutine openFile(fileDescr, file, options, mode, ioStat, ioMsg)
end subroutine openFile


!> Convenience wrapper for disconnecting a file descriptor (which closes the file)
!> Convenience wrapper for disconnecting a file descriptor (which closes the file).
elemental impure subroutine closeFile(fileDescr)

!> File descriptor, will be unconnected on exit
Expand All @@ -453,7 +454,7 @@ elemental impure subroutine closeFile(fileDescr)
end subroutine closeFile


!> Sets the default access type for file opening operations
!> Sets the default access type for file opening operations.
!!
!! Note: this routine is not thread of multi-instance-safe!
subroutine setDefaultBinaryAccess(readAccess, writeAccess, readwriteAccess)
Expand Down Expand Up @@ -482,24 +483,24 @@ function fileExists(file) result(exists)
!> File to check for existence
character(*), intent(in) :: file

!> True, if the file exists.
!> True, if the file exists
logical :: exists

inquire(file=file, exist=exists)

end function fileExists


!> Creates empty file without content or truncates files to zero content if it already exists
!> Creates empty file without content or truncates files to zero content if it already exists.
subroutine clearFile(file, ioStat, ioMsg)

!> Name of the file to create
character(*), intent(in) :: file

!> I/O stat error generated during open, zero on exit, if no error occured.
!> I/O stat error generated during open, zero on exit, if no error occured
integer, optional, intent(out) :: ioStat

!> I/O stat message generated during open, unallocated on exit, if no error occured.
!> I/O stat message generated during open, unallocated on exit, if no error occured
character(:), allocatable, optional, intent(out) :: ioMsg

type(TFileDescr) :: fd
Expand Down
Loading