ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_io::field_type Type Reference

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...

Public Attributes

character(:, SK), allocatable string
 The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping character fields before displaying them. More...
 
character(:, SK), allocatable integer
 The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping integer fields before displaying them. More...
 
character(:, SK), allocatable logical
 The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping logical fields before displaying them. More...
 
character(:, SK), allocatable complex
 The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping complex fields before displaying them. More...
 
character(:, SK), allocatable real
 The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping real fields before displaying them. More...
 

Detailed Description

The derived type that can be used for constructing containers of format or left and right delimiters for the (five) intrinsic Fortran field types.

Object of this derived type can be either,

  1. passed as input arguments to the constructor of display_type to specify the IO formatting of fields of objects of various intrinsic types that are to be subsequently displayed by the methods of display_type.
  2. used in other situations to specify properties of IO fields of various intrinsic types, for example, to specify the left and right delimiters of fields of objects of intrinsic types.
Parameters
[in]string: The input allocatable scalar character of default kind SK containing a specific formatting property of a field of type character.
(optional. If missing, the corresponding component of the output field object remains unallocated.)
[in]integer: The input allocatable scalar character of default kind SK containing a specific formatting property of a field of type integer.
(optional. If missing, the corresponding component of the output field object remains unallocated.)
[in]logical: The input allocatable scalar character of default kind SK containing a specific formatting property of a field of type logical.
(optional. If missing, the corresponding component of the output field object remains unallocated.)
[in]complex: The input allocatable scalar character of default kind SK containing a specific formatting property of a field of type complex.
(optional. If missing, the corresponding component of the output field object remains unallocated.)
[in]real: The input allocatable scalar character of default kind SK containing a specific formatting property of a field of type real.
(optional. If missing, the corresponding component of the output field object remains unallocated.)
Returns
field : The output scalar object of type field_type containing allocatable scalar character components corresponding to the input arguments.
Any component of the output field corresponding to a missing input argument remains unallocated on output.


Possible calling interfaces

use pm_io, only: field_type
type(field_type) :: field
field = field_type(string = string, integer = integer, logical = logical, complex = complex, real = real)
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
The derived type that can be used for constructing containers of format or left and right delimiters ...
Definition: pm_io.F90:482
Remarks
The procedures under discussion are pure.
The procedures under discussion are elemental.
See also
wrap_type%%wrap()
display_type%%show()
display_type%%skip()
getStrWrapped
getCentered
setCentered
isFailedGetShellWidth
isFailedGetShellHeight


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_io, only: field_type
5 use pm_io, only: display_type
6 use pm_distUnif, only: getUnifRand
7 use pm_distUnif, only: setUnifRand
8
9 implicit none
10
11 type(display_type) :: disp
12 disp = display_type(file = SK_"main.out.F90")
13
14 call disp%skip()
15 call disp%show('disp = display_type(file = SK_"main.out.F90", format = field_type(complex = SK_"math"))')
16 disp = display_type(file = SK_"main.out.F90", format = field_type(complex = SK_"math"))
17 call disp%show("call disp%show( getUnifRand((-1., -1.), (+1., +1.), 5_IK) )")
18 call disp%show( getUnifRand((-1., -1.), (+1., +1.), 5_IK) )
19 call disp%skip()
20 call disp%show('disp = display_type(file = SK_"main.out.F90", deliml = field_type(string = SK_"**", real = SK_"("), delimr = field_type(string = SK_"**", real = SK_")"))')
21 disp = display_type(file = SK_"main.out.F90", deliml = field_type(string = SK_"**", real = SK_"("), delimr = field_type(string = SK_"**", real = SK_")"))
22 call disp%show("call disp%show('This is a custom (star-) delimited string.')", deliml = SK_"", delimr = SK_"")
23 call disp%show('This is a custom (star-) delimited string.')
24 call disp%show("call disp%show( getUnifRand(-1., +1., 5_IK) )", deliml = SK_"", delimr = SK_"")
25 call disp%show( getUnifRand(-1., +1., 5_IK) )
26 call disp%skip()
27
28end program example
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for computing various statistical quantities related to t...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2disp = display_type(file = SK_"main.out.F90", format = field_type(complex = SK_"math"))
3
4call disp%show( getUnifRand((-1., -1.), (+1., +1.), 5_IK) )
5+0.457857370+0.434354186i, -0.941208601+0.352715850i, +0.386015654+0.498311520E-1i, +0.431145549-0.218367577i, +0.746247768E-1+0.337893128i
6
7disp = display_type(file = SK_"main.out.F90", deliml = field_type(string = SK_"**", real = SK_"("), delimr = field_type(string = SK_"**", real = SK_")"))
8
9call disp%show('This is a custom (star-) delimited string.')
10**This is a custom(star-) delimited string.**
11call disp%show( getUnifRand(-1., +1., 5_IK) )
12(-0.614024758), (-0.891578197E-1), (-0.999374866), (+0.449042439), (+0.660932422)
13
14
Test:
test_pm_io


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.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

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.

Author:
Amir Shahmoradi, Tuesday March 7, 2017, 3:50 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 482 of file pm_io.F90.

Member Data Documentation

◆ complex

character(:, SK), allocatable pm_io::field_type::complex

The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping complex fields before displaying them.

Definition at line 486 of file pm_io.F90.

◆ integer

character(:, SK), allocatable pm_io::field_type::integer

The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping integer fields before displaying them.

Definition at line 484 of file pm_io.F90.

◆ logical

character(:, SK), allocatable pm_io::field_type::logical

The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping logical fields before displaying them.

Definition at line 485 of file pm_io.F90.

◆ real

character(:, SK), allocatable pm_io::field_type::real

The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping real fields before displaying them.

Definition at line 487 of file pm_io.F90.

◆ string

character(:, SK), allocatable pm_io::field_type::string

The scalar character of default kind SK representing the default left or right delimiter to be used for wrapping character fields before displaying them.

Definition at line 483 of file pm_io.F90.


The documentation for this type was generated from the following file: