Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(node_t), | public, | dimension(:), allocatable | :: | nodes | |||
integer, | public, | dimension(:), allocatable | :: | atnd_tab | Atom -> node map. |
||
integer, | public | :: | capacity | Maximum number of nodes that the tree can currently handle. This may increase as more atoms are inserted. |
|||
integer, | public | :: | freestore | Pointer to head to the free store. |
|||
integer, | public | :: | size | Number of nodes in the tree. |
|||
integer, | public | :: | root | Pointer to the tree root. |
|||
real(kind=rp), | public | :: | tskin | Thickness of the skin for fattened AABBs, as a fraction of the AABB base length. |
Initializes an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(out) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | natoms | Estimated number of atoms to be handled by this tree. |
||
real(kind=rp), | intent(in) | :: | tskin | Thickness of the skin for fattened AABBs, as a fraction of the AABB base length. |
Prints a subtree of an AABB tree rooted at p
in order.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in), | optional | :: | p | Pointer to the root of the subtree. Default is the root of the whole tree. |
Clears an AABB tree. Associated memory is not deallocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
Deletes an AABB tree. All associated memory is deallocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
Inserts an atom into an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index |
||
real(kind=rp), | intent(in), | dimension(3) | :: | pos | Atom position |
|
real(kind=rp), | intent(in) | :: | radius | Atom radius (or cutoff distance for point particles) |
Removes an atom from an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index |
Removes all atoms from an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
Updates an AABB tree for the case when an atom leaves its fattened AABB.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index |
||
real(kind=rp), | intent(in), | dimension(3) | :: | pos | Atom position |
|
real(kind=rp), | intent(in) | :: | radius | Atom radius (or cutoff distance for point particles) |
||
logical, | intent(out) | :: | lstat | true if the atom was reinserted, false otherwise. |
Updates an AABB tree for the case when an atom leaves its fattened AABB, with the bounds of the new AABB for the atom as input.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index |
||
real(kind=rp), | intent(in), | dimension(3) | :: | lbnd | Lower bound of atom AABB |
|
real(kind=rp), | intent(in), | dimension(3) | :: | ubnd | Upper bound of atom AABB |
|
logical, | intent(out) | :: | lstat | true if the atom was reinserted, false otherwise. |
Query an AABB tree for a set of potential neighbors of an atom.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index |
||
type(ivector_t), | intent(inout) | :: | nbrs | List of potential neighbors. |
Query an AABB tree for the set of atoms whose AABBS overlap with
aabb
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
type(aabb_t), | intent(in) | :: | aabb | An aabb_t instance. |
||
type(ivector_t), | intent(inout) | :: | atms | List of potential neighbors. |
Query an AABB tree for a set of potential neighbors of an atom & its bounding AABB.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index. |
||
type(aabb_t), | intent(in) | :: | aabb | Bounding AABB for atom with index |
||
type(ivector_t), | intent(inout) | :: | nbrs | List of potential neighbors. |
Returns the number of atoms in an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
Return value
Returns a copy of the AABB associated with atom with index ia
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | ia | Atom index. |
AABB of atom ia
.
Returns the height of an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
Return value.
Returns the maximum difference between the height of two children of a node.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
Return value.
Returns the ratio of the sum of the node surface area to the surface area of the root node.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
Return value.
Rebuilds an optimal AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
Validates an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
Inserts a leaf node into a tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | leaf | Pointer to a leaf node |
Removes a leaf node from a tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | leaf | Pointer to a leaf node |
Balances an AABB tree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | p | Node index |
Calculates the height of a subtree.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in), | optional | :: | p | Pointer to the root of the subtree. Default: Root of the whole tree. |
Return value
Acquires a new node from the free store and returns a pointer to it.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
Return value
Returns a node to the free store.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(inout) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | p | Node pointer. |
Asserts that an AABB subtree has a valid structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | p | Pointer to the root of the subtree. |
Asserts that an AABB subtree has a valid metric.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(aabbtree_t), | intent(in) | :: | this | An aabbtree_t instance. |
||
integer, | intent(in) | :: | p | Pointer to the root of the subtree. |
type aabbtree_t
type(node_t), dimension(:), allocatable :: nodes
integer, dimension(:), allocatable :: atnd_tab
!! Atom -> node map.
integer :: capacity
!! Maximum number of nodes that the tree can currently handle. This may
!! increase as more atoms are inserted.
integer :: freestore
!! Pointer to head to the free store.
integer :: size
!! Number of nodes in the tree.
integer :: root
!! Pointer to the tree root.
real(rp) :: tskin
!! Thickness of the skin for fattened AABBs, as a fraction of the AABB
!! base length.
contains
procedure :: init
procedure :: print
procedure :: clear
procedure :: delete
procedure :: insert
procedure :: remove
procedure :: remove_all
procedure :: update_fatm
procedure :: update_fatmaabb
generic :: update => update_fatm, update_fatmaabb
procedure :: query_watm
procedure :: query_waabb
procedure :: query_watmaabb
generic :: query => query_watm, query_waabb, query_watmaabb
procedure :: get_num_atoms
procedure :: get_aabb
procedure :: get_height
procedure :: get_max_balance
procedure :: get_srfarea_ratio
procedure :: rebuild
procedure :: validate
procedure, private :: insert_leaf
procedure, private :: remove_leaf
procedure, private :: balance
procedure, private :: calc_height
procedure, private :: fs_acquire
procedure, private :: fs_return
procedure, private :: validate_structure
procedure, private :: validate_metrics
end type aabbtree_t