When a new solution is created by a PFASST level, this encapsulation
uses the levels 'shape' attribute to create a new array with that
shape. Thus, the 'shape' attributes of the PFASST levels should be
set appropriately. For example, before calling pf_pfasst_run we can
set the shape of the coarsest level by doing:
allocate(pf%levels(1)%shape(2))
pf%levels(1)%shape = [ 3, 10 ]
The helper routines array1, array2, array3, etc can be used to
extract pointers to the encapsulated array from a C pointer without
performing any copies.
Uses
module~~pf_mod_ndarray_oc~~UsesGraph
module~pf_mod_ndarray_oc
pf_mod_ndarray_oc
module~pf_mod_dtype
pf_mod_dtype
module~pf_mod_ndarray_oc->module~pf_mod_dtype
iso_c_binding
iso_c_binding
module~pf_mod_ndarray_oc->iso_c_binding
module~pf_mod_dtype->iso_c_binding
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Interfaces
interface
public subroutine ndarray_mkdir(dname, dlen) bind(c)
Arguments
Type
Intent Optional
Attributes Name
character(len=c_char),
intent(in)
::
dname
integer(kind=c_int),
intent(in),
value ::
dlen
interface
public subroutine ndarray_dump_numpy(dname, fname, endian, dim, shape, nvars, array) bind(c)
Arguments
Type
Intent Optional
Attributes Name
character(len=c_char),
intent(in)
::
dname
character(len=c_char),
intent(in)
::
fname
character(len=c_char),
intent(in)
::
endian (5)
integer(kind=c_int),
intent(in),
value ::
dim
integer(kind=c_int),
intent(in)
::
shape (dim)
integer(kind=c_int),
intent(in),
value ::
nvars
real(kind=pfdp),
intent(in)
::
array (nvars)
Derived Types
Type to create and destroy N-dimenstional arrays for optimal control
Type-Bound Procedures
N-dimensional array type for optimal control, extends the abstract encap type
Components
Type Visibility
Attributes Name Initial
integer,
public
::
dim
integer,
public,
allocatable ::
shape (:)
real(kind=pfdp),
public,
allocatable ::
yflatarray (:)
real(kind=pfdp),
public,
allocatable ::
pflatarray (:)
Type-Bound Procedures
procedure, public :: setval => ndarray_oc_setval
procedure, public :: copy => ndarray_oc_copy
procedure, public :: norm => ndarray_oc_norm
procedure, public :: pack => ndarray_oc_pack
procedure, public :: unpack => ndarray_oc_unpack
procedure, public :: axpy => ndarray_oc_axpy
procedure, public :: eprint => ndarray_oc_eprint
Functions
Subroutine to define the norm of the array (here the max norm)
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(in)
::
this
integer,
intent(in),
optional
::
flags
Return Value real(kind=pfdp)
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(in),
target ::
encap_polymorph
Return Value type(ndarray_oc ),
pointer
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(in),
target ::
x
integer,
intent(in),
optional
::
flags
Return Value real(kind=pfdp),
pointer, (:)
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(in)
::
x
integer,
intent(in),
optional
::
flags
Return Value real(kind=pfdp),
pointer, (:,:)
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(in)
::
x
integer,
intent(in),
optional
::
flags
Return Value real(kind=pfdp),
pointer, (:,:,:)
Subroutines
Subroutine to allocate the array and set the size parameters
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(inout)
::
q
integer,
intent(in)
::
shape (:)
Subroutine to create a single array
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc_factory ),
intent(inout)
::
this
class(pf_encap_t ),
intent(inout),
allocatable ::
x
integer,
intent(in)
::
level
integer,
intent(in)
::
shape (:)
Subroutine to create an array of arrays
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc_factory ),
intent(inout)
::
this
class(pf_encap_t ),
intent(inout),
allocatable ::
x (:)
integer,
intent(in)
::
n
integer,
intent(in)
::
level
integer,
intent(in)
::
shape (:)
Subroutine to destroy array
Arguments
Type
Intent Optional
Attributes Name
class(pf_encap_t ),
intent(inout)
::
encap
Subroutine to destroy an single array
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc_factory ),
intent(inout)
::
this
class(pf_encap_t ),
intent(inout),
allocatable ::
x
integer,
intent(in)
::
level
integer,
intent(in)
::
shape (:)
Subroutine to destroy an array of arrays
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc_factory ),
intent(inout)
::
this
class(pf_encap_t ),
intent(inout),
allocatable ::
x (:)
integer,
intent(in)
::
n
integer,
intent(in)
::
level
integer,
intent(in)
::
shape (:)
Subroutine to set array to a scalar value.
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(inout)
::
this
real(kind=pfdp),
intent(in)
::
val
integer,
intent(in),
optional
::
flags
Subroutine to copy an array
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(inout)
::
this
class(pf_encap_t ),
intent(in)
::
src
integer,
intent(in),
optional
::
flags
Subroutine to pack an array into a flat array for sending
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(in)
::
this
real(kind=pfdp),
intent(out)
::
z (:)
integer,
intent(in),
optional
::
flags
Subroutine to unpack a flatarray after receiving
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(inout)
::
this
real(kind=pfdp),
intent(in)
::
z (:)
integer,
intent(in),
optional
::
flags
Subroutine to compute y = a x + y where a is a scalar and x and y are arrays
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(inout)
::
this
real(kind=pfdp),
intent(in)
::
a
class(pf_encap_t ),
intent(in)
::
x
integer,
intent(in),
optional
::
flags
Subroutine to print the array to the screen (mainly for debugging purposes)
Arguments
Type
Intent Optional
Attributes Name
class(ndarray_oc ),
intent(inout)
::
this
integer,
intent(in),
optional
::
flags