Commit b3f1d443 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added the new naming convention and the usage of multiple files to the RTD...

Added the new naming convention and the usage of multiple files to the RTD description of the top-level cell hash-map access.
parent 0ed9010c
...@@ -276,16 +276,29 @@ the simulation volume. Both the cell sizes and positions of the centres are ...@@ -276,16 +276,29 @@ the simulation volume. Both the cell sizes and positions of the centres are
expressed in the unit system used for the snapshots (see above) and are hence expressed in the unit system used for the snapshots (see above) and are hence
consistent with the particle positions themselves. consistent with the particle positions themselves.
Once the cell(s) containing the region of interest has been located, users can Once the cell(s) containing the region of interest has been located,
use the ``/Cells/Offsets/PartTypeN/Counts`` and users can use the ``/Cells/Offsets/PartTypeN/Files``,
``/Cells/Offsets/PartTypeN/Offsets`` to retrieve the location of the particles ``/Cells/Offsets/PartTypeN/Counts`` and
of type ``N`` in the ``/PartTypeN`` arrays. The cells, offsets and counts are ``/Cells/Offsets/PartTypeN/OffsetsInFile`` to retrieve the location of
sorted spatiall using C-style ordering. That is we first loop over the z axis the particles of type ``N`` in the ``/PartTypeN`` arrays. These
then y axis and x is the slowest varying dimension. contain information about which file contains the particles of a given
cell. It also gives the offset from the start of the ``/PartTypeN``
array *in that file* at which the particles of that cell are located
and how many particles are in the cell. This allows to read a single
contiguous section of the whole array by directly reading the slab
starting at the offset and with the given length.
The cells, files, offsets in file and counts arrays are sorted
spatially using C-style ordering. That means the inner-most loop runs
over the z axis, then y axis and x is the slowest varying dimension.
In the case of a single-file snapshot, the ``Files`` array is just an array of
zeroes since all the particles will be in the 0-th file. Note also that in the
case of a multi-files snapshot, a cell is always contained in a single file.
As an example, if one is interested in retriving all the densities of the gas As an example, if one is interested in retriving all the densities of the gas
particles in the cell around the position `[1, 1, 1]` one could use a piece of particles in the cell around the position `[1, 1, 1]` in a single-file
code similar to: snapstshot one could use a piece of code similar to:
.. code-block:: python .. code-block:: python
:linenos: :linenos:
...@@ -320,7 +333,7 @@ code similar to: ...@@ -320,7 +333,7 @@ code similar to:
print("Centre of the cell:", centre) print("Centre of the cell:", centre)
# Retrieve the offset and counts # Retrieve the offset and counts
my_offset = snapshot_file["/Cells/Offsets/PartType0"][my_cell] my_offset = snapshot_file["/Cells/OffsetsInFile/PartType0"][my_cell]
my_count = snapshot_file["/Cells/Counts/PartType0"][my_cell] my_count = snapshot_file["/Cells/Counts/PartType0"][my_cell]
# Get the densities of the particles in this cell # Get the densities of the particles in this cell
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment