This module contains some very generic utils for string manipulation, or very basic computational/mathematic operation. It should not depend on any module except from mod_memory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character | :: | in(*) |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character | :: | in(*) |
Convert string in input from upper case to lower case and return the lower case string as output.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String to be converted in lowercase |
String converted to lowercase
Remove inline comments from a srting s, comments should begin with the string or character contained in comment_char
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String in input |
||
character(len=*), | intent(in) | :: | comment_char |
Char that begin the comment |
String converted to lowercase
Count the number of occurence of substring c in string s, and return the number of occurence, if c is not contained in s, zero is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String where to search the substring |
||
character(len=*), | intent(in) | :: | c |
Substring to search |
Decide if a string starts with a letter or not.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String to analyze |
Decide if a string can be interpreted as an integer or not
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String to analyze |
Decide if a string can be interpreted as a real
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
String to analyze |
This function is used to subsequently break a string into tokens.
Tokens separators are any number of spaces.
If just the string is provided, the function returns the position of
the first printable character;
If also ib is provided it saves the position of the first printable
character after position ib (or ib itself) in ib and return the
position of the last printable character before the first space after
ib. If ntok is specified instead of a single token, ntok are
returned. In case of last token hitten -1 is returned.
To divide a string follow the following scheme:
1. ib = tokenize(s)
2. ie = tokenize(s, ib)
3. tok1 = s(ib:ie)
4a. ib = ib+1
4b. ie = tokenize(s, ib)
5. tok2 = s(ib:ie)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=OMMP_STR_CHAR_MAX), | intent(in) | :: | s |
String to subdivide in token |
||
integer(kind=ip), | intent(in), | optional | :: | ib |
Index where to start token research (input)/Index where token begins (output) |
|
integer(kind=ip), | intent(in), | optional | :: | ntok |
Number of token to be extracted |
Index where token ends.
This function is used to subsequently break a string into tokens.
Tokens separators are any number of spaces.
If just the string is provided, the function returns the position of
the first printable character;
If also ib is provided it saves the position of the first printable
character after position ib (or ib itself) in ib and return the
position of the last printable character before the first space after
ib. If ntok is specified instead of a single token, ntok are
returned. In case of last token hitten -1 is returned.
To divide a string follow the following scheme:
1. ib = tokenize(s)
2. ie = tokenize(s, ib)
3. tok1 = s(ib:ie)
4a. ib = ib+1
4b. ie = tokenize(s, ib)
5. tok2 = s(ib:ie)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=OMMP_STR_CHAR_MAX), | intent(in) | :: | s |
String to subdivide in token |
||
integer(kind=ip), | intent(inout), | optional | :: | ib |
Index where to start token research (input)/Index where token begins (output) |
|
integer(kind=ip), | intent(in), | optional | :: | ntok |
Number of token to be extracted |
Index where token ends.
Computes the cross product between two vectors of dimension 3. Used as an inlinable function in geometric manipulations
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in), | dimension(3) | :: | a |
Input vector |
|
real(kind=rp), | intent(in), | dimension(3) | :: | b |
Input vector |
Output vector
Computes the matrix operator corresponding to a cross product of an input vector of dimension 3.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in), | dimension(3) | :: | a |
Computes the derivativative matrix of a versor wrt its generator vector . [\frac{\partial \hat{A}}{\partial \vec{A}} = \frac{1}{||\vec{A}||^3} (||\vec{A}||^2 \mathbb{1}_3 - A^\dagger A) = \frac{1}{||\vec{A}||^3} \begin{bmatrix} ||\vec{A}||^2 - \vec{A}_x^2 & - \vec{A}_x \vec{A}_y & - \vec{A}_x \vec{A}_z \ !! - \vec{A}_y \vec{A}_x &
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in), | dimension(3) | :: | a |
Skips n lines while reading an input file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(in) | :: | f |
unit file |
||
integer(kind=ip), | intent(in) | :: | n |
number of line to be skipped |
This is a simple -- and unefficient -- routine to sort a vector of
integers.
It is just used during some output to simplify comparisons with older
version of the code.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(in), | dimension(:) | :: | iv |
Input vector |
|
integer(kind=ip), | intent(out), | allocatable | :: | ov(:) |
Output, sorted vector |
Inplace equivalent of sort_ivec routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(inout), | dimension(:) | :: | iv |
Vector to be reordered in place |
Evaluate the z value at position (x, y) of a surface built as a
bicubic spline interpolating the points
(xgrd(, ), ygrd(, ),
vxgrd(, )).
In order to do so, also the derivatives of the surface at the points
of the grid are needed; in particular if we consider the surface
points as
also value of ,
and
at grid points
are needed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in) | :: | x |
Coordinates at which the z value of the surface should be computed |
||
real(kind=rp), | intent(in) | :: | y |
Coordinates at which the z value of the surface should be computed |
||
real(kind=rp), | intent(out) | :: | z |
The z value of the surface |
||
real(kind=rp), | intent(out) | :: | dzdx |
Derivatives of z valure w.r.t. x and y coordinates |
||
real(kind=rp), | intent(out) | :: | dzdy |
Derivatives of z valure w.r.t. x and y coordinates |
||
integer(kind=ip), | intent(in) | :: | nx |
Number of grid points along x and y direction |
||
integer(kind=ip), | intent(in) | :: | ny |
Number of grid points along x and y direction |
||
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | xgrd |
X-coordinate value of points on the grid |
|
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | ygrd |
Y-coordinate value of points on the grid |
|
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | v |
V(x, y) of points on the grid |
|
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | vx |
of points on the grid |
|
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | vy |
of points on the grid |
|
real(kind=rp), | intent(in), | dimension(ny,nx) | :: | vxy |
of points on the grid |
Compute the cyclic interpolating cubic spline (2D) that passes for
points . Each segment is described by the curve:
The algorithm used to compute the coefficients is taken from
"Numerical Algorithm with C" - Gisela ENGELN-MULLGES Frank UHLIG
(10.1007/978-3-642-61074-5)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(in) | :: | n |
Dimension of the data series |
||
real(kind=rp), | intent(in) | :: | x(n) |
X-values of input data |
||
real(kind=rp), | intent(in) | :: | y(n) |
Y-values of input data |
||
real(kind=rp), | intent(out) | :: | a(n) |
Coefficients of the cubic spline in each segment of the spline |
||
real(kind=rp), | intent(out) | :: | b(n) |
Coefficients of the cubic spline in each segment of the spline |
||
real(kind=rp), | intent(out) | :: | c(n) |
Coefficients of the cubic spline in each segment of the spline |
||
real(kind=rp), | intent(out) | :: | d(n) |
Coefficients of the cubic spline in each segment of the spline |