utilities_m Module

Utility module containing miscellaneous tools that don't quite fit anywhere else.


Uses

  • module~~utilities_m~~UsesGraph module~utilities_m utilities_m iso_fortran_env iso_fortran_env module~utilities_m->iso_fortran_env

Used by

  • module~~utilities_m~~UsedByGraph module~utilities_m utilities_m program~animate animate program~animate->module~utilities_m module~easy_plplot_m easy_plplot_m program~animate->module~easy_plplot_m module~easy_plplot_m->module~utilities_m program~basic basic program~basic->module~utilities_m program~basic->module~easy_plplot_m program~logo logo program~logo->module~utilities_m program~logo->module~easy_plplot_m program~examples examples program~examples->module~easy_plplot_m

Contents


Interfaces

public interface mixval

Return a 2-vector comprising the minimum and maximum values of an array

  • private function mixval_1(x) result(b)

    Return [hi,low] for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:):: x

    Array to find extrema in

    Return Value real(kind=wp),dimension(2)

  • private function mixval_2(x) result(b)

    Return [hi,low] for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :):: x

    Array to find extrema in

    Return Value real(kind=wp),dimension(2)

  • private function mixval_3(x) result(b)

    Return [hi,low] for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :, :):: x

    Array to find extrema in

    Return Value real(kind=wp),dimension(2)

public interface span

Return a the maximum-minumum values of an array

  • private function span_1(x) result(o)

    Return hi-low for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:):: x

    Array to find span in

    Return Value real(kind=wp)

  • private function span_2(x) result(o)

    Return hi-low for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :):: x

    Array to find span in

    Return Value real(kind=wp)

  • private function span_3(x) result(o)

    Return hi-low for an array

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :, :):: x

    Array to find span in

    Return Value real(kind=wp)

public interface flatten

Reduce an array to one dimension

  • private function flatten_2(A) result(o)

    Convert a 2d array to 1d

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :):: A

    Array to convert

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

  • private function flatten_3(A) result(o)

    Convert a 3d array to 1d

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=wp), intent(in), dimension(:, :, :):: A

    Array to convert

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


Functions

public function linspace(l, h, N) result(o)

Return an array of evenly-spaced values

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in) :: l

Low-bound for values

real(kind=wp), intent(in) :: h

High-bound for values

integer, intent(in), optional :: N

Number of values (default 20)

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

public function startsWith(text, str) result(o)

Test if text starts with str

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: text

Text to search

character, intent(in) :: str

String to look for

Return Value logical

public function endsWith(text, str) result(o)

Test if text ends with str

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: text

Text to search

character, intent(in) :: str

String to look for

Return Value logical

public function randomNormal() result(o)

Return a sample from an approximate normal distribution with a mean of and a standard deviation of . In this approximate distribution, .

Arguments

None

Return Value real(kind=wp)

public function randomUniform() result(o)

Return a sample from a uniform distribution in the range .

Arguments

None

Return Value real(kind=wp)

public function meshGridX(x, y) result(o)

Construct a 2d array of X values from a structured grid

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in), dimension(:):: x

x-positions in grid

real(kind=wp), intent(in), dimension(:):: y

y-positions in grid

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

public function meshGridY(x, y) result(o)

Construct a 2d array of Y values from a structured grid

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in), dimension(:):: x

x-positions in grid

real(kind=wp), intent(in), dimension(:):: y

y-positions in grid

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

public function colorize(s, c) result(o)

Add terminal format codes to coloize a string

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: s

String to colorize

integer, dimension(3):: c

Color code in [r,g,b] where

Return Value character,allocatable

public pure function real2char(a, f, l) result(o)

Convert a real to a character

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in) :: a

Real value to convert

character, intent(in), optional :: f

Format of result

integer, intent(in), optional :: l

Length of result

Return Value character,allocatable

public pure function int2char(a, f, l) result(o)

Convert an integer to a character

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: a

Integer value to convert

character, intent(in), optional :: f

Format of result

integer, intent(in), optional :: l

Length of result

Return Value character,allocatable

public function mean(d) result(o)

Compute the arithmetic mean of an array

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in), dimension(:):: d

Return Value real(kind=wp)

public function stdev(d) result(o)

Compute the standard deviation of an array

Arguments

TypeIntentOptionalAttributesName
real(kind=wp), intent(in), dimension(:):: d

Return Value real(kind=wp)


Subroutines

public subroutine showProgress(m, p)

Show a progress bar with a message

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: m

Message to show

real(kind=wp), intent(in) :: p

Progress level