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

This is a generic method of the derived type display_type with pass attribute.
More...

Detailed Description

This is a generic method of the derived type display_type with pass attribute.

This method displays the input object of supported type and kind and rank in the specified output.

Parameters
[in]object: The input object of either,
  • scalar or array of rank 1 or 2 or 3 of type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU), or
  • scalar or array of rank 1 or 2 or 3 of type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64), or
  • scalar or array of rank 1 or 2 or 3 of type logical of kind any supported by the processor (e.g., LK), or
  • scalar or array of rank 1 or 2 or 3 of type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
  • scalar or array of rank 1 or 2 or 3 of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128), or
  • scalar or array of rank 1 or 2 or 3 of type css_type, or
  • scalar or array of rank 1 or 2 or 3 of type csi_type, or
  • scalar or array of rank 1 or 2 or 3 of type csl_type, or
  • scalar or array of rank 1 or 2 or 3 of type csc_type, or
  • scalar or array of rank 1 or 2 or 3 of type csr_type, or
  • scalar or array of rank 1 or 2 of type cvs_type, or
  • scalar or array of rank 1 or 2 of type cvi_type, or
  • scalar or array of rank 1 or 2 of type cvl_type, or
  • scalar or array of rank 1 or 2 of type cvc_type, or
  • scalar or array of rank 1 or 2 of type cvr_type, or
  • scalar or array of rank 1 of type cms_type, or
  • scalar or array of rank 1 of type cmi_type, or
  • scalar or array of rank 1 of type cml_type, or
  • scalar or array of rank 1 of type cmc_type, or
  • scalar or array of rank 1 of type cmr_type
  • scalar or array of rank 1 or 2 or 3 of type css_pdt, or
  • scalar or array of rank 1 or 2 or 3 of type csi_pdt, or
  • scalar or array of rank 1 or 2 or 3 of type csl_pdt, or
  • scalar or array of rank 1 or 2 or 3 of type csc_pdt, or
  • scalar or array of rank 1 or 2 or 3 of type csr_pdt, or
  • scalar or array of rank 1 or 2 of type cvs_pdt, or
  • scalar or array of rank 1 or 2 of type cvi_pdt, or
  • scalar or array of rank 1 or 2 of type cvl_pdt, or
  • scalar or array of rank 1 or 2 of type cvc_pdt, or
  • scalar or array of rank 1 or 2 of type cvr_pdt, or
  • scalar or array of rank 1 of type cms_pdt, or
  • scalar or array of rank 1 of type cmi_pdt, or
  • scalar or array of rank 1 of type cml_pdt, or
  • scalar or array of rank 1 of type cmc_pdt, or
  • scalar or array of rank 1 of type cmr_pdt
containing the content to display.
[in]tmsize: The input scalar of integer of default kind IK representing the number of empty lines preceding the object in the display.
(optional, default = 0_IK)
[in]bmsize: The input scalar of integer of default kind IK representing the number of empty lines succeeding the object in the display.
(optional, default = 0_IK)
[in]count: The input scalar of integer of default kind IK representing the number of times the object will have to be sequentially displayed in separate lines.
(optional, default = 1_IK)
[in]unit: The input scalar integer of default kind IK representing the output display unit number where the text will be displayed.
(optional, default = display_type%unit)
[in]advance: The input scalar character of default kind SK that must be either NO or YES.
It has the same functionality and meaning as the advance argument in the Fortran intrinsic IO statement read().
(optional, default = YES)
[in]format: The input scalar character of default kind SK containing the format with which the object should be displayed.
If present, the input value is directly passed to the Fortran write() statement for a formatted display.
(optional, default = YES)
[in]deliml: The input scalar of type character of default kind default kind SK, whose contents represent the left-delimiter to be used for left-wrapping fields of the input object.
The common Fortran-style left-delimiter for complex fields is the left-parenthesis \(\texttt{(}\).
The two most common left-delimiters string fields are the single \(\texttt{'}\) and double \(\texttt{"}\) quotation marks.
The left-delimiter is particularly relevant to string and complex objects that are passed to the methods of display_type.
The input deliml will be used for constructing the field format only if the input argument format is missing.
(optional. default = delimr or if missing, the corresponding value from the deliml component of the parent disp object of this method.)
[in]delimr: The input scalar of type character of default kind default kind SK, whose contents represent the right-delimiter to be used for right-wrapping fields of the input object.
The common Fortran-style right-delimiter for complex fields is the right-parenthesis \(\texttt{)}\).
The two most common right-delimiters string fields are the single \(\texttt{'}\) and double \(\texttt{"}\) quotation marks.
The right-delimiter is particularly relevant to string and complex objects that are passed to the methods of display_type.
The input delimr will be used for constructing the field format only if the input argument format is missing.
(optional. default = deliml or if missing, the corresponding value from the delimr component of the parent disp object of this method.)
[in]sticky: The input scalar logical of default kind LK.
If .true. the input arguments will update the corresponding components of the parent object of type display_type for later usage.
(optional, default = .false._LK)


Possible calling interfaces

use pm_io, only: display_type
type(display_type) :: disp
call disp%show( object &
, tmsize = tmsize &
, bmsize = bmsize &
, count = count &
, unit = unit &
, advance = advance &
, format = format &
, deliml = deliml &
, delimr = delimr &
, sticky = sticky &
)
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
Generate and return an object of type display_type.
Definition: pm_io.F90:10282
Remarks
The procedures under discussion are impure.
See also
wrap_type%wrap()
display_type%show()
display_type%skip()


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_io, only: display_type
5 use pm_distUnif, only: getUnifRand
6 use pm_distUnif, only: setUnifRand
7
8 implicit none
9
10 type(display_type) :: disp
11 disp = display_type(file = SK_"main.out.F90")
12
13 call disp%skip()
14 call disp%show('disp = display_type(file = SK_"main.out.F90", status = "old", position = "append")')
15 call disp%skip()
16 call disp%show("call disp%show('ParaMonte') ! output without quotation marks.")
17 call disp%show('ParaMonte')
18 call disp%skip()
19 call disp%show("call disp%show('ParaMonte', deliml = SK_'''') ! output with single quotation marks.")
20 call disp%show('ParaMonte', deliml = SK_'''')
21 call disp%skip()
22 call disp%show('call disp%show("ParaMonte", deliml = SK_"""") ! output with double quotation marks.')
23 call disp%show('ParaMonte', deliml = SK_"""")
24 call disp%skip()
25 call disp%show('call disp%show("ParaMonte", deliml = SK_"`") ! output with backtick marks.')
26 call disp%show('ParaMonte', deliml = SK_"`")
27 call disp%skip()
28
29 call disp%skip()
30 call disp%show('disp = display_type(disp%unit)')
31 disp = display_type(disp%unit)
32 call disp%skip()
33 call disp%show("call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.']) ! output without quotation marks.")
34 call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'])
35 call disp%skip()
36 call disp%show("call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'], deliml = SK_'''') ! output with single quotation marks.")
37 call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'], deliml = SK_'''')
38 call disp%skip()
39 call disp%show('call disp%show([character(10) :: "ParaMonte", "is", "a", "machine", "learning", "library."], deliml = SK_"""") ! output with double quotation marks.')
40 call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'], deliml = SK_"""")
41 call disp%skip()
42 call disp%show('call disp%show([character(10) :: "ParaMonte", "is", "a", "machine", "learning", "library."], deliml = SK_"`") ! output with backtick marks.')
43 call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'], deliml = SK_"`")
44 call disp%skip()
45
46 call disp%skip()
47 call disp%show('disp = display_type(disp%unit)')
48 disp = display_type(disp%unit)
49 call disp%skip()
50 call disp%show("call disp%show(.true.)")
51 call disp%show(.true.)
52 call disp%skip()
53 call disp%show("call disp%show([.true., .false.])")
54 call disp%show([.true., .false.])
55 call disp%skip()
56
57 call disp%skip()
58 call disp%show('disp = display_type(disp%unit)')
59 disp = display_type(disp%unit)
60 call disp%skip()
61 call disp%show("call disp%show(1)")
62 call disp%show(1)
63 call disp%skip()
64 call disp%show("call disp%show([1, 2])")
65 call disp%show([1, 2])
66 call disp%skip()
67
68 call disp%skip()
69 call disp%show('disp = display_type(disp%unit)')
70 disp = display_type(disp%unit)
71 call disp%skip()
72 call disp%show("call disp%show(1.)")
73 call disp%show(1.)
74 call disp%skip()
75 call disp%show("call disp%show([1., 2.])")
76 call disp%show([1., 2.])
77 call disp%skip()
78
79 call disp%skip()
80 call disp%show('disp = display_type(disp%unit)')
81 disp = display_type(disp%unit)
82 call disp%skip()
83 call disp%show("call disp%show((1.,-1.))")
84 call disp%show((1.,-1.))
85 call disp%skip()
86 call disp%show("call disp%show([(1.,-1.), (2.,-2.)])")
87 call disp%show([(1.,-1.), (2.,-2.)])
88 call disp%skip()
89
90 call disp%skip()
91 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
92 call disp%show("! Display matrices of values.")
93 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
94 call disp%skip()
95
96 call disp%skip()
97 call disp%show('disp = display_type(disp%unit)')
98 disp = display_type(disp%unit)
99 call disp%skip()
100 call disp%show("call disp%show(reshape(getUnifRand(0, 1, 9), [3, 3]))")
101 call disp%show(reshape(getUnifRand(0, 1, 9), [3, 3]))
102 call disp%skip()
103
104 call disp%skip()
105 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
106 call disp%show("! Display contents of containers of matrices.")
107 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
108 call disp%skip()
109
110 block
111 use pm_container, only: cmi_type
112 type(cmi_type) :: ConMat(3)
113 call disp%skip()
114 call disp%show('allocate(ConMat(1)%val(2,2)); call setUnifRand(ConMat(1)%val)')
115 allocate(ConMat(1)%val(2,2)); call setUnifRand(ConMat(1)%val)
116 call disp%show('allocate(ConMat(2)%val(3,5)); call setUnifRand(ConMat(2)%val)')
117 allocate(ConMat(2)%val(3,5)); call setUnifRand(ConMat(2)%val)
118 call disp%show('allocate(ConMat(3)%val(5,3)); call setUnifRand(ConMat(3)%val)')
119 allocate(ConMat(3)%val(5,3)); call setUnifRand(ConMat(3)%val)
120 call disp%show('disp = display_type(disp%unit)')
121 disp = display_type(disp%unit)
122 call disp%skip()
123 call disp%show("call disp%show(ConMat(:))")
124 call disp%show(ConMat(:))
125 call disp%skip()
126 end block
127
128 call disp%skip()
129 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%")
130 call disp%show("! Display cubes of values.")
131 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%")
132 call disp%skip()
133
134 call disp%skip()
135 call disp%show('disp = display_type(disp%unit)')
136 disp = display_type(disp%unit)
137 call disp%skip()
138 call disp%show("call disp%show(reshape(getUnifRand(0, 1, 27), [3, 3, 3]))")
139 call disp%show(reshape(getUnifRand(0, 1, 27), [3, 3, 3]))
140 call disp%skip()
141
142end 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:11508
This module contains the derived types for generating allocatable containers of scalar,...
This module contains classes and procedures for computing various statistical quantities related to t...
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
This is the derived type for generating a container of a matrix component of type integer of default ...

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", status = "old", position = "append")
3
4call disp%show('ParaMonte') ! output without quotation marks.
5ParaMonte
6
7call disp%show('ParaMonte', deliml = SK_'''') ! output with single quotation marks.
8'ParaMonte'
9
10call disp%show("ParaMonte", deliml = SK_"""") ! output with double quotation marks.
11"ParaMonte"
12
13call disp%show("ParaMonte", deliml = SK_"`") ! output with backtick marks.
14`ParaMonte`
15
16
18
19call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.']) ! output without quotation marks.
20ParaMonte , is , a , machine , learning , library.
21
22call disp%show([character(10) :: 'ParaMonte', 'is', 'a', 'machine', 'learning', 'library.'], deliml = SK_'''') ! output with single quotation marks.
23'ParaMonte ', 'is ', 'a ', 'machine ', 'learning ', 'library. '
24
25call disp%show([character(10) :: "ParaMonte", "is", "a", "machine", "learning", "library."], deliml = SK_"""") ! output with double quotation marks.
26"ParaMonte ", "is ", "a ", "machine ", "learning ", "library. "
27
28call disp%show([character(10) :: "ParaMonte", "is", "a", "machine", "learning", "library."], deliml = SK_"`") ! output with backtick marks.
29`ParaMonte `, `is `, `a `, `machine `, `learning `, `library. `
30
31
33
34call disp%show(.true.)
35T
36
37call disp%show([.true., .false.])
38T, F
39
40
42
43call disp%show(1)
44+1
45
46call disp%show([1, 2])
47+1, +2
48
49
51
52call disp%show(1.)
53+1.00000000
54
55call disp%show([1., 2.])
56+1.00000000, +2.00000000
57
58
60
61call disp%show((1.,-1.))
62(+1.00000000, -1.00000000)
63
64call disp%show([(1.,-1.), (2.,-2.)])
65(+1.00000000, -1.00000000), (+2.00000000, -2.00000000)
66
67
68!%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69! Display matrices of values.
70!%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71
72
74
75call disp%show(reshape(getUnifRand(0, 1, 9), [3, 3]))
76+1, +1, +1
77+0, +1, +0
78+0, +0, +1
79
80
81!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82! Display contents of containers of matrices.
83!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84
85
86allocate(ConMat(1)%val(2,2)); call setUnifRand(ConMat(1)%val)
87allocate(ConMat(2)%val(3,5)); call setUnifRand(ConMat(2)%val)
88allocate(ConMat(3)%val(5,3)); call setUnifRand(ConMat(3)%val)
90
91call disp%show(ConMat(:))
92object(1)%val(:,:) =
93+159193663, -1556632823
94-745553578, -1421948454
95object(2)%val(:,:) =
96+1421902597, +962411875, +266194645, +1065318260, -390935025
97-1521112953, -1282657994, -1398547719, +283640199, -796336488
98-1109860508, -388404403, +1902308950, +189340219, -1864495493
99object(3)%val(:,:) =
100+810617669, +228817366, -1085124567
101+1102262094, +864467069, +1168803044
102+2019509357, -1315861482, +648435674
103-248432898, -54221179, -1130468632
104-412330367, +1899135278, -1519477315
105
106
107!%%%%%%%%%%%%%%%%%%%%%%%%%
108! Display cubes of values.
109!%%%%%%%%%%%%%%%%%%%%%%%%%
110
111
112disp = display_type(disp%unit)
113
114call disp%show(reshape(getUnifRand(0, 1, 27), [3, 3, 3]))
115slice(:,:,1) =
116+0, +1, +1
117+0, +0, +0
118+1, +0, +0
119slice(:,:,2) =
120+0, +0, +0
121+1, +1, +0
122+1, +1, +0
123slice(:,:,3) =
124+0, +0, +1
125+0, +0, +0
126+1, +1, +1
127
128
Bug:

Status: Unresolved
Source: Intel Classic Fortran Compiler ifort version 2021.5
Description: The Intel Classic Fortran Compiler ifort version 2021.5 cannot not compile the following interface specification for the procedures, yielding "ambiguous interface" error.
module container_module
use iso_fortran_env
integer, parameter :: lkc = logical_kinds(1)
integer, parameter :: ikc = integer_kinds(1)
type :: container_ik(kind)
integer , kind :: kind = integer_kinds(1)
integer(kind) :: value
end type
type :: container_lk(kind)
integer , kind :: kind = logical_kinds(1)
logical(kind) :: value
end type
end module
module disp_module
use container_module
type :: disp_type
end type
interface show
module subroutine show_logical(self, object)
use container_module, only: container => container_lk
class(disp_type) , intent(inout) :: self
!type(container_lk(lkc)) , intent(in) :: object
type(container(lkc)) , intent(in) :: object
end subroutine
module subroutine show_integer(self, object)
use container_module, only: container => container_ik
class(disp_type) , intent(inout) :: self
!type(container_ik(ikc)) , intent(in) :: object
type(container(ikc)) , intent(in) :: object
end subroutine
end interface
end module
end

Note that the issue is with the aliasing of the pm_container module entities use container_module, only: container => container_ik.
Remedy (as of ParaMonte Library version 2.0.0): For now, all interfaces were painfully converted to explicit type names (instead of aliases).

Todo:
Critical Priority: The syntax of the procedure interfaces must be fixed and reverted to the original aliasing style, as soon as the Intel Classic Fortran Compiler ifort version 2021.5 bug is resolved. Note that GNU Fortran Compiler gfortran version 10-11 has no problem compiling the code.


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, Oct 16, 2009, 11:14 AM, Michigan

Definition at line 11726 of file pm_io.F90.


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