Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | Id2d |
input element ID |
||
integer, | intent(in) | :: | level |
coordinate of element return value
function tem_CoordOf_2d_Id(id2d, level) result(coord) ! -------------------------------------------------------------------- ! !> input element ID integer(kind=long_k), intent(in) :: Id2d integer, intent(in) :: level !> coordinate of element return value integer :: coord(4) ! -------------------------------------------------------------------- ! integer(kind=long_k) :: fak(2) integer :: bitlevel integer :: i integer(kind=long_k) :: telem ! -------------------------------------------------------------------- ! coord(:) = 0 coord(4) = level fak(1) = 1 fak(2) = 2 bitlevel = 1 tElem = id2d ! get x coordinate from ! ! x = sum(iLevel=0, inf) { 2**iLevel * mod(tElem / (4**iLevel) ),2) } ! y = sum(iLevel=0, inf) { 2**iLevel * mod(tElem /(2 * (4**iLevel) ),2) } ! do while ((tElem / fak(1)) > 0) do i=1,2 coord(i) = coord(i) + bitlevel * int(mod(tElem / fak(i), 2_long_k)) end do bitlevel = bitlevel * 2 fak = fak * 4 end do end function tem_CoordOf_2d_Id