module kinds_modTypes:
public type sectionVariables:
integer (kind=i_k), private, parameter :: SECTION_RECT_MAX = 4Subroutines and functions:
public subroutine section_reset (sect, maxrect) public subroutine section_add (sect, rect) private pure subroutine section_add_update_uvol (sect, r) private pure subroutine section_add_check_unify (sect, r) public logical function section_intersect (sect, rect, opt_offset) public logical function section_contains (sect, pos) public pure subroutine section_volume (sect, volume)
The section is made up of a very limited number of clusters each consisting of a 3D rectangle (cuboid).
Rectangles can be added to a section, the algorithm tries to reduce the total volume of all clusters.
Preprocessor options:
Author: Matthias Lieber
public type section integer (kind=i_k), dimension (3,2,SECTION_RECT_MAX) :: rect = 0 integer (kind=i_k) :: nrect = 0 integer (kind=i_k), dimension (3) :: maxext integer (kind=i_k), dimension (SECTION_RECT_MAX) :: vol = 0 integer (kind=i_k), dimension (SECTION_RECT_MAX,SECTION_RECT_MAX) :: uvol = HUGE (SECTION_RECT_MAX) end type sectionComponents:
rect | a limited number of 3D cuboids |
nrect | number of used cuboids |
vol | volume of the 3D cuboids |
uvol | volume of unions of the existing cuboids |
public subroutine section_reset (sect, maxrect) type (section), intent(inout) :: sect integer (kind=i_k), optional, intent(in), dimension (3,2) :: maxrect end subroutine section_resetParameters:
sect | the section |
maxrect | max allowed size |
Parameter maxrect will be used in section_add to estimate if it is useful to add a new cuboid or not. This argument required only if compiled with OLD_SECTION_ADD.
public subroutine section_add (sect, rect) type (section), intent(inout) :: sect integer (kind=i_k), intent(in), dimension (3,2) :: rect end subroutine section_addParameters:
sect | the section |
rect | 3D cuboid to add |
If necessary it will create a new cuboid in sect to keep overall volume as small as possible.
private pure subroutine section_add_update_uvol (sect, r) type (section), intent(inout) :: sect integer (kind=i_k), intent(in) :: r end subroutine section_add_update_uvolParameters:
sect | the section |
r | cuboid to update |
Internal routine.
private pure subroutine section_add_check_unify (sect, r) type (section), intent(inout) :: sect integer (kind=i_k), intent(in) :: r end subroutine section_add_check_unifyParameters:
sect | the section |
r | cuboid to unify |
The processes is repeated for the unified cuboid.
Internal routine.
public logical function section_intersect (sect, rect, opt_offset) type (section), intent(inout) :: sect integer (kind=i_k), intent(in), dimension (3,2) :: rect integer (kind=i_k), optional, intent(in), dimension (3) :: opt_offset end function section_intersectParameters:
sect | the section |
rect | 3D cuboid to intersect |
opt_offset | optional offset for upper bound of sect |
Optionally, an offset used for the upper bound of sect can be given.
public logical function section_contains (sect, pos) type (section), intent(inout) :: sect integer (kind=i_k), intent(in), dimension (3) :: pos end function section_containsParameters:
sect | the section |
pos | pos |
public pure subroutine section_volume (sect, volume) type (section), intent(inout) :: sect integer (kind=i_k), intent(out) :: volume end subroutine section_volumeParameters:
sect | the section |
volume | volume |