version 0.6.0
Loading...
Searching...
No Matches

Basic shapes: circle and rectangle More...

Data Types

type  mod_shape_basic::t_shape_circle
 Circle/sphere shape. More...
 
type  mod_shape_basic::t_shape_rectangle
 Rectangle/rectangular cuboid shape. More...
 
type  mod_shape_basic::t_shape_halfspace
 Half-space shape. More...
 
type  mod_shape_basic::t_shape_cylinder
 Cylinder shape (3D only) More...
 
type  mod_shape_basic::t_shape_torus
 Torus shape around Z-axis (3D only) More...
 
type  mod_shape_basic::t_shape_universe
 Represents the whole space. More...
 

Functions/Subroutines

subroutine mod_shape_basic::initialize_shape_circle (shape)
 Initialize the circle/sphere.
 
subroutine mod_shape_basic::copy_shape_circle (shape, copy)
 Copy the circle/sphere.
 
logical pure function mod_shape_basic::shape_circle_is_inside (shape, point)
 Check if a point lies inside the circle/sphere.
 
subroutine mod_shape_basic::shape_circle_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a circle/sphere.
 
pure subroutine mod_shape_basic::shape_circle_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the circle/sphere.
 
subroutine mod_shape_basic::initialize_shape_rectangle (shape)
 Initialize the rectangle/rectangular cuboid.
 
subroutine mod_shape_basic::copy_shape_rectangle (shape, copy)
 Copy the rectangle.
 
logical pure function mod_shape_basic::shape_rectangle_is_inside (shape, point)
 Check if a point lies inside the rectangle/rectangular cuboid.
 
subroutine mod_shape_basic::shape_rectangle_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a rectrangle/rectangular cuboid.
 
pure subroutine mod_shape_basic::shape_rectangle_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the rectangle/rectangular cuboid.
 
subroutine mod_shape_basic::initialize_shape_halfspace (shape)
 Initialize the half-space.
 
subroutine mod_shape_basic::copy_shape_halfspace (shape, copy)
 Copy the half-space.
 
logical pure function mod_shape_basic::shape_halfspace_is_inside (shape, point)
 Check if a point lies inside the half-space.
 
subroutine mod_shape_basic::shape_halfspace_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a half-space.
 
pure subroutine mod_shape_basic::shape_halfspace_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the half-space.
 
subroutine mod_shape_basic::initialize_shape_cylinder (shape)
 Initialize the cylinder.
 
subroutine mod_shape_basic::copy_shape_cylinder (shape, copy)
 Copy the cylinder.
 
logical pure function mod_shape_basic::shape_cylinder_is_inside (shape, point)
 Check if a point lies inside the cylinder (3D only)
 
subroutine mod_shape_basic::shape_cylinder_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a cylinder.
 
pure subroutine mod_shape_basic::shape_cylinder_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the cylinder.
 
subroutine mod_shape_basic::initialize_shape_torus (shape)
 Initialize the torus.
 
subroutine mod_shape_basic::copy_shape_torus (shape, copy)
 Copy the torus.
 
logical pure function mod_shape_basic::shape_torus_is_inside (shape, point)
 Check if a point lies inside the torus (3D only)
 
subroutine mod_shape_basic::shape_torus_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a torus.
 
pure subroutine mod_shape_basic::shape_torus_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the torus.
 
subroutine mod_shape_basic::initialize_shape_universe (shape)
 Initialize the universe.
 
subroutine mod_shape_basic::copy_shape_universe (shape, copy)
 Copy the universe.
 
logical pure function mod_shape_basic::shape_universe_is_inside (shape, point)
 Check if a point lies inside the universe (always true)
 
subroutine mod_shape_basic::shape_universe_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in the universe (yes, they do!)
 
pure subroutine mod_shape_basic::shape_universe_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the universe.
 

Detailed Description

Function/Subroutine Documentation

◆ copy_shape_circle()

subroutine mod_shape_basic::copy_shape_circle ( class(t_shape_circle), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapecircle/sphere shape
[out]copycopied circle/sphere

◆ copy_shape_cylinder()

subroutine mod_shape_basic::copy_shape_cylinder ( class(t_shape_cylinder), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapecylinder shape
[out]copycopied cylinder

◆ copy_shape_halfspace()

subroutine mod_shape_basic::copy_shape_halfspace ( class(t_shape_halfspace), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapehalf-space shape
[out]copycopied half-space

◆ copy_shape_rectangle()

subroutine mod_shape_basic::copy_shape_rectangle ( class(t_shape_rectangle), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shaperectangle shape
[out]copycopied rectangle

◆ copy_shape_torus()

subroutine mod_shape_basic::copy_shape_torus ( class(t_shape_torus), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapetorus shape
[out]copycopied torus

◆ copy_shape_universe()

subroutine mod_shape_basic::copy_shape_universe ( class(t_shape_universe), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapeuniverse shape
[out]copycopied universe

◆ initialize_shape_circle()

subroutine mod_shape_basic::initialize_shape_circle ( class(t_shape_circle), intent(inout) shape)
Parameters
[in,out]shapecircle/sphere shape

◆ initialize_shape_cylinder()

subroutine mod_shape_basic::initialize_shape_cylinder ( class(t_shape_cylinder), intent(inout) shape)
Parameters
[in,out]shapecylinder shape

◆ initialize_shape_halfspace()

subroutine mod_shape_basic::initialize_shape_halfspace ( class(t_shape_halfspace), intent(inout) shape)
Parameters
[in,out]shapehalf-space shape

◆ initialize_shape_rectangle()

subroutine mod_shape_basic::initialize_shape_rectangle ( class(t_shape_rectangle), intent(inout) shape)
Parameters
[in,out]shaperectangle shape

◆ initialize_shape_torus()

subroutine mod_shape_basic::initialize_shape_torus ( class(t_shape_torus), intent(inout) shape)
Parameters
[in,out]shapetorus shape

◆ initialize_shape_universe()

subroutine mod_shape_basic::initialize_shape_universe ( class(t_shape_universe), intent(inout) shape)
Parameters
[in,out]shapeuniverse shape

◆ shape_circle_get_distance()

pure subroutine mod_shape_basic::shape_circle_get_distance ( class(t_shape_circle), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the circle/sphere, the distance is negative and the direction points to the closest point on the circle/sphere. If the point lies outiside the circle/sphere, the distance is positive and the direction points in the opposite direction to the closest point on the circle/sphere.

Parameters
[in]shapecircle/sphere shape
[in]pointany point
[out]distancesigned closest distance from the point to the circle/sphere
[out]directionsigned direction from the point to the closest point on the circle/sphere

◆ shape_circle_get_samples_inside()

subroutine mod_shape_basic::shape_circle_get_samples_inside ( class(t_shape_circle), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shapecircle/sphere shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the circle/sphere
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_circle_is_inside()

logical pure function mod_shape_basic::shape_circle_is_inside ( class(t_shape_circle), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapecircle/sphere shape
[in]pointany point

◆ shape_cylinder_get_distance()

pure subroutine mod_shape_basic::shape_cylinder_get_distance ( class(t_shape_cylinder), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the cylinder, the distance is negative and the direction points to the closest point on the cylinder. If the point lies outiside the cylinder, the distance is positive and the direction points in the opposite direction to the closest point on the cylinder.

Parameters
[in]shapecylinder shape
[in]pointany point
[out]distancesigned closest distance from the point to the cylinder
[out]directionsigned direction from the point to the closest point on the cylinder

◆ shape_cylinder_get_samples_inside()

subroutine mod_shape_basic::shape_cylinder_get_samples_inside ( class(t_shape_cylinder), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shapecylinder shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the cylinder
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_cylinder_is_inside()

logical pure function mod_shape_basic::shape_cylinder_is_inside ( class(t_shape_cylinder), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapecylinder shape
[in]pointany point

◆ shape_halfspace_get_distance()

pure subroutine mod_shape_basic::shape_halfspace_get_distance ( class(t_shape_halfspace), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the half-space, the distance is negative and the direction points to the closest point on the half-space. If the point lies outiside the half-space, the distance is positive and the direction points in the opposite direction to the closest point on the half-space.

Parameters
[in]shapehalf-space shape
[in]pointany point
[out]distancesigned closest distance from the point to the half-space
[out]directionsigned direction from the point to the closest point on the half-space

◆ shape_halfspace_get_samples_inside()

subroutine mod_shape_basic::shape_halfspace_get_samples_inside ( class(t_shape_halfspace), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shapehalf-space shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the half-space
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_halfspace_is_inside()

logical pure function mod_shape_basic::shape_halfspace_is_inside ( class(t_shape_halfspace), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapehalf-space shape
[in]pointany point

◆ shape_rectangle_get_distance()

pure subroutine mod_shape_basic::shape_rectangle_get_distance ( class(t_shape_rectangle), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the rectangle/rectangular cuboid, the distance is negative and the direction points to the closest point on the rectangle/rectangular cuboid. If the point lies outside the rectangle/rectangular cuboid, the distance is positive and the direction points in the opposite direction to the closest point on the rectangle/rectangular cuboid.

Parameters
[in]shaperectangle/rectangular cuboid shape
[in]pointany point
[out]distancesigned closest distance from the point to the rectangle/rectangular cuboid
[out]directionsigned direction from the point to the closest point on the rectangle/rectangular cuboid

◆ shape_rectangle_get_samples_inside()

subroutine mod_shape_basic::shape_rectangle_get_samples_inside ( class(t_shape_rectangle), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shaperectangle/rectangular cuboid shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the rectangle/rectangular cuboid
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_rectangle_is_inside()

logical pure function mod_shape_basic::shape_rectangle_is_inside ( class(t_shape_rectangle), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shaperectangle/rectangular cuboid shape
[in]pointany point

◆ shape_torus_get_distance()

pure subroutine mod_shape_basic::shape_torus_get_distance ( class(t_shape_torus), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the torus, the distance is negative and the direction points to the closest point on the torus. If the point lies outiside the torus, the distance is positive and the direction points in the opposite direction to the closest point on the torus.

Parameters
[in]shapetorus shape
[in]pointany point
[out]distancesigned closest distance from the point to the torus
[out]directionsigned direction from the point to the closest point on the torus

◆ shape_torus_get_samples_inside()

subroutine mod_shape_basic::shape_torus_get_samples_inside ( class(t_shape_torus), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shapetorus shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the torus
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_torus_is_inside()

logical pure function mod_shape_basic::shape_torus_is_inside ( class(t_shape_torus), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapetorus shape
[in]pointany point

◆ shape_universe_get_distance()

pure subroutine mod_shape_basic::shape_universe_get_distance ( class(t_shape_universe), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )

If the point lies inside the universe, the distance is negative and the direction points to the closest point on the universe. If the point lies outside the universe (Wait, what?), the distance is positive and the direction points in the opposite direction to the closest point on the universe.

Parameters
[in]shapeuniverse shape
[in]pointany point
[out]distancesigned closest distance from the point to the universe
[out]directionsigned direction from the point to the closest point on the universe

◆ shape_universe_get_samples_inside()

subroutine mod_shape_basic::shape_universe_get_samples_inside ( class(t_shape_universe), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

   !!    n_samples = 0   n_samples = 1   n_samples = 2
   !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
   !!      ┃       ┃       ┃       ┃       × × × × ×
   !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
   !! 
Parameters
[in,out]shapeuniverse shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the universe
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ shape_universe_is_inside()

logical pure function mod_shape_basic::shape_universe_is_inside ( class(t_shape_universe), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapeuniverse shape
[in]pointany point