|
| 1 | +! |
| 2 | +! (c) 2019-2020 Guide Star Engineering, LLC |
| 3 | +! This Software was developed for the US Nuclear Regulatory Commission (US NRC) under contract |
| 4 | +! "Multi-Dimensional Physics Implementation into Fuel Analysis under Steady-state and Transients (FAST)", |
| 5 | +! contract # NRC-HQ-60-17-C-0007 |
| 6 | +! |
| 7 | +module array_functions_interface |
| 8 | + !! author: Damian Rouson |
| 9 | + !! date: 04/25/2019 |
| 10 | + !! |
| 11 | + !! Functionally pure array utilities |
| 12 | + implicit none |
| 13 | + |
| 14 | + private |
| 15 | + public :: operator(.catColumns.) |
| 16 | + public :: operator(.catRows.) |
| 17 | + public :: operator(.columnVectors.) |
| 18 | + !! Because the Fortran standard requires that operator dummy arguments have the intent(in) attribute |
| 19 | + !! exposing only the operator and not the function names communicates more information in the |
| 20 | + !! public interface and in code using this interface. |
| 21 | + |
| 22 | + interface operator(.columnVectors.) |
| 23 | + module procedure column_vectors |
| 24 | + end interface |
| 25 | + |
| 26 | + interface operator(.catColumns.) |
| 27 | + module procedure concatenate_columns |
| 28 | + end interface |
| 29 | + |
| 30 | + interface operator(.catRows.) |
| 31 | + module procedure concatenate_rows |
| 32 | + end interface |
| 33 | + |
| 34 | + interface |
| 35 | + |
| 36 | + pure module function column_vectors(vector_field) RESULT(array_of_3D_column_vectors) |
| 37 | + !! Result is array of 3D column vectors of dimension (space_dim,nx*ny*nz) reshaped from vector-field argument |
| 38 | + !! of dimension (nx,ny,nz,space_dim) |
| 39 | + implicit none |
| 40 | + real, dimension(:,:,:,:), intent(in) :: vector_field |
| 41 | + real, dimension(:,:), allocatable :: array_of_3D_column_vectors |
| 42 | + end function |
| 43 | + |
| 44 | + pure module function concatenate_columns(a, b) RESULT(concatenated) |
| 45 | + !! Result contains the concatenation of the columns of argument a with the columns of argument b |
| 46 | + implicit none |
| 47 | + real, dimension(:,:), intent(in) :: a, b |
| 48 | + real, dimension(:,:), allocatable :: concatenated |
| 49 | + end function |
| 50 | + |
| 51 | + pure module function concatenate_rows(a, b) RESULT(concatenated) |
| 52 | + !! Result contains the concatenation of the rows of argument a with the rows of argument b |
| 53 | + implicit none |
| 54 | + real, dimension(:,:), intent(in) :: a, b |
| 55 | + real, dimension(:,:), allocatable :: concatenated |
| 56 | + end function |
| 57 | + |
| 58 | + end interface |
| 59 | + |
| 60 | +end module |
0 commit comments