Module section_mod


Uses:
    module kinds_mod
Types:
    public type section
Variables:
    integer, private, parameter :: SECTION_RECT_MAX = 4
Subroutines and functions:
    public subroutine section_reset (sect, maxrect)
    public subroutine section_add (sect, rect)
    public logical function section_intersect (sect, rect, opt_offset)
    public subroutine section_volume (sect, volume)

A section of a 3D domain.

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.

Author: Matthias Lieber


Description of Types

section

public type section
    integer (kind=i_k), dimension (3,2,SECTION_RECT_MAX) :: rect
    integer (kind=i_k) :: nrect = 0
    integer (kind=i_k), dimension (3) :: maxext
end type section
Components:
rect a limited number of 3D cuboids
nrect number of used cuboids
A 3D section consisting of a limited number of 3D cuboids

Description of Subroutines and Functions

section_reset

public subroutine section_reset (sect, maxrect)
    type (section), intent(inout) :: sect
    integer (kind=i_k), intent(in), dimension (3,2) :: maxrect
end subroutine section_reset
Parameters:
sect the section
maxrect max allowed size
Reset sect (set volume to null).

Parameter maxrect will be used in section_add to estimate if it is useful to add a new cuboid or not.


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_add
Parameters:
sect the section
rect 3D cuboid to add
Add rect to section sect (union).

If necessary it will create a new cuboid in sect to keep overall volume as small as possible.


section_intersect

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_intersect
Parameters:
sect the section
rect 3D cuboid to intersect
opt_offset optional offset for upper bound of sect
Return .true. if intersection of sect with cuboid rect is not empty.

Optionally, an offset used for the upper bound of sect can be given.


section_volume

public subroutine section_volume (sect, volume)
    type (section), intent(inout) :: sect
    integer (kind=i_k), intent(out) :: volume
end subroutine section_volume
Parameters:
sect the section
volume volume
Calculate total volume of the section.