Skip to content

Commit b0950c7

Browse files
committed
Cleanup
1 parent da3a45f commit b0950c7

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

docs/source/details/backendconfig.rst

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ Dataset-specific configuration
256256
------------------------------
257257

258258
Some configuration options should be applicable on a per-dataset basis.
259-
All dataset-specific configuration options supported by the openPMD-api are additionally backend-specific, being format-specific serialization instructions such as compression or chunking.
260-
Dataset-specific configuration is hence specified under the key path ``<backend>.dataset``, e.g.:
259+
Most dataset-specific configuration options supported by the openPMD-api are additionally backend-specific, being format-specific serialization instructions such as compression or chunking.
260+
Such dataset-specific and backend-specific configuration is hence specified under the key path ``<backend>.dataset``, e.g.:
261261

262262
.. code-block:: json
263263
@@ -286,39 +286,41 @@ As a separate JSON/TOML configuration during dataset initialization
286286

287287
Similarly to the ``Series`` constructor, the ``Dataset`` constructor optionally receives a JSON/TOML configuration, used for setting options specifically only for those datasets initialized with this ``Dataset`` specification. The default given in the ``Series`` constructor will be overridden.
288288

289+
This is the preferred way for configuring dataset-specific options that are *not* backend-specific (currently only ``{"resizable": true}``).
290+
289291
By pattern-matching the dataset names
290292
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
291293

292-
The above approach has the disadvantage that it has to be supported explicitly at the level of the downstream application, e.g. a simulation or data reader. As an alternative, the the dataset configuration under ``<backend>.dataset`` can also be given as a list of alternatives that are matched against the dataset name in sequence, e.g. ``hdf5.dataset = [<pattern_1>, <pattern_2>, ...]``.
294+
The above approach has the disadvantage that it has to be supported explicitly at the level of the downstream application, e.g. a simulation or data reader. As an alternative, the the backend-specific dataset configuration under ``<backend>.dataset`` can also be given as a list of alternatives that are matched against the dataset name in sequence, e.g. ``hdf5.dataset = [<pattern_1>, <pattern_2>, ...]``.
293295

294-
Each such pattern ``<pattern_i>`` is a JSON object with key ``cfg`` and optional key ``select``: ``{"select": <pattern>, "cfg": <cfg>}``.
296+
Each such pattern ``<pattern_i>`` is a JSON object with key ``cfg`` and optional key ``select``: ``{"select": <regex>, "cfg": <cfg>}``.
295297

296-
In here, ``<pattern>`` is a regex or a list of regexes, as of type egrep as defined by the `C++ standard library <https://en.cppreference.com/w/cpp/regex/basic_regex/constants>`__.
297-
``<cfg>`` is a configuration that will be forwarded as-is to openPMD.
298+
In here, ``<regex>`` is a regex or a list of regexes, of type egrep as defined by the `C++ standard library <https://en.cppreference.com/w/cpp/regex/basic_regex/constants>`__.
299+
``<cfg>`` is a configuration that will be forwarded as a "regular" dataset configuration to the backend.
298300

299301
.. note::
300302

301-
To match lists of regular expressions ``select = [PATTERN_1, PATTERN_2, ..., PATTERN_n]``, the list is internally transformed into a single regular expression ``($^)|(PATTERN_1)|(PATTERN_2)|...|(PATTERN_n)``.
303+
To match lists of regular expressions ``select = [REGEX_1, REGEX_2, ..., REGEX_n]``, the list is internally transformed into a single regular expression ``($^)|(REGEX_1)|(REGEX_2)|...|(REGEX_n)``.
302304

303-
The single patterns will be processed in top-down manner, selecting the first matching pattern found in the list.
304-
The regexes will be matched against the openPMD dataset path either within the Iteration (e.g. ``meshes/E/x`` or ``particles/.*/position/.*``) or within the Series (e.g. ``/data/1/meshes/E/x`` or ``/data/.*/particles/.*/position/.*``), considering full matches only.
305+
In a configuration such as ``hdf5.dataset = [<pattern_1>, <pattern_2>, ...]``, the single patterns will be processed in top-down manner, selecting the first matching pattern found in the list.
306+
The specified regexes will be matched against the openPMD dataset path either within the Iteration (e.g. ``meshes/E/x`` or ``particles/.*/position/.*``) or within the Series (e.g. ``/data/1/meshes/E/x`` or ``/data/.*/particles/.*/position/.*``), considering full matches only.
305307

306308
.. note::
307309

308310
The dataset name is determined by the result of ``attributable.myPath().openPMDPath()`` where ``attributable`` is an object in the openPMD hierarchy.
309311

310312
.. note::
311313

312-
To match against the path within the containing Iteration or within the containing Series, the specified regular expression is internally transformed into ``(/data/[0-9]+/)?(PATTERN)`` where ``PATTERN`` is the specified pattern, and then matched against the full dataset path.
314+
To match against the path within the containing Iteration or within the containing Series, the specified regular expression is internally transformed into ``(/data/[0-9]+/)?(REGEX)`` where ``REGEX`` is the specified pattern, and then matched against the full dataset path.
313315

314316
The **default configuration** is specified by omitting the ``select`` key.
315317
Specifying more than one default is an error.
316318
If no pattern matches a dataset, the default configuration is chosen if specified, or an empty JSON object ``{}`` otherwise.
317319

318320
A full example:
319321

320-
.. literalinclude:: openpmd_extended_config.json
321-
:language: json
322-
323322
.. literalinclude:: openpmd_extended_config.toml
324323
:language: toml
324+
325+
.. literalinclude:: openpmd_extended_config.json
326+
:language: json

examples/13_write_dynamic_configuration.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ CFG.CHUNKS = [10]
186186

187187
/*
188188
* We want different compression settings for this dataset, so we pass
189-
* a dataset-specific configuration.
189+
* a dataset-specific configuration. This will override any definition
190+
* specified above.
190191
* Also showcase how to define an resizable dataset.
191192
* This time in JSON.
192193
*/

0 commit comments

Comments
 (0)