public elemental function tem_FirstIdAtLevel(level) result(res)
This function delivers the refinement level of a TreeID
The refinement level of a
\ref treelmesh_module::treelmesh_type::treeid "treeID" is found by
repeatedly computing the parents with the equation used in the
[tem_ParentOf function] (@ref tem_parentatlevel) and
counting the iterations, until the universal root is reached.
First TreeID in the complete tree on a given level
A level offset is calculated by summing all the nodes of coarser levels.
With a level count starting at \f$0\f$ on the coarsest level (the universal
root node), this offset \f$s\f$ for a given level \f$L\f$ can be computed by
the follwing equation:
\f[
s = \sum\limits_{i=0}^{L-1} 8^i = \frac{8^{L} - 1}{7}
\f]
Todo
calling to this function can be replaced by accessing array
firstIdAtLevel which explicitly stores the results
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
elemental function tem_FirstIdAtLevel(level)result(res)! ---------------------------------------------------------------------------!> level to checkinteger,intent(in)::level!> resulting first treeIDinteger(kind=long_k)::res! ---------------------------------------------------------------------------res=(8_long_k**level-1_long_k)/7_long_kend function tem_FirstIdAtLevel