Globals Library 1.0
|
Data Types | |
type | file |
Functions/Subroutines | |
logical function | ioerr (lun, errno, call_proc, add_msg, add_int) |
Handle and write alert I/O warnings and errors. | |
character(len=len(strin)) function | to_upper (strin) |
Transform string to upper case. | |
character(len=len(strin)) function | to_lower (strin) |
Transform string to lowercase case. | |
character(len=len_trim(adjustl(strin))) function | etb (strin) |
Return string strin with no preceding and trailing spaces. | |
character(len=len_trim(adjustl(strin))) function | erase_comment (strin) |
Erase comments from a string. | |
real(kind=double) function, dimension(3) | avg_vec3 (avg_type, veca, vecb, vecc) |
Function that calculates vectors averages. | |
real(kind=double) function | avg_scal (avg_type, a, b, c) |
Function that calculates scalar averages. | |
real(kind=double) function, dimension(3) | cross (veca, vecb) |
Function that calculates cross-products. | |
subroutine | isort (narray, array) |
Simple sort algorithm to sort in increasing order an integer array. To be used only for small array. Use globals::global_heapsort for big arrays. | |
subroutine | unique_of_sorted (n_elements, elements, nunique) |
Given a sorted array, it is returned with the list of uniques elements in the first positions. | |
logical function | lexicographic_order (n, a, b) |
Check if the first array is in lexicographic order with respect to the second. | |
subroutine | global_heapsort (n, indx, i, j, isgn) |
global_heapsort | |
integer function | ifind (narray, array, tobefound) |
ifind | |
subroutine | double_col_permute (m, n, p, a) |
double_col_permute | |
subroutine | integer_col_permute (m, n, p, a) |
integer_col_permute | |
real(kind=double) function | p_norm (ndata, power, data, weight) |
Evaluates the weighted p-norm. | |
subroutine | ortogonalize (dim, nvectors, vectors, x) |
Procedure orthogonalizing a vector w.r.t. a a set of vectors. | |
subroutine | orthogonal_projection (ndim, vector, normal, res_proj) |
Procedure that computes the projection of a vector onto the plane orthogonal to another vector (normal ) | |
subroutine | fn_print (this, lun) |
Info procedure for globals::file | |
character(len=len_trim(adjustl(str_file))) function | get_dirname (str_file) |
subroutine | fn_init (this, lun_err, fn, lun, io_flag, mandatory_input, folder, verbose, info) |
Static constructor for globals::file | |
subroutine | fn_kill (this, lun_err) |
Static destructor for globals::file | |
Variables | |
integer, parameter | wrn_io = 1 |
File or directory does not exist. | |
integer, parameter | wrn_val = 3 |
Error in input/outour parameter. | |
integer, parameter | wrn_read = 11 |
Error reading file. | |
integer, parameter | wrn_write = 21 |
Error writing file. | |
integer, parameter | wrn_inp = 13 |
Error in input parameter. | |
integer, parameter | wrn_out = 23 |
Error in outour parameter. | |
integer, parameter | err_io = 101 |
File or directory does not exist. | |
integer, parameter | err_inp = 111 |
Error in input parameter. | |
integer, parameter | err_out = 121 |
Error in outour parameter. | |
integer, parameter | err_alloc = 131 |
Error allocation failed. | |
integer, parameter | err_dealloc = 141 |
Error deallocation failed. | |
integer, parameter | err_vtk = 151 |
Error VTK library. | |
integer, parameter | err_read = 161 |
Error reading file. | |
integer, parameter | err_write = 171 |
Error writing file. | |
integer, parameter | err_val = 201 |
Error in parameter value. | |
logical function globals::ioerr | ( | integer, intent(in) | lun, |
integer, intent(in) | errno, | ||
character(len=*), intent(in) | call_proc, | ||
character(len=*), intent(in), optional | add_msg, | ||
integer, intent(in), optional | add_int ) |
Handle and write alert I/O warnings and errors.
Error number convention:
[in] | lun | I/O unit number for output of error messages |
[in] | errno | error number |
[in] | call_proc | name of the procedure where the error occured |
[in] | add_msg | additional message to be printed (optional) |
[in] | add_int | additional integer to be printed as string in the message (optional) |
.true.
if execution continues (obviously no return otherwise as execution stops) character(len=len(strin)) function globals::to_upper | ( | character(len=*), intent(in) | strin | ) |
Transform string to upper case.
Adapted from http://rosettacode.org/wiki/String_case#Fortran. Original author: Clive Page
[in] | strin | input string |
character(len=len(strin)) function globals::to_lower | ( | character(len=*), intent(in) | strin | ) |
Transform string to lowercase case.
Adapted from http://rosettacode.org/wiki/String_case#Fortran. Original author: Clive Page
[in] | strin | input string |
character(len=len_trim(adjustl(strin))) function globals::etb | ( | character(len=*), intent(in) | strin | ) |
Return string strin with no preceding and trailing spaces.
[in] | strin | input string |
character(len=len_trim(adjustl(strin))) function globals::erase_comment | ( | character(len=*), intent(in) | strin | ) |
Erase comments from a string.
A comment is a trailing string beginning with one of the following characters:
%
TeX-style#
script-bash-style[in] | strin | input string |
real(kind=double) function, dimension(3) globals::avg_vec3 | ( | integer, intent(in) | avg_type, |
real(kind=double), dimension(3), intent(in) | veca, | ||
real(kind=double), dimension(3), intent(in) | vecb, | ||
real(kind=double), dimension(3), intent(in), optional | vecc ) |
Function that calculates vectors averages.
Cases:
[in] | avg_type | type of average. 0 : arithmetic average. |
[in] | vec1 | vector to be averaged |
[in] | vec2 | vector to be averaged |
[in] | vec3 | vector to be averaged (optional) |
real(kind=double) function globals::avg_scal | ( | integer, intent(in) | avg_type, |
real(kind=double), intent(in) | a, | ||
real(kind=double), intent(in) | b, | ||
real(kind=double), intent(in), optional | c ) |
Function that calculates scalar averages.
Cases:
[in] | avg_type | type of average. 0 : arithmetic average. |
[in] | A | scalar to be averaged |
[in] | B | scalar to be averaged |
[in] | C | scalar to be averaged (optional) |
real(kind=double) function, dimension(3) globals::cross | ( | real(kind=double), dimension(3), intent(in) | veca, |
real(kind=double), dimension(3), intent(in) | vecb ) |
Function that calculates cross-products.
[in] | vec1 | vector |
[in] | vec2 | vector |
double
), dimension(3), vector subroutine globals::isort | ( | integer, intent(in) | narray, |
integer, dimension(narray), intent(inout) | array ) |
Simple sort algorithm to sort in increasing order an integer array. To be used only for small array. Use globals::global_heapsort
for big arrays.
[in] | narray | length array to be sorted |
[in,out] | array | array to be sorted |
subroutine globals::unique_of_sorted | ( | integer, intent(in) | n_elements, |
integer, dimension(n_elements), intent(inout) | elements, | ||
integer, intent(inout) | nunique ) |
Given a sorted array, it is returned with the list of uniques elements in the first positions.
[in] | n_elements | length of the array elements |
[in,out] | elements | sorted array |
[in,out] | nunique | number of unique elements |
logical function globals::lexicographic_order | ( | integer, intent(in) | n, |
integer, dimension(n), intent(in) | a, | ||
integer, dimension(n), intent(in) | b ) |
Check if the first array is in lexicographic order with respect to the second.
[in] | n | dimension of the input arrays |
[in] | a | first array of dimension n |
[in] | b | second array of dimension n |
.true.
if a
is in lexicographic order wrt b
, .false.
otherwise subroutine globals::global_heapsort | ( | integer ( kind = 4 ) | n, |
integer ( kind = 4 ) | indx, | ||
integer ( kind = 4 ) | i, | ||
integer ( kind = 4 ) | j, | ||
integer ( kind = 4 ) | isgn ) |
global_heapsort
integer function globals::ifind | ( | integer, intent(in) | narray, |
integer, dimension(narray), intent(in) | array, | ||
integer, intent(in) | tobefound ) |
ifind
subroutine globals::double_col_permute | ( | integer ( kind = 4 ) | m, |
integer ( kind = 4 ) | n, | ||
integer ( kind = 4 ), dimension(n) | p, | ||
real ( kind = double ), dimension(m,n) | a ) |
double_col_permute
subroutine globals::integer_col_permute | ( | integer ( kind = 4 ) | m, |
integer ( kind = 4 ) | n, | ||
integer ( kind = 4 ), dimension(n) | p, | ||
integer ( kind = 4 ), dimension(m,n) | a ) |
integer_col_permute
real(kind=double) function globals::p_norm | ( | integer, intent(in) | ndata, |
real(kind=double), intent(in) | power, | ||
real(kind=double), dimension(ndata), intent(in) | data, | ||
real(kind=double), dimension(ndata), intent(in), optional | weight ) |
Evaluates the weighted p-norm.
[in] | ndata | length of input array |
[in] | power | power for p-norm (0 for infinity norm) |
[in] | data | input array of dimension ndata |
[in] | weight | array of weights (optional) |
data
subroutine globals::ortogonalize | ( | integer, intent(in) | dim, |
integer, intent(in) | nvectors, | ||
real(kind=double), dimension(dim,nvectors), intent(in) | vectors, | ||
real(kind=double), dimension(dim), intent(inout) | x ) |
Procedure orthogonalizing a vector w.r.t. a a set of vectors.
[in] | dim | vectors dimension |
[in] | nvectors | number of vectors |
[in] | vectors | set of vectors wrt x is orthogonalized |
[in,out] | x | vector to be orthogonalized |
subroutine globals::orthogonal_projection | ( | integer, intent(in) | ndim, |
real(kind=double), dimension(ndim), intent(in) | vector, | ||
real(kind=double), dimension(ndim), intent(in) | normal, | ||
real(kind=double), dimension(ndim), intent(out) | res_proj ) |
Procedure that computes the projection of a vector onto the plane orthogonal to another vector (normal
)
[in] | ndim | dimension of the vectors |
[in] | vector | vector to be projected (dimension ndim ) |
[in] | normal | normal to the plane (dimension ndim ) |
[out] | result | projected vector (dimension ndim ) |
subroutine globals::fn_print | ( | class(file), intent(in) | this, |
integer, intent(in) | lun ) |
Info procedure for globals::file
Print the name of the file and the associated unit number
[in] | lun | unit number for output message |
character(len=len_trim(adjustl(str_file))) function globals::get_dirname | ( | character(len=*), intent(in) | str_file | ) |
Get directory name
[in] | lun | unit number for output message |
subroutine globals::fn_init | ( | class(file), intent(inout) | this, |
integer, intent(in) | lun_err, | ||
character(len=*), intent(in) | fn, | ||
integer, intent(in) | lun, | ||
character(len=*), intent(in) | io_flag, | ||
logical, intent(in), optional | mandatory_input, | ||
logical, intent(in), optional | folder, | ||
logical, intent(in), optional | verbose, | ||
integer, intent(inout), optional | info ) |
Static constructor for globals::file
[in] | lun_err | unit number for error messages |
[in] | fn | name of the file |
[in] | lun | unit number to associate to the file |
[in] | io_flag | "in" if filename is an input file and its existence must be checked, "out" if it is an output file |
[in] | mandatory_input | (optional) specify if input file is mandatory: .true. : file is mandatory, stop if file does not exists (default value) .false. : file is optional, proceed if file does not exists |
[in] | folder | (optional) specify if input file is a file or a folder:
|
[in] | verbose | (optional) logical flag for additional messages |
[in,out] | info | (optional) flag for existence of file: returns -1 if file does not exist |
subroutine globals::fn_kill | ( | class(file), intent(inout) | this, |
integer, intent(in) | lun_err ) |
integer, parameter globals::wrn_io = 1 |
File or directory does not exist.
integer, parameter globals::wrn_val = 3 |
Error in input/outour parameter.
integer, parameter globals::wrn_read = 11 |
Error reading file.
integer, parameter globals::wrn_write = 21 |
Error writing file.
integer, parameter globals::wrn_inp = 13 |
Error in input parameter.
integer, parameter globals::wrn_out = 23 |
Error in outour parameter.
integer, parameter globals::err_io = 101 |
File or directory does not exist.
integer, parameter globals::err_inp = 111 |
Error in input parameter.
integer, parameter globals::err_out = 121 |
Error in outour parameter.
integer, parameter globals::err_alloc = 131 |
Error allocation failed.
integer, parameter globals::err_dealloc = 141 |
Error deallocation failed.
integer, parameter globals::err_vtk = 151 |
Error VTK library.
integer, parameter globals::err_read = 161 |
Error reading file.
integer, parameter globals::err_write = 171 |
Error writing file.
integer, parameter globals::err_val = 201 |
Error in parameter value.