Get the offset of a box with respect to its parent (e.g. in 2d, there can be a child at offset 0,0, one at n_cell/2,0, one at 0,n_cell/2 and one at n_cell/2, n_cell/2) n_cell / 2
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(in) | :: | mg | |||
| integer, | intent(in) | :: | id |
pure function mg_get_child_offset(mg, id) result(ix_offset) type(mg_t), intent(in) :: mg integer, intent(in) :: id integer :: ix_offset(1) if (mg%boxes(id)%lvl <= mg%first_normal_lvl) then ix_offset(:) = 0 else ix_offset = iand(mg%boxes(id)%ix-1, 1) * ishft(mg%box_size, -1) !* n_cell / 2 end if end function mg_get_child_offset