Contains data_types and function for matrix operations
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private, | parameter | :: | maxIntp_order | = | 2 | |
integer, | private, | parameter, dimension(maxIntp_order) | :: | nCoeffs_1D | = | (/2, 3/) | For 1D stencil, 2 unknown coeffs: p(x)=a0+a1 x for linear 1st order interpolation 3 unknown coeffs: p(x)=a0+a1 x+a2 x^2 for quadratic 2nd order interpolation |
integer, | private, | parameter, dimension(maxIntp_order) | :: | nCoeffs_2D | = | (/3, 6/) | For 2D stencil, 3 unknown coeffs for linear 1st order interpolation: p(x,y)=a0+a1 x+a2 y 6 unknown coeffs for quadratic 2nd order interpolation: p(x,y)=a0+a1 x+a2 y+a3 x^2+a4 y^2+ a5 xy |
integer, | private, | parameter, dimension(maxIntp_order) | :: | nCoeffs_3D | = | (/4, 10/) | For 3D stencil, 4 unknown coeffs for linear 1st order interpolation: p(x,y,z)=a0+a1 x+a2 y+a3 z 10 unknown coeffs for quadratic 2nd order interpolation: p(x,y,z)=a0+a1 x+a2 y+a3 z+a4 x^2+a5 y^2+ a6 z^2+ a7 xy + a8 yz + a9 zx |
initialize the dynamic array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type), | intent(out) | :: | me | |||
integer, | intent(in), | optional | :: | length |
truncate the array, meaning cut off the trailing empty entries
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me |
empty the entries without changing arrays
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me |
destroy the dynamic array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type), | intent(inout) | :: | me |
insert an element at a given position
adds the value to a given position inside the growing array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val | |||
integer, | intent(in) | :: | pos | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
adds the values starting from a given position inside the growing array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val(:) | |||
integer, | intent(in) | :: | pos | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
append a value to the dynamic array and return its position.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val(:) | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
increase the size of the container for the array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
integer, | intent(in), | optional | :: | pos | ||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
This routine initialize interpolation matrix for least square fit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(out) | :: | me | |||
integer, | intent(in) | :: | length | |||
integer, | intent(in) | :: | nDims | |||
integer, | intent(in) | :: | order |
This routine builds up the matrix for least square fit used in linear and quadratic interpolation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me | intpMatrix for LSF fill |
||
integer, | intent(inout) | :: | order | interpolation order calculated for current element depending on nSources if quadratic LSF matrix is singular fall back to linear |
||
integer, | intent(in) | :: | Number of stencil directions |
|||
integer, | intent(in) | :: | nDims | Number of dimensions |
||
integer, | intent(in) | :: | nSources | Number of sources from coarser found |
||
real(kind=rk), | intent(in) | :: | cxDirRK(3,QQ) | Stencil directions |
||
integer, | intent(in) | :: | neighDir(nSources) | direction in which sources are found |
||
integer, | intent(out) | :: | pos | Pointer to position of interpolation matrix in growing array of matrix |
||
logical, | intent(out) | :: | success | success if false if matrix is singular reduce interpolation order |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me |
This routine provides assignment operator of tem_matrix_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type), | intent(out) | :: | left | |||
type(tem_matrix_type), | intent(in) | :: | right |
This derived type encapsulates the definition of the matrix
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | private, | allocatable | :: | A(:,:) | inverted matrix to solve linear system of equation |
||
integer, | private | :: | nEntries(2) | how many entries are in the 2d matrix? |
This derived type encapsulates the definition of least square fit matrix for interpolation method which is required for every combination of available nSourceFromCoarser
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(grw_matrixarray_type), | private | :: | matArray | ||||
type(dyn_intarray_type), | private | :: | ID | Unique hash ID to identify different combination of available nSourceFromCoarser |
|||
integer, | private | :: | nCoeffs | nCoeffs required for least square fit. Depends on nDims and order of interpolation |
|||
type(grw_logicalarray_type), | private | :: | isInvertible | For every matrix in matArray, store if its invertible or not to avoid rebuilding singular matrix |
growing array type for type(tem_matrix_type)
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private | :: | nvals | = | 0 | ||
integer, | private | :: | containersize | = | 0 | ||
type(tem_matrix_type), | private, | allocatable | :: | val(:) |
Returns the inverse of a matrix calculated by finding the LU decomposition. Depends on LAPACK.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in), | dimension(:,:) | :: | A | Matrix to invert |
|
integer, | intent(out), | optional | :: | errCode | If error code is present return error code and do not abort |
inverse of A
This function returns matrix entries for quadratic polynomial for 1D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
This function returns matrix entries for quadratic polynomial for 2D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
This function returns matrix entries for quadratic polynomial for 3D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
This function returns matrix entries for Linear polynomial for 1D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
This function returns matrix entries for Linear polynomial for 2D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
This function returns matrix entries for Linear polynomial for 3D stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | cxDir(3) |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type), | intent(in) | :: | me | |||
integer, | intent(in) | :: | outUnit |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type), | intent(out) | :: | me | |||
integer, | intent(in), | optional | :: | length |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type), | intent(inout) | :: | me |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me |
adds the value to a given position inside the growing array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val | |||
integer, | intent(in) | :: | pos | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
adds the values starting from a given position inside the growing array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val(:) | |||
integer, | intent(in) | :: | pos | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
type(tem_matrix_type), | intent(in) | :: | val(:) | |||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_matrixarray_type) | :: | me | ||||
integer, | intent(in), | optional | :: | pos | ||
integer, | intent(in), | optional | :: | length | optional length to expand the array |
This routine initialize interpolation matrix for least square fit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(out) | :: | me | |||
integer, | intent(in) | :: | length | |||
integer, | intent(in) | :: | nDims | |||
integer, | intent(in) | :: | order |
This routine builds up the matrix for least square fit used in linear and quadratic interpolation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me | intpMatrix for LSF fill |
||
integer, | intent(inout) | :: | order | interpolation order calculated for current element depending on nSources if quadratic LSF matrix is singular fall back to linear |
||
integer, | intent(in) | :: | Number of stencil directions |
|||
integer, | intent(in) | :: | nDims | Number of dimensions |
||
integer, | intent(in) | :: | nSources | Number of sources from coarser found |
||
real(kind=rk), | intent(in) | :: | cxDirRK(3,QQ) | Stencil directions |
||
integer, | intent(in) | :: | neighDir(nSources) | direction in which sources are found |
||
integer, | intent(out) | :: | pos | Pointer to position of interpolation matrix in growing array of matrix |
||
logical, | intent(out) | :: | success | success if false if matrix is singular reduce interpolation order |
This routine builds up the matrix for least square fit used in quadratic interpolation. We extract momentum information completely on the view of the source coordinate system Set the right hand side of the equation system Solve the problem, where b = rhs, x = coefficients Ax = b overdetermined, solve the least Square fit problem (A^T)Ax = (A^T)b x = ((A^T)A)^-1(A^T)b Solve linear system of equation with inverted matrix. Size of matrix: (nCoeffs, QQ) matrix_LSF = ((A^T)A)^-1(A^T)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type), | intent(out) | :: | me | Matrix to fill |
||
integer, | intent(in) | :: | Number of stencil directions |
|||
integer, | intent(in) | :: | nDims | Number of dimensions |
||
integer, | intent(in) | :: | nSources | Number of sources from coarser found |
||
real(kind=rk), | intent(in) | :: | cxDirRK(3,QQ) | Stencil directions |
||
integer, | intent(in) | :: | neighDir(nSources) | direction in which sources are found |
||
integer, | intent(in) | :: | nCoeffs | nUnknown coeffs |
||
logical, | intent(out) | :: | success | success if false if matrix is singular reduce interpolation order |
This routine builds up the matrix for least square fit used in linear interpolation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type), | intent(out) | :: | me | Matrix to fill |
||
integer, | intent(in) | :: | Number of stencil directions |
|||
integer, | intent(in) | :: | nDims | Number of dimensions |
||
integer, | intent(in) | :: | nSources | Number of sources from coarser found |
||
real(kind=rk), | intent(in) | :: | cxDirRK(3,QQ) | Stencil directions |
||
integer, | intent(in) | :: | neighDir(nSources) | direction in which sources are found |
||
integer, | intent(in) | :: | nCoeffs | nUnknown coeffs |
||
logical, | intent(out) | :: | success | success if false if matrix is singular reduce interpolation order |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_intpMatrixLSF_type), | intent(inout) | :: | me |
This routine provides assignment operator of tem_matrix_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type), | intent(out) | :: | left | |||
type(tem_matrix_type), | intent(in) | :: | right |
This routine allocates matrix with given dimentions
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_matrix_type) | :: | me | ||||
integer, | intent(in) | :: | dim1 | |||
integer, | intent(in) | :: | dim2 |