ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
This module contains classes and procedures for input/output (IO) or generic display operations on standard displays or internal/external files. More...
Data Types | |
type | csv_type |
This is a concrete derived type whose instances are exclusively used to signify the CSV file form within an interface of a procedure of the ParaMonte library. More... | |
type | display_type |
Generate and return an object of type display_type. More... | |
type | field_type |
The derived type that can be used for constructing containers of format or left and right delimiters for the (five) intrinsic Fortran field types. More... | |
type | filext_type |
This is the derived type for generating objects containing the source file extensions used by different programming language environments. More... | |
type | fld_type |
This is a concrete derived type whose instances are exclusively used to signify the Fortran-list-directed file form within an interface of a procedure of the ParaMonte library. More... | |
type | form_type |
This is an abstract derived type for constructing concrete derived types to distinguish various procedure signatures that require different file forms (e.g., csv, binary, ...).More... | |
type | formatted_type |
This is a concrete derived type whose instances are exclusively used to signify the formatted file form within an interface of a procedure of the ParaMonte library. More... | |
interface | getAction |
Generate and return the action attribute of the input file or unit . More... | |
interface | getContentsFrom |
Generate and return the entire contents of the input unconnected file or the (remaining) contents of an already-connected file associated with the input unit .More... | |
interface | getCountRecord |
Generate and return the number of records in the entire record-oriented input file. More... | |
interface | getCountRecordLeft |
Generate and return the number of records left (starting immediately after the last accessed record) in the record-oriented input file. More... | |
interface | getErrTableRead |
Generate and return the iostat code resulting from reading the contents of the specified file or unit into an output table .More... | |
interface | getErrTableWrite |
Generate and return the iostat code resulting from writing the input table of rank 1 or 2 to the specified output.More... | |
interface | getFieldSep |
Generate and return the best-guess field separator of a (sequential-access) file stored in the input file . More... | |
interface | getFormat |
Generate and return a generic or type/kind-specific IO format with the requested specifications that can be use to read or write individual records in IO actions. More... | |
interface | getRecordFrom |
Generate and return a full record (line) of arbitrary length as a string from the current position of the record-oriented and formatted file connected to the specified input unit . More... | |
interface | isOpen |
Generate and return .true. if the input file (or unit ) is connected to a unit (or file ), and .false. otherwise. More... | |
interface | openArg_type |
This is the openArg_type class containing arguments that can be passed to the open() intrinsic Fortran statement. More... | |
interface | setContentsFrom |
Return the entire contents of the input unconnected file or the (remaining) contents of an already-connected file associated with the input unit .More... | |
interface | setContentsTo |
Write the input string contents to the input unconnected file .More... | |
interface | setFileClosed |
Open the given input file, fetch the entire contents return it as a single allocatable string, and close the file. More... | |
interface | setRecordFrom |
Read a full record (line) of arbitrary length as a string from the current position of the record-oriented and formatted file connected to the specified input unit . More... | |
interface | show |
This is a generic method of the derived type display_type with pass attribute.More... | |
interface | skip |
This is a generic method of the derived type display_type with pass attribute.More... | |
type | unformatted_type |
This is a concrete derived type whose instances are exclusively used to signify the unformatted (binary) file form within an interface of a procedure of the ParaMonte library. More... | |
type | unknown_type |
This is a concrete derived type whose instances are exclusively used to signify the unknown file form within an interface of a procedure of the ParaMonte library. More... | |
interface | wrap |
This is a generic method of the derived type display_type with pass attribute.More... | |
type | wrap_type |
This is the derived type for constructing objects that contain the specifications of the getStrWrapped dynamic method of objects of derived type wrap_type. More... | |
Functions/Subroutines | |
pure logical(LK) function | isValidAccess (value) |
pure logical(LK) function | isValidAction (value) |
pure logical(LK) function | isValidAsynchronous (value) |
pure logical(LK) function | isValidBlank (value) |
pure logical(LK) function | isValidDecimal (value) |
pure logical(LK) function | isValidDelim (value) |
pure logical(LK) function | isValidEncoding (value) |
pure logical(LK) function | isValidForm (value) |
pure logical(LK) function | isValidPad (value) |
pure logical(LK) function | isValidPosition (value) |
pure logical(LK) function | isValidRecl (value) |
pure logical(LK) function | isValidRound (value) |
pure logical(LK) function | isValidSign (value) |
pure logical(LK) function | isValidStatus (value) |
pure elemental logical(LK) function | isPreconnected (unit) |
Generate and return .true. if the input unit corresponds to one of the processor preconnected units: output_unit , input_unit , error_unit , otherwise return .false. . More... | |
impure elemental integer(IK) function | getFileUnit (file) |
Generate and return a random new unconnected file unit number that could be assigned to the unit specifier of the Fortran intrinsic open statement. Optionally, return the unit number of a file whose path is given by the input argument file . More... | |
Variables | |
character(*, SK), parameter | MODULE_NAME = "@pm_io" |
type(filext_type), parameter | filext = filext_type() |
The scalar constant object of type filext_type containing file extensions used by different programming language environments. More... | |
character(*, SK), parameter | MFILL = SK_"%" |
The scalar character of default kind SK of len = 1 representing the default string that is used for filling the margins of the display or wrapped texts. More... | |
character(1, SK), parameter | TAB = achar(9, SK) |
The scalar character of default kind SK of len = 4 representing representing ASCII character: Horizontal Tab, which is frequently used in external files as column or field separators. More... | |
character(*, SK), parameter | TABEQV = repeat(SK_" ", 4) |
The scalar character of default kind SK of len = 4 representing the default string that is used in place of the tab character in the display. More... | |
character(*, SK), parameter | INDENT = TABEQV |
The scalar character of default kind SK of the same value as TABEQV representing the default indentation of text in the display, when indentation is needed. More... | |
character(*, SK), parameter | FORMAT_GENERIC_BLANK = SK_"(*(g0,:,' '))" |
The scalar character of default kind SK containing the generic IO whitespace-separated IO format. More... | |
character(*, SK), parameter | FORMAT_GENERIC_BLANK_TABBED = SK_"('"//INDENT//SK_"',*(g0,:,' '))" |
The scalar character of default kind SK containing the generic IO whitespace-separated IO format with in an initial INDENT. More... | |
character(*, SK), parameter | FORMAT_GENERIC_DISPLAY = SK_"(sp,*(g0,:,', '))" |
The scalar character of default kind SK containing the generic signed comma-space-separated format used as the default within objects of display_type. More... | |
character(*, SK), parameter | FORMAT_GENERIC_DISPLAY_COMPLEX_MATH = SK_"(sp,*(2g0,'i',:,', '))" |
The scalar character of default kind SK containing the generic signed comma-space-separated format that can be used as the math-style complex formatting when constructing objects of display_type. More... | |
character(*, SK), parameter | FORMAT_GENERIC_DISPLAY_COMPLEX_FORTRAN = SK_"(sp,*('(',g0,', ',g0,')',:,', '))" |
The scalar character of default kind SK containing the generic signed comma-space-separated format that can be used as the Fortran-style complex formatting when constructing objects of display_type. More... | |
character(1, SK), dimension(4), parameter | SPINNER = [ "|" , "/" , "-" , "\" ] |
The scalar character(1, SK) of default kind SK of size 4 , containing the four characters used to display a spinning command line cursor. More... | |
integer(IK), parameter | LEN_IOMSG = 511_IK |
The scalar integer of default kind IK representing the maximum length of an IO error message returned by the Fortran intrinsic routines. Note that this an arbitrary length defined globally for consistency. More... | |
integer(IK), parameter | LEN_RECORD = 8191_IK |
The scalar integer of default kind IK representing the effective maximum length of a record in a record-oriented file. Note that this is an arbitrary length defined globally for consistency. More... | |
type(unknown_type), parameter | unknown = unknown_type() |
This is a scalar parameter object of type unknown_type that is exclusively used to signify the unknown file form within an interface of a procedure of the ParaMonte library.More... | |
type(unformatted_type), parameter | unformatted = unformatted_type() |
This is a scalar parameter object of type unformatted_type that is exclusively used to signify the unformatted (binary) file form within an interface of a procedure of the ParaMonte library.More... | |
type(formatted_type), parameter | formatted = formatted_type() |
This is a scalar parameter object of type formatted_type that is exclusively used to signify the formatted file form within an interface of a procedure of the ParaMonte library.More... | |
type(csv_type), parameter | csv = csv_type() |
This is a scalar parameter object of type csv_type that is exclusively used to signify the CSV file form within an interface of a procedure of the ParaMonte library.More... | |
type(fld_type), parameter | fld = fld_type() |
This is a scalar parameter object of type fld_type that is exclusively used to signify the Fortran-list-directed file form within an interface of a procedure of the ParaMonte library.More... | |
type(display_type) | disp |
This is a scalar module variable an object of type display_type for general display. More... | |
This module contains classes and procedures for input/output (IO) or generic display operations on standard displays or internal/external files.
The following is a (non-exhaustive) list of the most useful functionalities in this module:
show
, wrap
, skip
, ...) can display all sorts of scalar and array objects of intrinsic type and kind as well as containers of various intrinsic types and kinds.sequential
access file or unit.sequential
access connected-file unit.sequential
access file or unit into an allocatable
string.etc.
The following is a collection of terms and phrases frequently used in the documentation of this module.
endfile
record is the last record of a file.endfile
record has no length.endfile
record can be written explicitly by the endfile()
Fortran intrinsic statement.endfile
record can be written implicitly to a file connected for sequential access when,write()
statement,rewind()
or backspace()
statement references the unit to which the file is connected; orclose()
statement, oropen()
statement for the same unit.1
to n
, corresponding to the first and last cells in the file.RECL
can be inquire
d to determine the size of the fixed-length cells.RECL=
specifier in call to open()
statement).Record Type | Available File Organizations and Portability Considerations | Record Overhead |
---|---|---|
Fixed-length | Relative or sequential file organizations. | None for sequential. |
Variable-length | Sequential file organization only. | Eight bytes per record. The most portable record type. |
Stream | Sequential file organization only. No record terminator needed. | zero. |
Stream_CR | Sequential file organization only. It uses CR (carriage return) as record terminator. | One byte per record. |
Stream_LF | Sequential file organization only. It uses LF (line feed) as record terminator). | One byte per record. |
Stream_CRLF | Sequential file organization only. It uses both CR and LF as record terminator. | Two bytes per record. |
stream
record type yields the smallest possible file sizes.RECL
specified of the open()
statement.backspace()
request to skip back over records efficiently.2,147,483,639
bytes, the record is divided into subrecords. The subrecord can be of any length from 1
to 2,147,483,639
, inclusive.1
.0
.1
.0
.1
, the length of the record is stored in twos-complement notation.1
.access = "stream"
in the open()
statement for the file.1
.pos
specifier in an inquire()
statement for the unit.pos
specifier.formatted
or unformatted
.formatted
and unformatted
forms use external stream files composed of one byte file storage units.unformatted
stream access has only a stream structure.formatted
stream access have both a record and a stream structure.1
.1
.read()
statement for this connection is allowed.backspace()
in an unformatted stream.read()
and write()
are the only statements that can specify an internal file.write()
statement writes less than an entire record, blanks fill the remainder of that record.direct
or stream
access I/O statements as long as the file is connected for sequential
access.sequential
or stream
access, list-directed or namelist formatting, or a nonadvancing input/output statement.9
, 5
, and 11
can be written in that order without writing the intermediate records.open()
statement when the file is connected.sequential
and direct
access may be available for some files, but normally a file is limited to sequential
, direct
, or stream
access.inquire()
statement.pure
due to the call to the inquire()
statement. As such, they are unlikely to be inlined by the compiler.use
statement, followed by the function call, which effectively yields the same amount of verbosity caused by directly calling the inquire()
statement.inquire()
statement can return multiple attributes of a file or unit, which makes this statement much more concise and efficient as opposed to any user-defined function.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
impure elemental integer(IK) function pm_io::getFileUnit | ( | character(*, SK), intent(in), optional | file | ) |
Generate and return a random new unconnected file unit number that could be assigned to the unit
specifier of the Fortran intrinsic open
statement. Optionally, return the unit number of a file whose path is given by the input argument file
.
The behavior of this generic interface is fully dictated by the Fortran intrinsic inquire()
when the optional argument file
is present.
For example, if the optional argument is present but no unit is connected to the file or the file does not exists, the unit
returned is -1
.
[in] | file | : The input scalar of type character of default kind SK representing the path of the file whose unit is to be returned, if it is already opened.(optional, if missing, a new unit number, that is not connected to any file, will be returned.) |
unit
: The output scalar of type integer
of default kind IK containingfile
if it exists and is already connected.-1
if the input argument file
is present but does not exist or is not already connected.file
is missing.
Possible calling interfaces ⛓
file
, a value of -1
will be returned.impure
.elemental
.newunit
specifier of the open
statement.
Example usage ⛓
ifort
compiler ⛓ ifort
compiler ⛓ gfortran
compiler ⛓
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
pure elemental logical(LK) function pm_io::isPreconnected | ( | integer(IK), intent(in) | unit | ) |
Generate and return .true.
if the input unit corresponds to one of the processor preconnected units: output_unit
, input_unit
, error_unit
, otherwise return .false.
.
[in] | unit | : The input scalar of type integer of default kind IK representing the unit number to be tested. |
preconnected
: The output scalar of type logical
of default kind LK representing that is .true.
if and only if the input unit corresponds to one of the preconnected units by the processor.
Possible calling interfaces ⛓
pure
.elemental
.file
, a value of -1
will be returned.newunit
specifier of the open
statement.
Example usage ⛓
ifort
compiler ⛓ ifort
compiler ⛓ gfortran
compiler ⛓
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
pure logical(LK) function pm_io::isValidAccess | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidAction | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidAsynchronous | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidBlank | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidDecimal | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidDelim | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidEncoding | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidForm | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidPad | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidPosition | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidRecl | ( | integer(IK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidRound | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidSign | ( | character(*, SK), intent(in) | value | ) |
pure logical(LK) function pm_io::isValidStatus | ( | character(*, SK), intent(in) | value | ) |
This is a scalar parameter
object of type csv_type that is exclusively used to signify the CSV file form within an interface of a procedure of the ParaMonte library.
For example usage, see the documentation of the target procedure requiring this object.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
type(display_type) pm_io::disp |
This is a scalar module variable an object of type display_type for general display.
The existence of this object is to merely facilitate quick tests and displays of items on the default stdout.
Given the global nature of this object, its usage is not recommended beyond simple tests and debugging tasks.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
type(filext_type), parameter pm_io::filext = filext_type() |
The scalar constant object of type filext_type containing file extensions used by different programming language environments.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
This is a scalar parameter
object of type fld_type that is exclusively used to signify the Fortran-list-directed file form within an interface of a procedure of the ParaMonte library.
For example usage, see the documentation of the target procedure requiring this object.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
character(*, SK), parameter pm_io::FORMAT_GENERIC_BLANK = SK_"(*(g0,:,' '))" |
character(*, SK), parameter pm_io::FORMAT_GENERIC_BLANK_TABBED = SK_"('"//INDENT//SK_"',*(g0,:,' '))" |
character(*, SK), parameter pm_io::FORMAT_GENERIC_DISPLAY = SK_"(sp,*(g0,:,', '))" |
The scalar character
of default kind SK containing the generic signed comma-space-separated format used as the default within objects of display_type.
character(*, SK), parameter pm_io::FORMAT_GENERIC_DISPLAY_COMPLEX_FORTRAN = SK_"(sp,*('(',g0,', ',g0,')',:,', '))" |
The scalar character
of default kind SK containing the generic signed comma-space-separated format that can be used as the Fortran-style complex formatting when constructing objects of display_type.
character(*, SK), parameter pm_io::FORMAT_GENERIC_DISPLAY_COMPLEX_MATH = SK_"(sp,*(2g0,'i',:,', '))" |
The scalar character
of default kind SK containing the generic signed comma-space-separated format that can be used as the math-style complex formatting when constructing objects of display_type.
type(formatted_type), parameter pm_io::formatted = formatted_type() |
This is a scalar parameter
object of type formatted_type that is exclusively used to signify the formatted file form within an interface of a procedure of the ParaMonte library.
For example usage, see the documentation of the target procedure requiring this object.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
character(*, SK), parameter pm_io::INDENT = TABEQV |
integer(IK), parameter pm_io::LEN_IOMSG = 511_IK |
integer(IK), parameter pm_io::LEN_RECORD = 8191_IK |
character(*, SK), parameter pm_io::MFILL = SK_"%" |
character(1, SK), dimension(4), parameter pm_io::SPINNER = [ "|" , "/" , "-" , "\" ] |
character(1, SK), parameter pm_io::TAB = achar(9, SK) |
character(*, SK), parameter pm_io::TABEQV = repeat(SK_" ", 4) |
The scalar character
of default kind SK of len = 4
representing the default string that is used in place of the tab character in the display.
Definition at line 343 of file pm_io.F90.
Referenced by pm_test::setSummary().
type(unformatted_type), parameter pm_io::unformatted = unformatted_type() |
This is a scalar parameter
object of type unformatted_type that is exclusively used to signify the unformatted (binary) file form within an interface of a procedure of the ParaMonte library.
For example usage, see the documentation of the target procedure requiring this object.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
type(unknown_type), parameter pm_io::unknown = unknown_type() |
This is a scalar parameter
object of type unknown_type that is exclusively used to signify the unknown file form within an interface of a procedure of the ParaMonte library.
For example usage, see the documentation of the target procedure requiring this object.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.