support_functions Module

Contains various support and math functions


Used by


Interfaces

public interface findIndices

  • public pure module function findIndicesMatrix(mask) result(indices)

    Find locations of .true. values in logical mask of rank 2

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in), dimension(:,:) :: mask

    Return Value integer(kind=ik), dimension(:,:), allocatable

  • public pure module function findIndicesVector(mask) result(indices)

    Find locations of .true. values in logical mask of rank 1

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in), dimension(:) :: mask

    Return Value integer(kind=ik), dimension(:), allocatable

public interface removeName

  • public pure elemental module function removeNameIntArray(input) result(output)

    Remove name from named integer array and return IntArray

    Arguments

    Type IntentOptional Attributes Name
    type(NamedIntegerArray), intent(in) :: input

    Return Value type(IntArray)

  • public pure elemental module function removeNameRealArray(input) result(output)

    Remove name from named real array and return RealArray

    Arguments

    Type IntentOptional Attributes Name
    type(NamedRealArray), intent(in) :: input

    Return Value type(RealArray)

  • public pure elemental module function removeNameLogicalArray(input) result(output)

    Remove name from named logical array and return LogicalArray

    Arguments

    Type IntentOptional Attributes Name
    type(NamedLogicalArray), intent(in) :: input

    Return Value type(LogicalArray)

interface

  • public pure module function allCombinations(array) result(res)

    Convert IntArray(:) vector into a 2D array of shape (size(IntArray),:) containing all possible combination of IntArray(:)%entries. Works only for sizes 1 and 3

    Arguments

    Type IntentOptional Attributes Name
    type(IntArray), intent(in), dimension(:) :: array

    Return Value integer(kind=ik), dimension(:,:), allocatable

interface

  • public pure module function findNearestPointsInArray(array, point) result(pair)

    Finds indices of two of the values nearest to a point in a monotonic array

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in), dimension(:) :: array
    real(kind=rk), intent(in) :: point

    Return Value integer(kind=ik), dimension(2)

interface

  • public elemental module function expInt1(val) result(res)

    Allan and Hastings approximation of E1 exponential integral, with coefficients from routine in: Shanjie Zhang, Jianming Jin, Computation of Special Functions, Wiley, 1996, ISBN: 0-471-11963-6, LC: QA351.C45.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in) :: val

    Return Value real(kind=rk)

interface

  • public pure module function removeDupeInts(array) result(uniques)

    Removes duplicates from integer array - unoptimized

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=ik), intent(in), dimension(:) :: array

    Return Value integer(kind=ik), allocatable, dimension(:)

interface

  • public pure module function withinBounds(array, lowerBound, upperBound) result(res)

    Returns map array >= lowerBound .and. array <= upperBound

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=ik), intent(in), dimension(:) :: array
    integer(kind=ik), intent(in) :: lowerBound
    integer(kind=ik), intent(in) :: upperBound

    Return Value logical, allocatable, dimension(:)

interface

  • public pure module function flatTensorProduct(array1, array2, array3) result(res)

    Takes a 3-fold tensor product of rank-1 real arrays and flattens it

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in), dimension(:) :: array1
    real(kind=rk), intent(in), dimension(:) :: array2
    real(kind=rk), intent(in), dimension(:) :: array3

    Return Value real(kind=rk), dimension(:), allocatable

interface

  • public pure module function jaggedArray(array, mask) result(res)

    Takes rank-2 array and optional mask and produces rank-1 array of realArrays - a jagged array - by masking the first dimension

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in), dimension(:,:) :: array
    logical, intent(in), optional, dimension(:,:) :: mask

    Return Value type(RealArray), dimension(:), allocatable

interface

  • public pure module function allPl(points, maxL) result(res)

    Return rank-2 array of Legendre polynomials evaluated at given points. Result shape is (size(points),0:maxL). Uses recursion formula.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in), dimension(:) :: points
    integer(kind=ik), intent(in) :: maxL

    Return Value real(kind=rk), allocatable, dimension(:,:)

interface

  • public pure module function shiftedFlatTensorProduct(array1, array2, shiftArray, power) result(res)

    Takes 2 arrays and produces a flattened tensor product, such that array1's dimension is the inner dimension. If present, shift array should conform to array2 and will be added to array1 as the product is taken The shifted array1 is then optionally raised to a power.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=rk), intent(in), dimension(:) :: array1
    real(kind=rk), intent(in), dimension(:) :: array2
    real(kind=rk), intent(in), optional, dimension(:) :: shiftArray
    real(kind=rk), intent(in), optional :: power

    Return Value real(kind=rk), dimension(:), allocatable

interface

  • public pure module function triangularIntArray(dim, lower) result(res)

    Returns upper or lower triangular pattern as IntArrays with dimension dim

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=ik), intent(in) :: dim
    logical, intent(in), optional :: lower

    Return Value type(IntArray), dimension(:), allocatable