Documentation for module util

All kind of helpfull little routines

source: util.F
Loading...

Generic procedures:

find_boundary
sort
sort_unique

public Subroutines/Functions:

FUNCTION
INTEGER
get_limit (m, n, me)
divide m entries into n parts, return size of part me
FUNCTION
INTEGER
locate (array, x)
Purpose: Given an array array(1:n), and given a value x, a value x_index is returned which is the index value of the array element equal to the value x: x = array(x_index) The array must be monotonic increasing. x_index = 0 is returned, if no array element equal to the value of x was found.

Generic procedure find_boundary

...

INTEGER,
POINTER
:: num_array(:) ×
INTEGER
:: ntot × ×
INTEGER
:: first × ×
INTEGER
:: last × ×
INTEGER
:: search ×
INTEGER,
POINTER
:: num_array1(:) ×
INTEGER,
POINTER
:: num_array2(:) ×
INTEGER
:: search1 ×
INTEGER
:: search2 ×

Generic procedure sort

...

REAL(sp),
INTENT(inout)
:: arr(1:n) ×
REAL(dp),
INTENT(inout)
:: arr(1:n) ×
INTEGER(int_4),
INTENT(inout)
:: arr(1:n) ×
INTEGER(int_8),
INTENT(inout)
:: arr(1:n) ×
CHARACTER(*),
INTENT(inout)
:: arr(1:n) ×
INTEGER,
INTENT(in)
:: n × × × × ×
INTEGER,
INTENT(out)
:: indices(1:n) × × × ×
INTEGER,
INTENT(out)
:: index(1:n) ×
INTEGER,
INTENT(inout)
:: index(:) × ×
INTEGER,
INTENT(inout)
:: matrix(:,:) ×
CHARACTER(*),
INTENT(inout)
:: matrix(:,:) ×
INTEGER,
INTENT(in)
:: istart × ×
INTEGER,
INTENT(in)
:: iend × ×
INTEGER,
INTENT(in)
:: j × ×
INTEGER,
INTENT(in)
:: jsize × ×

Generic procedure sort_unique

Sorts and returns a logical that checks if all elements are unique

INTEGER,
INTENT(inout)
:: arr(:) ×
LOGICAL,
INTENT(out)
:: unique ×

FUNCTIONget_limit(m, n, me)

divide m entries into n parts, return size of part me

Return Value ::
INTEGER
Arguments:
INTEGER,
INTENT(in)
:: m ...
INTEGER,
INTENT(in)
:: n ...
INTEGER,
INTENT(in)
:: me ...

FUNCTIONlocate(array, x)

Purpose: Given an array array(1:n), and given a value x, a value x_index is returned which is the index value of the array element equal to the value x: x = array(x_index) The array must be monotonic increasing. x_index = 0 is returned, if no array element equal to the value of x was found.

Return Value ::
INTEGER
Arguments:
INTEGER,
INTENT(in)
:: array(:) ...
INTEGER,
INTENT(in)
:: x ...

SUBROUTINEfind_boundary1(num_array, ntot, first, last, search)

finds boundary where element search starts and ends in a 1D array array1: XXXXXAAAAAAAAAXXDGFSFGWDDDDDDDAAAWE | | start end (searching for A)

Arguments:
INTEGER,
POINTER
:: num_array(:) ...
INTEGER
:: ntot ...
INTEGER
:: first ...
INTEGER
:: last ...
INTEGER
:: search ...

SUBROUTINEfind_boundary2(num_array1, num_array2, ntot, first, last, search1, search2)

finds boundary where element search1 starts and ends in array1 checking at the same time search2 in array2 array1: XXXXXAAAAAAAAAXXDGFSFGWDDDDDDDAAAWE array2: XXXXASDEYYYYASDEFAAAARGASGASRGAWRRR | | start end (searching for A and Y)

Arguments:
INTEGER,
POINTER
:: num_array1(:) ...
INTEGER,
POINTER
:: num_array2(:) ...
INTEGER
:: ntot ...
INTEGER
:: first ...
INTEGER
:: last ...
INTEGER
:: search1 ...
INTEGER
:: search2 ...

SUBROUTINEsort_cv(arr, n, index)

Sorts an array of strings

Arguments:
CHARACTER(*),
INTENT(inout)
:: arr(1:n) ...
INTEGER,
INTENT(in)
:: n ...
INTEGER,
INTENT(out)
:: index(1:n) ...

RECURSIVE SUBROUTINEsort_im(matrix, istart, iend, j, jsize, index)

Sorts a multiple arrays of integers M(j,i), ordering iteratively over i with fixed j

Arguments:
INTEGER,
INTENT(inout)
:: matrix(:,:) ...
INTEGER,
INTENT(in)
:: istart ...
INTEGER,
INTENT(in)
:: iend ...
INTEGER,
INTENT(in)
:: j ...
INTEGER,
INTENT(in)
:: jsize ...
INTEGER,
INTENT(inout)
:: index(:) ...

RECURSIVE SUBROUTINEsort_cm(matrix, istart, iend, j, jsize, index)

Sorts a multiple arrays of strings C(j,i), ordering iteratively over i with fixed j

Arguments:
CHARACTER(*),
INTENT(inout)
:: matrix(:,:) ...
INTEGER,
INTENT(in)
:: istart ...
INTEGER,
INTENT(in)
:: iend ...
INTEGER,
INTENT(in)
:: j ...
INTEGER,
INTENT(in)
:: jsize ...
INTEGER,
INTENT(inout)
:: index(:) ...

SUBROUTINEsort_unique1(arr, unique)

Sorts and returns a logical that checks if all elements are unique

Arguments:
INTEGER,
INTENT(inout)
:: arr(:) ...
LOGICAL,
INTENT(out)
:: unique ...