openPMD-api
 
Loading...
Searching...
No Matches
Common.hpp
1/* Copyright 2023-2025 The openPMD Community, Franz Poeschel
2 *
3 * This header is used to centrally define classes that shall not violate the
4 * C++ one-definition-rule (ODR) for various Python translation units.
5 *
6 * Authors: Axel Huebl
7 * License: LGPL-3.0-or-later
8 */
9#pragma once
10
11#include "openPMD/ChunkInfo.hpp"
12#include "openPMD/Iteration.hpp"
13#include "openPMD/Mesh.hpp"
14#include "openPMD/ParticlePatches.hpp"
15#include "openPMD/ParticleSpecies.hpp"
16#include "openPMD/Record.hpp"
17#include "openPMD/RecordComponent.hpp"
18#include "openPMD/Series.hpp"
19#include "openPMD/backend/BaseRecord.hpp"
20#include "openPMD/backend/BaseRecordComponent.hpp"
21#include "openPMD/backend/MeshRecordComponent.hpp"
22#include "openPMD/backend/PatchRecord.hpp"
23#include "openPMD/backend/PatchRecordComponent.hpp"
24
25#include <pybind11/gil.h>
26#include <pybind11/numpy.h>
27#include <pybind11/pybind11.h>
28#include <pybind11/stl.h>
29#include <pybind11/stl_bind.h>
30
31#if openPMD_USE_FILESYSTEM_HEADER
32#include <pybind11/stl/filesystem.h>
33#endif
34// not yet used:
35// pybind11/functional.h // for std::function
36
37using PyVecChunkInfo = std::vector<openPMD::ChunkInfo>;
38
39PYBIND11_MAKE_OPAQUE(openPMD::ChunkInfo)
40PYBIND11_MAKE_OPAQUE(PyVecChunkInfo)
41PYBIND11_MAKE_OPAQUE(openPMD::WrittenChunkInfo)
42PYBIND11_MAKE_OPAQUE(openPMD::ChunkTable)
43PYBIND11_MAKE_OPAQUE(openPMD::chunk_assignment::Assignment)
45
46// used exclusively in all our Python .cpp files
47namespace py = pybind11;
48using namespace openPMD;
49
50// opaque types
51using PyIterationContainer = Series::IterationsContainer_t;
52using PyMeshContainer = Container<Mesh>;
53using PyPartContainer = Container<ParticleSpecies>;
54using PyPatchContainer = Container<ParticlePatches>;
55using PyRecordContainer = Container<Record>;
56using PyPatchRecordContainer = Container<PatchRecord>;
57using PyRecordComponentContainer = Container<RecordComponent>;
58using PyMeshRecordComponentContainer = Container<MeshRecordComponent>;
59using PyPatchRecordComponentContainer = Container<PatchRecordComponent>;
60using PyBaseRecordRecordComponent = BaseRecord<RecordComponent>;
61using PyBaseRecordMeshRecordComponent = BaseRecord<MeshRecordComponent>;
62using PyBaseRecordPatchRecordComponent = BaseRecord<PatchRecordComponent>;
63PYBIND11_MAKE_OPAQUE(PyIterationContainer)
64PYBIND11_MAKE_OPAQUE(PyMeshContainer)
65PYBIND11_MAKE_OPAQUE(PyPartContainer)
66PYBIND11_MAKE_OPAQUE(PyPatchContainer)
67PYBIND11_MAKE_OPAQUE(PyRecordContainer)
68PYBIND11_MAKE_OPAQUE(PyPatchRecordContainer)
69PYBIND11_MAKE_OPAQUE(PyRecordComponentContainer)
70PYBIND11_MAKE_OPAQUE(PyMeshRecordComponentContainer)
71PYBIND11_MAKE_OPAQUE(PyPatchRecordComponentContainer)
72PYBIND11_MAKE_OPAQUE(PyBaseRecordRecordComponent)
73PYBIND11_MAKE_OPAQUE(PyBaseRecordPatchRecordComponent)
Base class for any type of record (e.g.
Definition BaseRecord.hpp:182
Map-like container that enforces openPMD requirements and handles IO.
Definition Container.hpp:104
internal::SeriesData::IterationsContainer_t IterationsContainer_t
Type for a container of Iterations indexed by IterationIndex_t.
Definition Series.hpp:387
Public definitions of openPMD-api.
Definition Date.cpp:29
Represents the meta info around a chunk in a dataset.
Definition ChunkInfo.hpp:45
Represents the meta info around a chunk that has been written by some data producing application.
Definition ChunkInfo.hpp:72
Return type for partial chunk assignment strategies.
Definition ChunkInfo.hpp:137