![]() |
ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
This is the openArg_type class containing arguments that can be passed to the open()
intrinsic Fortran statement.
More...
Public Attributes | |
character(10, SK) | access = SK_"sequential" |
A scalar character of default kind SK of length 10 containing the access attribute of the file: "sequential" (default), "direct" , "stream" More... | |
character(9, SK) | action = SK_"readwrite" |
A scalar character of default kind SK of length 9 containing the action attribute of the file: "readwrite" (default), "read" , "write" More... | |
character(3, SK) | asynchronous = SK_"no" |
A scalar character of default kind SK of length 3 containing the asynchronous attribute of the file: "no" (default), "yes" More... | |
character(4, SK) | blank = SK_"null" |
A scalar character of default kind SK of length 4 containing the blank attribute of the file: "null" (default), "yes" More... | |
character(5, SK) | decimal = SK_"point" |
A scalar character of default kind SK of length 5 containing the decimal attribute of the file: "point" (default), "comma" More... | |
character(10, SK) | delim = SK_"none" |
A scalar character of default kind SK of length 10 containing the delim attribute of the file: "none" (default), "apostrophe" , "quote" More... | |
character(7, SK) | encoding = SK_"default" |
A scalar character of default kind SK of length 7 containing the encoding attribute of the file: "default" (default), "utf-8" More... | |
character(11, SK) | form = SK_"formatted" |
A scalar character of default kind SK of length 11 containing the delim attribute of the file: "formatted" (default), "unformatted" More... | |
integer(IK) | iostat = 0_IK |
A scalar integer of default kind IK containing the iostat attribute of the file: default = 0_IK . The processor sets it to a positive value if a runtime IO error occurs. More... | |
character(3, SK) | pad = SK_"yes" |
A scalar character of default kind SK of length 3 containing the pad attribute of the file: "yes" (default), "no" More... | |
character(6, SK) | position = SK_"asis" |
A scalar character of default kind SK of length 6 containing the position attribute of the file: "asis" (default), "rewind" , "append" More... | |
integer(IK) | recl = huge(0_IK) |
A scalar integer of default kind IK containing the recl attribute of the file. It is mandatory for direct access files. More... | |
character(17, SK) | round = SK_"processor_defined" |
A scalar character of default kind SK of length 17 containing the round attribute of the file: "processor_defined" (default), "compatible" , "nearest" , "zero" , "down" , "up" More... | |
character(17, SK) | sign = SK_"processor_defined" |
A scalar character of default kind SK of length 17 containing the sign attribute of the file: "processor_defined" (default), "suppress" , "plus" More... | |
character(7, SK) | status = SK_"unknown" |
A scalar character of default kind SK of length 7 containing the status attribute of the file: "unkown" (default), "scratch" , "replace" , "new" , "old" More... | |
integer(IK) | unit = -1_IK |
A scalar integer of default kind IK containing the unit attribute of the file. It is a negative number if set by the processor, otherwise it must be positive. More... | |
character(:, SK), allocatable | iomsg |
A scalar character of default kind SK of length : containing the error message if an error occurs. More... | |
character(:, SK), allocatable | file |
A scalar character of default kind SK of length : containing the file path. More... | |
This is the openArg_type class containing arguments that can be passed to the open()
intrinsic Fortran statement.
Generate and return an object of class openArg_type containing arguments that can be passed to the open()
intrinsic Fortran statement.
This type is merely meant to provide a convenient storage for file attributes that might be needed at the time of opening files for IO.
This type is overloaded with openArg_typer()
to verify the consistency of the structure components values.
The following optional arguments of the open()
statement are deliberately excluded from this derived type:
newunit
: There is no need for a dedicated component with this name since it is only relevant to calling the open()
statement.err
: There is no need for a dedicated component with this name since it is rarely used in modern Fortran.
Possible calling interfaces ⛓
character
arguments to the constructor of the class must be lower-case.recl
for a sequential
-access scratch
file ishuge(0)
under the GNU Fortran compiler.132
under the Intel Fortran compiler.
Example usage ⛓
ifort
compiler ⛓ ifort
compiler ⛓ gfortran
compiler ⛓ ifort
version < 2021.10.0 20230609 ifort
returns a runtime error in Microsoft WSL, within the submodule procedure isFalseAssertion()
which also persisted when the procedure was in the module.
This happens only when the library is built with script flag --mem heap
enabling heap allocation and only when specified with --build release
.
This implies the cause of the error likely has its roots in the compilers optimizations.
It turns out that the root cause of the runtime error was the optional
argument iomsg
with intent(inout)
.
Remedy (as of ParaMonte Library version 2.0.0): The procedure isFalseAssertion()
is now commented out and all error handlings are done painfully manually.
However, this did not help as the same error persisted and the root cause was identified to be the iomsg
argument.
As such, this optional argument is now removed and the error message, if any, is returned in the output object component iomsg
.
gfortran
version < 12 gfortran
cannot compile interfaces with dummy arguments character(:), intent(out), allocatable, optional
.iostat
to control the occurrence of an error.iomsg
could have been used to signal no occurrence of error.iomsg
arguments are now assumed-length strings.
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 the constructor of the type openArg_type to verify the consistency of the structure components values.
The following optional arguments of the open()
statement are deliberately excluded from this derived type:
newunit
: There is no need for a dedicated component with this name since it is only relevant to calling the open()
statement.err
: There is no need for a dedicated component with this name since it is rarely used in modern Fortran.[in] | access | : The input scalar character of default kind SK containing the access attribute of the file: "sequential" (default), "direct" , "stream" .(optional, default = SK_"sequential" ) |
[in] | action | : The input scalar character of default kind SK containing the action attribute of the file: "readwrite" (default), "read" , "write" .(optional, default = SK_"readwrite" ) |
[in] | asynchronous | : The input scalar character of default kind SK containing the asynchronous attribute of the file: "no" (default), "yes" .(optional, default = SK_"no" ) |
[in] | blank | : The input scalar character of default kind SK containing the blank attribute of the file: "null" (default), "yes" .(optional, default = SK_"null" ) |
[in] | decimal | : The input scalar character of default kind SK containing the decimal attribute of the file: "point" (default), "comma" .(optional, default = SK_"point" ) |
[in] | delim | : The input scalar character of default kind SK containing the delim attribute of the file: "none" (default), "apostrophe" , "quote" .(optional, default = SK_"none" ) |
[in] | encoding | : The input scalar character of default kind SK containing the encoding attribute of the file: "default" (default), "utf-8" .(optional, default = SK_"default" ) |
[in] | form | : The input scalar character of default kind SK containing the delim attribute of the file: "formatted" (default), "unformatted" .(optional, default = SK_"formatted" ) |
[in] | pad | : The input scalar character of default kind SK containing the pad attribute of the file: "yes" (default), "no" .(optional, default = SK_"yes" ) |
[in] | position | : The input scalar character of default kind SK containing the position attribute of the file: "asis" (default), "rewind" , "append" .(optional, default = SK_"asis" ) |
[in] | recl | : The input scalar integer of default kind IK containing the recl attribute of the file. It is mandatory for direct access files.(optional, default = ` . It can be specified **if and only if** the condition access == SK_"sequential"for the specified input argument access.) \param[in] round : The input scalar characterof default kind [SK](@ref pm_kind::SK) containing the roundattribute of the file: "processor_defined"(default), "compatible", "nearest", "zero", "down", "up".<br> (**optional**, default = SK_"processor_defined") \param[in] sign : The input scalar characterof default kind [SK](@ref pm_kind::SK) containing the signattribute of the file: "processor_defined"(default), "suppress", "plus".<br> (**optional**, default = SK_"processor_defined") \param[in] status : The input scalar characterof default kind [SK](@ref pm_kind::SK) containing the statusattribute of the file: "unkown"(default), "scratch", "replace", "new", "old".<br> (**optional**, default = SK_"unknown") \param[in] unit : The input scalar integerof default kind [IK](@ref pm_kind::IK) containing the unit` attribute of the file.It is a negative number if set by the processor, otherwise it must be positive. As per the Fortran standard, -1 is reserved to represent a file that is not connected.Therefore, if -1 is specified as input value, it will be overwritten with a random preconnected unit number.(optional, default = getFileUnit()) |
[in] | file | : The input scalar character of default kind SK containing the file path.(optional. If missing, the file component of the output object remains unallocated.) |
[out] | iostat | : The output scalar integer of default kind IK.
|
[in,out] | iomsg | : The input/output scalar character of default kind SK whose length type parameter and its contents will be used to set that of the corresponding component of the output object.Additionally, if a runtime error occurs while constructing the output object, iomsg will be set to a descriptive message about the nature of the error occurred.(optional, default = repeat(" ", LEN_IOMSG) where LEN_IOMSG is compile-time constant.) |
openArg
: The output scalar object of type openArg_type whose components are set to the corresponding input values or otherwise set to an appropriate default value.
Possible calling interfaces ⛓
character
arguments to this procedure must be lower-case.unit
is missing, then the unit
component of the output object is set to the unit of the specified file
if it is present, exists, and is connected.unit
component is set to a unique positive number that is not already associated with any other connected file.recl
for a sequential
-access scratch
file ishuge(0)
under the GNU Fortran compiler.132
under the Intel Fortran compiler.impure
.elemental
.
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.
character(10,SK) pm_io::openArg_type::access = SK_"sequential" |
character( 9,SK) pm_io::openArg_type::action = SK_"readwrite" |
character( 3,SK) pm_io::openArg_type::asynchronous = SK_"no" |
character( 4,SK) pm_io::openArg_type::blank = SK_"null" |
character( 5,SK) pm_io::openArg_type::decimal = SK_"point" |
character(10,SK) pm_io::openArg_type::delim = SK_"none" |
character( 7,SK) pm_io::openArg_type::encoding = SK_"default" |
character(:, SK), allocatable pm_io::openArg_type::file |
character(11,SK) pm_io::openArg_type::form = SK_"formatted" |
character(:, SK), allocatable pm_io::openArg_type::iomsg |
integer(IK) pm_io::openArg_type::iostat = 0_IK |
character( 3,SK) pm_io::openArg_type::pad = SK_"yes" |
character( 6,SK) pm_io::openArg_type::position = SK_"asis" |
integer(IK) pm_io::openArg_type::recl = huge(0_IK) |
character(17,SK) pm_io::openArg_type::round = SK_"processor_defined" |
character(17,SK) pm_io::openArg_type::sign = SK_"processor_defined" |
character( 7,SK) pm_io::openArg_type::status = SK_"unknown" |
integer(IK) pm_io::openArg_type::unit = -1_IK |