Globals Library 1.0
Loading...
Searching...
No Matches
globals Module Reference

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.

Function/Subroutine Documentation

◆ ioerr()

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:

  • 0 < errno <= 100 -> warning: execution continues
  • errno > 100 -> severe: execution terminates
Parameters
[in]lunI/O unit number for output of error messages
[in]errnoerror number
[in]call_procname of the procedure where the error occured
[in]add_msgadditional message to be printed (optional)
[in]add_intadditional integer to be printed as string in the message (optional)
Returns
(logical) .true. if execution continues (obviously no return otherwise as execution stops)

Definition at line 87 of file modGlobals.f90.

◆ to_upper()

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

Parameters
[in]strininput string
Returns
(char) output string

Definition at line 202 of file modGlobals.f90.

◆ to_lower()

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

Parameters
[in]strininput string
Returns
(char) output string

Definition at line 227 of file modGlobals.f90.

◆ etb()

character(len=len_trim(adjustl(strin))) function globals::etb ( character(len=*), intent(in) strin)

Return string strin with no preceding and trailing spaces.


Parameters
[in]strininput string
Returns
(char) output string

Definition at line 250 of file modGlobals.f90.

◆ erase_comment()

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:

  • ! F90-style
  • % TeX-style
  • # script-bash-style
Parameters
[in]strininput string
Returns
(char) output string

Definition at line 270 of file modGlobals.f90.

◆ avg_vec3()

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:

  • on edge, between two vectors related to the nodes of an edge
  • on cell, between three vectors related to the vertices of a triangle
Parameters
[in]avg_typetype of average. 0: arithmetic average.
[in]vec1vector to be averaged
[in]vec2vector to be averaged
[in]vec3vector to be averaged (optional)
Returns
real(double). dimension(3), averaged vector

Definition at line 304 of file modGlobals.f90.

◆ avg_scal()

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:

  • on edge, between two vectors related to the nodes of an edge
  • on cell, between three vectors related to the vertices of a triangle
Parameters
[in]avg_typetype of average. 0: arithmetic average.
[in]Ascalar to be averaged
[in]Bscalar to be averaged
[in]Cscalar to be averaged (optional)
Returns
real(double), average

Definition at line 346 of file modGlobals.f90.

◆ cross()

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.


Parameters
[in]vec1vector
[in]vec2vector
Returns
real(::double), dimension(3), vector

Definition at line 379 of file modGlobals.f90.

◆ isort()

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.


Parameters
[in]narraylength array to be sorted
[in,out]arrayarray to be sorted

Definition at line 399 of file modGlobals.f90.

◆ unique_of_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.


Parameters
[in]n_elementslength of the array elements
[in,out]elementssorted array
[in,out]nuniquenumber of unique elements

Definition at line 440 of file modGlobals.f90.

◆ lexicographic_order()

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.


Parameters
[in]ndimension of the input arrays
[in]afirst array of dimension n
[in]bsecond array of dimension n
Returns
(logical) .true. if a is in lexicographic order wrt b, .false. otherwise

Definition at line 477 of file modGlobals.f90.

◆ global_heapsort()

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


Definition at line 502 of file modGlobals.f90.

◆ ifind()

integer function globals::ifind ( integer, intent(in) narray,
integer, dimension(narray), intent(in) array,
integer, intent(in) tobefound )

ifind


Definition at line 728 of file modGlobals.f90.

◆ double_col_permute()

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


Definition at line 750 of file modGlobals.f90.

◆ integer_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


Definition at line 887 of file modGlobals.f90.

◆ p_norm()

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.


Parameters
[in]ndatalength of input array
[in]powerpower for p-norm (0 for infinity norm)
[in]datainput array of dimension ndata
[in]weightarray of weights (optional)
Returns
real(double), (weighted) p-norm of data

Definition at line 1032 of file modGlobals.f90.

◆ ortogonalize()

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.


Parameters
[in]dimvectors dimension
[in]nvectorsnumber of vectors
[in]vectorsset of vectors wrt x is orthogonalized
[in,out]xvector to be orthogonalized

Definition at line 1080 of file modGlobals.f90.

◆ orthogonal_projection()

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).


Parameters
[in]ndimdimension of the vectors
[in]vectorvector to be projected (dimension ndim)
[in]normalnormal to the plane (dimension ndim)
[out]resultprojected vector (dimension ndim)

Definition at line 1108 of file modGlobals.f90.

◆ fn_print()

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

Parameters
[in]lununit number for output message

Definition at line 1133 of file modGlobals.f90.

◆ get_dirname()

character(len=len_trim(adjustl(str_file))) function globals::get_dirname ( character(len=*), intent(in) str_file)

Get directory name

Parameters
[in]lununit number for output message
Returns
(char) directory name

Definition at line 1149 of file modGlobals.f90.

◆ fn_init()

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.


Parameters
[in]lun_errunit number for error messages
[in]fnname of the file
[in]lununit 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:
  • .true.: input path is folder (check existence and not open unit)
  • .false.: input path is file (default value, check existence and open if mandatory_input = .true.)
[in]verbose(optional) logical flag for additional messages
[in,out]info(optional) flag for existence of file: returns -1 if file does not exist

Definition at line 1192 of file modGlobals.f90.

◆ fn_kill()

subroutine globals::fn_kill ( class(file), intent(inout) this,
integer, intent(in) lun_err )

Static destructor for globals::file.


Parameters
[in]lun_errunit number for output error message

Definition at line 1261 of file modGlobals.f90.

Variable Documentation

◆ wrn_io

integer, parameter globals::wrn_io = 1

File or directory does not exist.

Definition at line 19 of file modGlobals.f90.

◆ wrn_val

integer, parameter globals::wrn_val = 3

Error in input/outour parameter.

Definition at line 21 of file modGlobals.f90.

◆ wrn_read

integer, parameter globals::wrn_read = 11

Error reading file.

Definition at line 23 of file modGlobals.f90.

◆ wrn_write

integer, parameter globals::wrn_write = 21

Error writing file.

Definition at line 25 of file modGlobals.f90.

◆ wrn_inp

integer, parameter globals::wrn_inp = 13

Error in input parameter.

Definition at line 27 of file modGlobals.f90.

◆ wrn_out

integer, parameter globals::wrn_out = 23

Error in outour parameter.

Definition at line 29 of file modGlobals.f90.

◆ err_io

integer, parameter globals::err_io = 101

File or directory does not exist.

Definition at line 31 of file modGlobals.f90.

◆ err_inp

integer, parameter globals::err_inp = 111

Error in input parameter.

Definition at line 33 of file modGlobals.f90.

◆ err_out

integer, parameter globals::err_out = 121

Error in outour parameter.

Definition at line 35 of file modGlobals.f90.

◆ err_alloc

integer, parameter globals::err_alloc = 131

Error allocation failed.

Definition at line 37 of file modGlobals.f90.

◆ err_dealloc

integer, parameter globals::err_dealloc = 141

Error deallocation failed.

Definition at line 39 of file modGlobals.f90.

◆ err_vtk

integer, parameter globals::err_vtk = 151

Error VTK library.

Definition at line 41 of file modGlobals.f90.

◆ err_read

integer, parameter globals::err_read = 161

Error reading file.

Definition at line 43 of file modGlobals.f90.

◆ err_write

integer, parameter globals::err_write = 171

Error writing file.

Definition at line 45 of file modGlobals.f90.

◆ err_val

integer, parameter globals::err_val = 201

Error in parameter value.

Definition at line 47 of file modGlobals.f90.