This module provides a spatial function to describe a 2D polygon.
The spatial function will provide different values for points within the polygon and those outside.
A polygon is defined in the configuration by the following definition:
-- Vector to return inside the polygon
inval = {1.0, 0.0, 2.0}
-- It also can be a scalar, if none is provided a scalar 1 is assumed.
inval = 1.0 -- This is the value to return for points inside the polygon
-- defaults to 1.
-- Vector to return outside the polygon
outval = {0.0, 0.0, 0.0}
-- Needs to conform to the definition of inval, that is, if inval is scalar
-- or not given, outval needs to be a scalar.
-- Defaults to all zero components for a vector of the length of inval.
-- If inval is a scalar, outval has to be given as a scalar aswell:
outval = 0.0 -- The value to return for points outside the polygon,
-- defaults to 0.
-- List of 2D Points to be used as vertices for the polygon.
-- The polygon will be closed by going from the last point back to the
-- first one.
vertex = { { 1.0, 0.0},
{ 0.0, -1.0},
{-1.0, 0.0},
{ 0.0, 1.0},
}
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | private, | parameter | :: | PI | = | 2*asin(1.0_rk) |
Definition of Pi |
real(kind=rk), | private, | parameter | :: | tolp | = | (1.0_rk+epsilon(1.0_rk)) |
Overestimating tolerance factor for comparisons of reals |
real(kind=rk), | private, | parameter | :: | tolm | = | (1.0_rk-epsilon(1.0_rk)) |
Underestimating tolerance factor for comparisons of reals |
Description of a 2D closed polygon.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(tem_polygon_vertex_type), | public, | allocatable | :: | poly_list(:) |
poly_list, we can have multiply of them |
||
type(tem_polygon_movement_type), | public | :: | moving |
Movement of each polygon |
|||
integer, | public | :: | nPoly |
Number of poly_list |
|||
real(kind=rk), | public | :: | zmin |
Extrude in z direction |
|||
real(kind=rk), | public | :: | zmax | ||||
integer, | public | :: | nComponents |
how many components inval/outval have, they are defined as vectors and might have more than 1 entries, defined by the user in the config file! |
|||
real(kind=rk), | public, | allocatable | :: | inval(:) |
Value of Material inside the polygon. |
||
real(kind=rk), | public, | allocatable | :: | outval(:) |
Value of Material outside the polygon. |
Type to store the vertices for the polygon
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | nVertices |
Number of vertices in the polygon. |
|||
real(kind=rk), | public, | allocatable | :: | vertex(:,:) |
2D Coordinates of the vertices. First index runs over number of vertices, second from 1 to 2. |
Type to store information regarding the movement of the polygon
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | public, | allocatable | :: | lin_parameter(:) |
Linear movement of the polygon Include the values for the velocity, the first entry is the velocity in X direction, de second in Y The third one is the Z component of the velocity |
||
real(kind=rk), | public, | allocatable | :: | sin_parameter(:) |
Move the polygon with a sine fuction First and second entry belong to X direction and are the amplitude and the frequency. The third and forth entry are the devoted to the Y direction, for amplitude and the frequency respectivly. |
||
real(kind=rk), | public, | allocatable | :: | rot_parameter(:) |
Rotation of the polygon the first two entries belong to the directions, the first entry is the rot pointX and the second entry the rot pointY ) the third one is the rot_speed omega |
||
real(kind=rk), | public, | allocatable | :: | angle_parameter(:) |
chaning the angle of attack for airfoild with a sinus the first entry is the phase shift (y), the second is the amplitude and the third one is the angular velocity (omega) |
||
character(len=labellen), | public | :: | movement_kind |
Kind of movement |
Evaluate a list of points, and return inval for each that is within me and outval for all other points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me |
Description of the polygon to evaluate |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
Coordinates for which the function should be evaluated. |
||
integer, | intent(in) | :: | n |
Number of points to get a value for. |
Resulting value at each point.
Evaluate a list of points, and return inval for each that is within me and outval for all other points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me |
Description of the polygon to evaluate |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
Coordinates for which the function should be evaluated. |
||
integer, | intent(in) | :: | n |
Number of points to get a value for. |
Resulting value at each point.
Evaluate a list of points, and return first component of inval for each that is within me and first component of outval for all other points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me |
Description of the polygon to evaluate |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
Coordinates for which the function should be evaluated. |
||
integer, | intent(in) | :: | n |
Number of points to get a value for. |
Resulting value at each point.
Evaluate a list of points, and return first component of inval for each that is within me and first component of outval for all other points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me |
Description of the polygon to evaluate |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
Coordinates for which the function should be evaluated. |
||
integer, | intent(in) | :: | n |
Number of points to get a value for. |
Resulting value at each point.
Return the material value for point, based on the position in relation to the polygon.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_vertex_type), | intent(in) | :: | me |
Polygon to describe the material shape. |
||
integer, | intent(in) | :: | nComponents | |||
real(kind=rk), | intent(in) | :: | inVal(nComponents) | |||
real(kind=rk), | intent(in) | :: | outVal(nComponents) | |||
real(kind=rk), | intent(in) | :: | point(:) |
Point to check against the polygon. |
Material value at point, as defined by the polygon.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me | |||
real(kind=rk), | intent(in) | :: | time |
velocity value |
||
integer, | intent(in) | :: | nPoint |
number of points to get value for |
||
real(kind=rk), | intent(in) | :: | coord(nPoint,3) |
points |
List of values of each point
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(in) | :: | me | |||
real(kind=rk), | intent(in) | :: | time |
velocity value |
||
integer, | intent(in) | :: | nPoint |
number of points to get value for |
||
real(kind=rk), | intent(in) | :: | coord(nPoint,3) |
points |
List of values of each point
Compute the angle between to vectors (they should not both be the 0 vector).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | va_x |
The first vector va |
||
real(kind=rk), | intent(in) | :: | va_y |
The first vector va |
||
real(kind=rk), | intent(in) | :: | vb_x |
The second vector vb |
||
real(kind=rk), | intent(in) | :: | vb_y |
The second vector vb |
The angle betweend va and vb
read list of vertices
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(out) | :: | me |
Polygon data structure to fill with information provided by the user in config. |
||
type(flu_State) | :: | conf |
Handle to the Lua script containing the polygon definition |
|||
integer, | intent(in), | optional | :: | thandle |
Handle for the table containing the polygon definition. |
get the z component
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(out) | :: | me |
Polygon data structure to fill with information provided by the user in config. |
||
type(flu_State) | :: | conf |
Handle to the Lua script containing the polygon definition |
|||
integer, | intent(in), | optional | :: | thandle |
Handle for the table containing the polygon definition. |
get the z component
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_polygon_material_type), | intent(out) | :: | me |
Polygon data structure to fill with information provided by the user in config. |
||
type(flu_State) | :: | conf |
Handle to the Lua script containing the polygon definition |
|||
integer, | intent(in), | optional | :: | thandle |
Handle for the table containing the polygon definition. |
A subroutine to test the tem_polygon_material_value function in tem_polygon_material_test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(out) | :: | success |
Indicator if all tests were computed correctly. |
A subroutine to test the angle_between function in tem_polygon_material_test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(out) | :: | success |
Indicator if all tests were computed correctly. |