Manual Reference Pages - set (3m_msg)
NAME
set(3f) - [M_msg] set scalars from an array
(LICENSE:PD)
CONTENTS
Synopsis
Description
Options
Examples
Author
License
SYNOPSIS
Syntax:
function set(g0,g1,g2,g3,g4,g5,g6,g7,g8,g9,&
& ga,gb,gc,gd,ge,gf,gg,gh,gi,gj,gk)
class(*),intent(in) :: g0
class(*),intent(out),optional :: g1,g2,g3,g4,g5,g6,g7,g8,g9,ga
class(*),intent(out),optional :: gb,gc,gd,ge,gf,gg,gh,gi,gj,gk
DESCRIPTION
set(3f) sets up to twenty scalars to elements from an array.
Sort of like an equivalence.
OPTIONS
|
g0(:) |
array to read values from. Can be of type INTEGER or REAL
|
|
g[1-9a-k] |
| |
optional values to set to an array element. Can
be of type INTEGER or REAL
|
|
EXAMPLES
Sample program:
program demo_set
use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
use,intrinsic :: iso_fortran_env, only : real32, real64, real128
use M_msg, only : set
implicit none
real(kind=real32) :: a; namelist /all/a
real(kind=real64) :: b; namelist /all/b
real(kind=real128) :: c; namelist /all/c
integer(kind=int8) :: i; namelist /all/i
integer(kind=int16) :: j; namelist /all/j
integer(kind=int32) :: k; namelist /all/k
integer(kind=int64) :: l; namelist /all/l
integer :: iarr(7)=[1,2,3,4,5,6,7]
call set(iarr,a,b,c,i,j,k,l)
write(*,nml=all)
call set(10,a)
call set(100,l)
write(*,nml=all)
end program demo_set
Results:
&ALL
A = 1.000000 ,
B = 2.00000000000000 ,
C = 3.00000000000000000000000000000000 ,
I = 4,
J = 5,
K = 6,
L = 7
/
&ALL
A = 10.00000 ,
B = 2.00000000000000 ,
C = 3.00000000000000000000000000000000 ,
I = 4,
J = 5,
K = 6,
L = 100
/
AUTHOR
John S. Urban
LICENSE
Public Domain