Skip to content

adam_tree_object

ADAM, tree class definition. The tree data structure is organized as a hash table and can be arranged as octree or quadtree simply adopting the proper refinement ratio, namely 8 or 4 ratio respectively.

The tree exploits the Morton order for the linearization of the tree. A prototype of quadtree is represented below.

        j^
L=0      |
  L=1    |
    L=2  |
      L=3|
         |------------------------------------------------
      7  |  10   11  |  14   15  |  58   59  |  62   63  |
    3----|    10     |    11     |    14     |    15     |
      6  |  8    9   |  12   13  |  56   57  |  60   61  |
  1------|---------- 2 ----------|---------- 3 ----------|
      5  |  34   45  |  38   39  |  50   51  |  54   55  |
    2----|     8     |     9     |    12     |    13     |
      4  |  32   33  |  36   37  |  48   49  |  52   53  |
0--------|-----------|--------- -1 ----------|-----------|
      3  |  10   11  |  14   15  |  26   27  |  30   31  |
    1----|     2     |     3     |     6     |     7     |
      2  |  8    9   |  12   13  |  24   25  |  28   29  |
  0------|---------- 0 ----------|---------- 1 ----------|
      1  |  2    3   |  6    7   |  18   19  |  22   23  |
    0----|     0     |     1     |     4     |     5     |
      0  |  0    1   |  4    5   |  16   17  |  20   21  |
         O------------------------------------------------------>
            0 |  1   |  2 |  3   |  4 |  5   |  6 |  7     L=3  i
              0      |    1      |    2      |    3        L=2
                     0           |           1             L=1
                                 0                         L=0

In the above representation each refinement level is represented alone, namely without taking into account the existence of previous levels. However, the real hierarchy can be taken into account by simply adding the offset derived from the previous levels, thus the numbering becomes as below.

        j^
L=0      |
  L=1    |
    L=2  |
      L=3|
         |------------------------------------------------
      7  |  62   63  |  66   67  |  78   79  |  82   63  |
    3----|    14     |    15     |    18     |    19     |
      6  |  60   61  |  64   65  |  76   77  |  80   81  |
  1------|---------- 2 ----------|---------- 3 ----------|
      5  |  54   55  |  58   59  |  70   71  |  74   75  |
    2----|    12     |    13     |    16     |    17     |
      4  |  52   53  |  56   57  |  68   69  |  72   73  |
0--------|-----------|--------- -1 ----------|-----------|
      3  |  30   31  |  34   35  |  46   47  |  50   51  |
    1----|     6     |     7     |    10     |    11     |
      2  |  28   29  |  32   33  |  44   45  |  48   49  |
  0------|---------- 0 ----------|---------- 1 ----------|
      1  |  22   23  |  26   27  |  38   39  |  42   43  |
    0----|     4     |     5     |     8     |     9     |
      0  |  20   21  |  24   25  |  36   37  |  40   41  |
         O------------------------------------------------------>
            0 |  1   |  2 |  3   |  4 |  5   |  6 |  7     L=3  i
              0      |    1      |    2      |    3        L=2
                     0           |           1             L=1
                                 0                         L=0

This last numbering is the complete Morton order where the Morton code ideintifing a node entails all the spatial information, the refinement level L and the spatial coordinatates IJ. Sometimes it is convenient to use the representation where level L is not encoded into the Morton order, but the conversion is as as adding the offset of previous level, namely using the funcion first_at_level. Note that the ancestor node has Morton code -1, it is the ancestor of all nodes, it is Adam. For the octree case (3D case) the ordering is equivalent, simply the local children fall in [0,7] instead of [0,3], namely the local numbering is always [0, ratio-1], as represented below.

^ /|\Z | | G--------------------H | /| /| /| | / | / | / | | / | / | / | | / | / | / | | / -----/---------/---- | 6 <-------/--+ /| / /| / +---------> 7 | --------------------* / | | /| / | /| / | /| / | | / | / | / | / | / | / | | / | / E/--|-/----/--|-/----F | 2 <-----/---|/--+ // |/ // |/ +---------> 3 | / -----/---------/---- / | 4 <--------/--+ /| // /| // +------------> 5 | C--------------------D / | / | | / | / | / | / | / | / | | / |/ | / |/ | / |/ | | / ---|-/-------|-/---- | 0 <-----|/--+ / |/ / |/ +------------> 1 | --------------------* / | | / | / | / | | / | / | / | _ Y | / | / | / | /| |/ |/ |/ | / A----------*----------B | / |/ X o------------------------------------------------------------------->

Edges numeration: AC = fec-7 BD = fec-8 EG = fec-9 FH = fec-10 AE = fec-11 BF = fec-12 CG = fec-13 DH = fec-14 AB = fec-15 EF = fec-16 CD = fec-17 GH = fec-18 Corners numeration: A = fec-19 B = fec-20 E = fec-21 F = fec-22 C = fec-23 D = fec-24 G = fec-25 H = fec-26

Source: src/lib/common/adam_tree_object.F90

Dependencies

Contents

Variables

NameTypeAttributesDescription
NODE_LESS_REFINEDinteger(kind=I4P)parameterLess refined node type.
NODE_STANDARDinteger(kind=I4P)parameterStandard node type.
NODE_MORE_REFINEDinteger(kind=I4P)parameterMore refined node type.
NODE_BOUNDARY_CONDITIONinteger(kind=I4P)parameterBoundary condition node type.
TREE_BUCKETS_NUMBER_DEFinteger(kind=I8P)parameterDefault number of buckets of hash table.
TREE_MAX_LOADreal(kind=R8P)parameterMaximum load of hash table buckets.
TREE_MAX_SANITIZE_ITERATIONSinteger(kind=I4P)parameterDefault number of tree sanitize iterations.

Derived Types

tree_object

Tree class definition.

Components

NameTypeAttributesDescription
mpihtype(mpih_object)MPI handler.
gridtype(grid_object)pointerGrid data.
buckettype(tree_bucket_object)allocatableTree buckets.
buckets_numberinteger(kind=I8P)Number of buckets used.
nodes_numberinteger(kind=I4P)Number of nodes actually stored, namely the tree length.
max_loadreal(kind=R8P)Maximum load of tree buckets.
ratiointeger(kind=I4P)Refinement ratio.
max_levelinteger(kind=I4P)Maximum refinement level.
is_initialized_logicalInitialization status.
ijkl_pruneinteger(kind=I4P)IJKL prune indexes for simple-initial-forest.
iu_ref_levelsinteger(kind=I4P)Initial uniform refinement levels.
my_nodes_numberinteger(kind=I4P)Number of my nodes, keep_nodes_number + recv_nodes_number.
n_my_derefineinteger(kind=I8P)Number of my nodes to be derefined.
n_my_refineinteger(kind=I8P)Number of my nodes to be refined.
last_block_indexinteger(kind=I8P)Last block index in the field array.
node_to_refineinteger(kind=I8P)allocatableList of nodes to be refined.
node_to_derefineinteger(kind=I8P)allocatableList of nodes to be derefined.
block_to_refineinteger(kind=I8P)allocatableList of field blocks to be refined.
block_refinedinteger(kind=I8P)allocatableList of field refined blocks with Morton code.
block_to_derefineinteger(kind=I8P)allocatableList of field blocks to be derefined.
block_derefinedinteger(kind=I8P)allocatableList of field derefined blocks with Morton code.
block_coordinatesinteger(kind=I4P)allocatableBlock coordinates of redistributed blocks [4,blocks_number].
block_codeinteger(kind=I8P)allocatableBlock Morton code of redistributed blocks [blocks_number].

Type-Bound Procedures

NameAttributesDescription
adaptpass(self)Adapt tree accordingly to refine/derefine necessity.
codespass(self)Return the list of (sorted) codes actually stored in the tree.
descriptionpass(self)Return pretty-printed object description.
get_closest_blockpass(self)Get the closest block to a given point.
get_closest_cellspass(self)Get the closest cells to a given point.
hashpass(self)Hash the key.
has_codepass(self)Check if the code is present in the tree.
initializepass(self)Initialize the tree.
load_nodespass(self)Load nodes data, used for restart.
load_from_ini_filepass(self)Load object data from INI file.
looppass(self)Sentinel while-loop on nodes returning the code.
mark_all_nodespass(self)Mark all nodes to be refined, derefined, ecc.
mark_spherepass(self)Mark nodes to be refined/derefined by sphere distance.
max_cell_deltanopassReturn the maximum cell delta given a comparison distance.
nodepass(self)Return a pointer to a node.
prime_buckets_numberpass(self)Return the buckets number as nearest prime number given nodes number.
prunepass(self)Prune nodes.
resizepass(self)Resize the tree.
save_nodespass(self)Save nodes data, used for restart.
traversepass(self)Traverse tree calling the iterator procedure.
update_blocks_coordinatespass(self)Update blocks coordinates of redistributed nodes.
import_refinements_neededpass(self)Import refinements needed status changed externally.
mpi_redistributepass(self)Redistribute nodes to MPI processes, load balancing.
coordinates_to_mortonReturn the Morton code given space-level coordinates.
levelpass(self)Return the refinement level given the code.
morton_to_coordinatesReturn the space-level coordinates given Morton code.
all_siblingspass(self)Return all siblings Morton code given Morton code.
childpass(self)Return the i-th child given Morton code.
child_localpass(self)Return the child index in the local numbering.
childrenpass(self)Return the children list given Morton code.
coordinates3D_to_mortonpass(self)Return the Morton code given ijkl coordinates.
coordinates2D_to_mortonpass(self)Return the Morton code given ijl coordinates.
coordinates1D_to_mortonpass(self)Return the Morton code given il coordinates.
finest_at_levelpass(self)Return the finest node code at given level.
first_at_levelpass(self)Return the first node code at given level.
first_common_parentpass(self)Return the first common parent given two codes.
get_neighbor_allpass(self)Return the neighbor given face/edge/corner of given Morton code.
greaterpass(self)Return true if code is greater than other.
is_greater_by_levelpass(self)Return true if code is greater than other, comparing level.
is_greater_by_pospass(self)Return true if code is greater than other, comparing position
is_lower_by_levelpass(self)Return true if code is lower than other, comparing level.
is_lower_by_pospass(self)Return true if code is lower than other, comparing position.
last_at_levelpass(self)Return the last node code at given level.
lowerpass(self)Return true if code is lower than other.
make_neighborhoodpass(self)Make neighborhood all whole tree and store it in nodes.
morton_to_coordinates3Dpass(self)Return the ijkl coordinates given Morton code.
morton_to_coordinates2Dpass(self)Return the ijl coordinates given Morton code.
morton_to_coordinates1Dpass(self)Return the il coordinates given Morton code.
parentpass(self)Return the parent given Morton code.
parent_at_levelpass(self)Return the parent given Morton code at given level.
pathpass(self)Return the path codes, the list of codes from given node to root.
print_code_topologypass(self)Print all code topology data.
siblingspass(self)Return the siblings Morton code given Morton code.
add_nodepass(self)Add a node pointer to the tree.
derefinepass(self)Derefine nodes.
emptypass(self)Empty tree, i.e. remove all nodes, without destroy the tree.
refinepass(self)Refine nodes.
remove_nodepass(self)Remove a node from the tree, given the key.
sanitizepass(self)Sanitize the tree.

Subroutines

adapt

Adapt tree accordingly to refine/derefine necessity.

fortran
subroutine adapt(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

get_closest_cells

Get the closest cells to a given point.

fortran
subroutine get_closest_cells(self, point, code, ijk, v, xyz)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
pointreal(kind=R8P)inPoint xyz coordinates.
codeinteger(kind=I8P)inThe Morton code of the closest block.
ijkinteger(kind=I4P)outClosest cells indexes.
vinteger(kind=I4P)outoptionalClosest vertex index.
xyzreal(kind=R8P)outoptionalClosest cells center-coordinates.

Call graph

initialize

Initialize the tree.

fortran
subroutine initialize(self, grid, file_parameters, max_load, nodes_number, buckets_number, ratio, max_level, add_adam, iu_ref_levels, i_prune, j_prune, k_prune, l_prune)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
gridtype(grid_object)intargetGrid data.
file_parameterstype(file_ini)inoutoptionalINI file handler.
max_loadreal(kind=R8P)inoptionalMaximum load of tree buckets.
nodes_numberinteger(kind=I8P)inoptionalNodes number to be stored in the tree.
buckets_numberinteger(kind=I8P)inoptionalNumber of buckets for initialize the tree.
ratiointeger(kind=I4P)inoptionalRefinement ratio.
max_levelinteger(kind=I4P)inoptionalMaximum refinement level.
add_adamlogicalinoptionalAdd ADAM node, the ancestor of all nodes.
iu_ref_levelsinteger(kind=I4P)inoptionalUniform initial refinement.
i_pruneinteger(kind=I4P)inoptionalPruning along x.
j_pruneinteger(kind=I4P)inoptionalPruning along y.
k_pruneinteger(kind=I4P)inoptionalPruning along z.
l_pruneinteger(kind=I4P)inoptionalPruning level.

Call graph

load_nodes

Load nodes data, used for restart.

Note: the tree is made empty before lading nodes data.

fortran
subroutine load_nodes(self, file_name)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
file_namecharacter(len=*)inOutput file name.

Call graph

load_from_ini_file

Load object data from INI file.

fortran
subroutine load_from_ini_file(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
file_parameterstype(file_ini)inoutINI file handler.

Call graph

make_neighborhood

Make neighborhood all whole tree and store it in nodes.

fortran
subroutine make_neighborhood(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

mark_all_nodes

Mark all nodes to be refined, derefined, ecc.

fortran
subroutine mark_all_nodes(self, mark)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
markinteger(kind=I4P)inMark to be imposed [TO_BE_REFINED,...].

Call graph

mark_sphere

Mark all nodes inside a sphere to be refined.

fortran
subroutine mark_sphere(self, center, radius, threshold)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
centerreal(kind=R8P)inSphere center coordinates [x,y,z].
radiusreal(kind=R8P)inSphere radius.
thresholdreal(kind=R8P)inoptionalThreshold for sphere proximity.

Call graph

prune

Prune nodes.

fortran
subroutine prune(self, ijkl_prune)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
ijkl_pruneinteger(kind=I4P)inoutMaximum coordinates after which the prune operates.

Call graph

resize

Resize the tree.

fortran
subroutine resize(self, nodes_number, max_load)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
nodes_numberinteger(kind=I8P)inNodes number to be stored in the tree.
max_loadreal(kind=R8P)inoptionalMaximum load of tree buckets.

Call graph

save_nodes

Save nodes data, used for restart.

fortran
subroutine save_nodes(self, file_name)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
file_namecharacter(len=*)inOutput file name.

Call graph

traverse

Traverse tree calling the iterator procedure.

fortran
subroutine traverse(self, iterator)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
iteratorprocedure(iterator_interface)The (key) iterator procedure to call for each node.

Call graph

update_blocks_coordinates

Update blocks coordinates of redistributed nodes.

fortran
subroutine update_blocks_coordinates(self, my_nodes_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
my_nodes_numberinteger(kind=I4P)inNumber of my nodes, keep_nodes_number + recv_nodes_number.

Call graph

import_refinements_needed

Import refinements needed status changed externally.

fortran
subroutine import_refinements_needed(self, refinements_needed_all, disp_count)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
refinements_needed_allinteger(kind=I4P)inallocatableRefinements needed of all blocks.
disp_countinteger(kind=I4P)inallocatableDisplacement of blocks that are received from process.

Call graph

mpi_redistribute

Redistribute nodes to processes, load balancing.

The nodes are distributed among all process exploiting the Morton ordering spatiality. Simply, the sorted list of codes are splitted in chunk of nodes_number/procs_number balancing the workload. However, the algorithm checks if the splits fall among siblings that cannot be splitted: if this scenario happens the siblings are placed in the same process for preserving the spatiality. The algorithm is sophisticated enough to place the siblings alternatively to the left or right process accordingly to where the split falls, namely to the right if the split falls in the first half of siblings or to the left if it falls in the second half.

fortran
subroutine mpi_redistribute(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

get_neighbor_all

Return the neighbor in a given face/edge/corner of given Morton code.

The direction fec is organized as: faces=[1,6], edges=[7,18], corners=[19,26].

We define direct neighbor the neighbor of given code in the given face at the same level of the given code either if it exists or not.

fortran
subroutine get_neighbor_all(self, code, face, neighbor, neighbor_type, neighbor_portion, neighbor_bc_fec)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
faceinteger(kind=I4P)inFace queried.
neighborinteger(kind=I8P)outallocatableNeighbors codes list, [1] or [ratio/2].
neighbor_typeinteger(kind=I4P)outType of neighbor.
neighbor_portioninteger(kind=I4P)outoptionalNeighbors portion.
neighbor_bc_fecinteger(kind=I4P)outoptionalNeighbors fec for BC.

Call graph

is_greater_by_level

Return true if code is greater than other, comparing level.

fortran
subroutine is_greater_by_level(self, lhs, rhs, res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.
reslogicaloutComparison result.

Call graph

is_greater_by_pos

Return true if code is greater than other, comparing position.

fortran
subroutine is_greater_by_pos(self, lhs, rhs, res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.
reslogicaloutComparison result.

Call graph

is_lower_by_level

Return true if code is lower than other, comparing level.

fortran
subroutine is_lower_by_level(self, lhs, rhs, res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.
reslogicaloutComparison result.

Call graph

is_lower_by_pos

Return true if code is lower than other, comparing position.

fortran
subroutine is_lower_by_pos(self, lhs, rhs, res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.
reslogicaloutComparison result.

Call graph

morton_to_coordinates1D

Return the il coordinates given Morton code.

fortran
subroutine morton_to_coordinates1D(self, code, i, l)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
iinteger(kind=I4P)outI coordinate.
linteger(kind=I4P)outL coordinate.

Call graph

morton_to_coordinates2D

Return the ijl coordinates given Morton code.

fortran
subroutine morton_to_coordinates2D(self, code, i, j, l)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
iinteger(kind=I4P)outI coordinate.
jinteger(kind=I4P)outJ coordinate.
linteger(kind=I4P)outL coordinate.

Call graph

morton_to_coordinates3D

Return the ijkl coordinates given Morton code.

fortran
subroutine morton_to_coordinates3D(self, code, i, j, k, l)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
iinteger(kind=I4P)outI coordinate.
jinteger(kind=I4P)outJ coordinate.
kinteger(kind=I4P)outK coordinate.
linteger(kind=I4P)outL coordinate.

Call graph

Print all code topology data.

fortran
subroutine print_code_topology(self, code, coordinates, level, parent, parents, path, child, child_local_code, finest, siblings, neighbor, block_index, whole)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
coordinateslogicalinoptionalCoordinates.
levellogicalinoptionalLevel of node.
parentlogicalinoptionalParent of code.
parentslogicalinoptionalParents list.
pathlogicalinoptionalPath from node to parent of first level.
childlogicalinoptional(First) Child of code.
child_local_codelogicalinoptionalLocal child-numbering of code.
finestlogicalinoptionalFinest Morton code.
siblingslogicalinoptionalSiblings of code.
neighborlogicalinoptionalNeighbor of code.
block_indexlogicalinoptionalBlock index in the field array.
wholelogicalinoptionalWhole topology data.

Call graph

add_node

Add a node pointer to the tree.

@note If a node with the same key is already in the tree, it is removed and the new one will replace it.

fortran
subroutine add_node(self, code, refinement_needed, rank, block_index, update_last_block_index)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
codeinteger(kind=I8P)inThe Morton code.
refinement_neededinteger(kind=I4P)inoptionalFlag for refinement/derefinement algorithm.
rankinteger(kind=I4P)inoptionalMPI rank process.
block_indexinteger(kind=I8P)inoptionalBlock index in the field array.
update_last_block_indexlogicalinoptionalUpdate or not last block index.

Call graph

derefine

Derefine nodes.

fortran
subroutine derefine(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

empty

Empty tree, i.e. remove all nodes, without destroy the tree.

fortran
subroutine empty(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

refine

Refine nodes.

fortran
subroutine refine(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.

Call graph

remove_node

Remove a node from the tree, given the code.

fortran
subroutine remove_node(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
codeinteger(kind=I8P)inThe Morton code.

Call graph

sanitize

Sanitize the tree.

fortran
subroutine sanitize(self, iterations_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
iterations_numberinteger(kind=I4P)inoptionalSanitazie iterations number.

Call graph

Functions

codes

Return the list of (sorted) codes actually stored in the tree.

Returns: integer(kind=I8P)

fortran
function codes(self, only_mine, sort_by_level)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
only_minelogicalinoptionalIf true return only the nodes of myrank process.
sort_by_levellogicalinoptionalIf true sort codes be level instead of position.

Call graph

description

Return a pretty-formatted object description.

Attributes: pure

Returns: character(len=:)

fortran
function description(self) result(desc)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.

Call graph

get_closest_block

Get the closest block to a given point.

Returns: integer(kind=I8P)

fortran
function get_closest_block(self, point) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inoutThe tree.
pointreal(kind=R8P)inPoint xyz coordinates.

Call graph

has_code

Check if the key is present in the tree.

Returns: logical

fortran
function has_code(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inThe Morton code.

Call graph

hash

Hash the key.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function hash(self, code) result(bucket)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inThe Morton code.

Call graph

loop

Sentinel while-loop on nodes returning the code (for tree looping).

Returns: logical

fortran
function loop(self, code, node_ptr) result(again)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree bucket.
codeinteger(kind=I8P)outoptionalThe Morton code.
node_ptrtype(tree_node_object)outpointer, optionalPointer to current node.

Call graph

max_cell_delta

Return the maximum cell delta given a comparison distance.

Returns: real(kind=R8P)

fortran
function max_cell_delta(distance) result(delta)

Arguments

NameTypeIntentAttributesDescription
distancereal(kind=R8P)inComparison distance.

Call graph

node

Return a pointer to a node in the tree.

Returns: type(tree_node_object)

fortran
function node(self, code) result(p)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inThe Morton code.

Call graph

prime_buckets_number

Return the buckets number as the nearest prime number given nodes number.

@note The balanced buckets number is computing considering the tree load defined in self and using the Sieve of Eratoshenes for findining the nearest prime number.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function prime_buckets_number(self, nodes_number) result(buckets_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
nodes_numberinteger(kind=I8P)inNodes number to be stored in the tree.

Call graph

level

Return the refinement level given the code.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function level(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

all_siblings

Return all siblings Morton code given Morton code (included into the list).

Attributes: pure

Returns: integer(kind=I8P)

fortran
function all_siblings(self, code) result(siblings)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

child

Return the i-th child given Morton code.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function child(self, code, i)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
iinteger(kind=I4P)inChild index [0, ratio-1].

Call graph

child_local

Return the child index in the local numbering.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function child_local(self, code) result(child)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

children

Return the children given Morton code.

Attributes: pure

Returns: integer(kind=I8P)

fortran
function children(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

coordinates1D_to_morton

Return the Morton code given ijl coordinates.

Returns: integer(kind=I8P)

fortran
function coordinates1D_to_morton(self, i, l) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
iinteger(kind=I4P)inI coordinate.
linteger(kind=I4P)inL coordinate.

Call graph

coordinates2D_to_morton

Return the Morton code given ijl coordinates.

Returns: integer(kind=I8P)

fortran
function coordinates2D_to_morton(self, i, j, l) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
iinteger(kind=I4P)inI coordinate.
jinteger(kind=I4P)inJ coordinate.
linteger(kind=I4P)inL coordinate.

Call graph

coordinates3D_to_morton

Return the Morton code given ijkl coordinates.

Returns: integer(kind=I8P)

fortran
function coordinates3D_to_morton(self, i, j, k, l) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
iinteger(kind=I4P)inI coordinate.
jinteger(kind=I4P)inJ coordinate.
kinteger(kind=I4P)inK coordinate.
linteger(kind=I4P)inL coordinate.

Call graph

finest_at_level

Return the inest node code at given level, namely the last child at a given level.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function finest_at_level(self, code, level) result(finest)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
levelinteger(kind=I4P)inRefinement level.

Call graph

first_at_level

Return the first node code at given level.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function first_at_level(self, level) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
levelinteger(kind=I4P)inRefinement level.

Call graph

first_common_parent

Return the first common parent given two codes.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function first_common_parent(self, code1, code2) result(fc_parent)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
code1integer(kind=I8P)inMorton codes.
code2integer(kind=I8P)inMorton codes.

greater

Return true if code is greater than other.

Attributes: elemental

Returns: logical

fortran
function greater(self, lhs, rhs) result(res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.

Call graph

last_at_level

Return the last node code at given level.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function last_at_level(self, level) result(code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
levelinteger(kind=I4P)inRefinement level.

Call graph

lower

Return true if code is lower than other.

Attributes: elemental

Returns: logical

fortran
function lower(self, lhs, rhs) result(res)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
lhsinteger(kind=I8P)inLeft hand side of code comparison.
rhsinteger(kind=I8P)inRight hand side of code comparison.

Call graph

parent

Return the parent given Morton code.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function parent(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

parent_at_level

Return the parent given Morton code at a given level.

Attributes: elemental

Returns: integer(kind=I8P)

fortran
function parent_at_level(self, code, level) result(parent)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.
levelinteger(kind=I4P)inRefinement level.

Call graph

path

Return the path codes, the list of codes from given node to root.

Attributes: pure

Returns: integer(kind=I8P)

fortran
function path(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph

siblings

Return the siblings Morton code given Morton code.

Attributes: pure

Returns: integer(kind=I8P)

fortran
function siblings(self, code)

Arguments

NameTypeIntentAttributesDescription
selfclass(tree_object)inThe tree.
codeinteger(kind=I8P)inMorton code.

Call graph