# tree_d_3d.kernels.quadtree_scatter.quadtree_scatter_pyccel

*module*

The Pyccel version (CPU) of the ``quadtree_scatter`` kernel of the Barnes-Hut and FMM solvers.

``quadtree_scatter_cuda.cu`` next to this file is the CUDA version (GPU) and
``quadtree_scatter_numpy.py`` the version for machines without Pyccel, all with the
same arguments; the folder's ``__init__.py`` declares the kernel (see
:mod:`tree_d_3d.kernels`). The flat quadtree is described in
:mod:`tree_d_3d.flat_tree`.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/kernels/quadtree_scatter/quadtree_scatter_pyccel.py#L1-L1)

## tree_d_3d.kernels.quadtree_scatter.quadtree_scatter_pyccel.quadtree_scatter

*function*

```python
def quadtree_scatter(perm: int64[:], slot_node: int64[:], quadrant: int64[:], below: int64[:, :], node_start: int64[:], node_child: int64[:], new_perm: int64[:], new_slot_node: int64[:]) -> None
```

One level of the tree build: move every particle of a split node into its child.

``below[k, q]`` counts the slots up to and including ``k`` in quadrant ``q``
(the cumulative sum of the one-hot ``quadrant``), so a particle's rank among
its node's particles of the same quadrant is a difference of two entries: the
partition is stable, as a serial one. ``node_start`` of the children must be
set. Particles of unsplit nodes (``quadrant`` -1) stay in their slot.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/kernels/quadtree_scatter/quadtree_scatter_pyccel.py#L14-L49)
