N-dimensional array encapsulation.
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.
Interfaces to output routines in pf_numpy.c
Subroutine to make a directory for output
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=c_char), | intent(in) | :: | dname | |||
integer, | intent(in), | value | :: | dlen |
Interfaces to output routines in pf_numpy.c
Subroutine to write an the array to a file
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, | intent(in), | value | :: | dim | ||
integer, | intent(in), | value | :: | mpibuflen | ||
integer, | intent(in) | :: | shape(dim) | |||
real(kind=c_double), | intent(in) | :: | array(mpibuflen) |
Type to create and destroy N-dimenstional arrays
procedure, public :: create_single => ndarray_create_single | |
procedure, public :: create_array => ndarray_create_array | |
procedure, public :: destroy_single => ndarray_destroy_single | |
procedure, public :: destroy_array => ndarray_destroy_array |
N-dimensional array type, extends the abstract encap type
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | dim | ||||
integer, | public, | allocatable | :: | shape(:) | |||
real(kind=pfdp), | public, | allocatable | :: | flatarray(:) |
procedure, public :: setval => ndarray_setval | |
procedure, public :: copy => ndarray_copy | |
procedure, public :: norm => ndarray_norm | |
procedure, public :: pack => ndarray_pack | |
procedure, public :: unpack => ndarray_unpack | |
procedure, public :: axpy => ndarray_axpy | |
procedure, public :: eprint => ndarray_eprint |
Subroutine to define the norm of the array (here the max norm)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(in) | :: | this | |||
integer, | intent(in), | optional | :: | flags |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(in), | target | :: | encap_polymorph |
Helper function to return the array part
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(in), | target | :: | x | ||
integer, | intent(in), | optional | :: | flags |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(in) | :: | x | |||
integer, | intent(in), | optional | :: | flags |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(in) | :: | x | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to allocate the array and set the size parameters
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(inout) | :: | q | |||
integer, | intent(in) | :: | shape(:) |
Subroutine to create a single array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pf_encap_t), | intent(inout) | :: | encap |
Subroutine to destroy an single array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray_factory), | intent(inout) | :: | this | |||
class(pf_encap_t), | intent(inout), | allocatable | :: | x(:) | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | level | |||
integer, | intent(in) | :: | shape(:) |
The following are the base subroutines that all encapsulations must provide
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
real(kind=pfdp), | intent(in) | :: | val | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to copy an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(in) | :: | this | |||
real(kind=pfdp), | intent(out) | :: | z(:) | |||
integer, | intent(in), | optional | :: | flags |
Subroutine to unpack a flatarray after receiving
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | 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)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(ndarray), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | flags |