23#include "openPMD/Dataset.hpp"
24#include "openPMD/Datatype.hpp"
25#include "openPMD/auxiliary/ShareRaw.hpp"
26#include "openPMD/auxiliary/TypeTraits.hpp"
27#include "openPMD/auxiliary/UniquePtr.hpp"
28#include "openPMD/backend/Attributable.hpp"
29#include "openPMD/backend/BaseRecordComponent.hpp"
32#include "openPMD/DatatypeMacros.hpp"
48#ifndef OPENPMD_protected
49#define OPENPMD_protected protected:
62 class RecordComponentData :
public BaseRecordComponentData
65 RecordComponentData();
67 RecordComponentData(RecordComponentData
const &) =
delete;
68 RecordComponentData(RecordComponentData &&) =
delete;
70 RecordComponentData &operator=(RecordComponentData
const &) =
delete;
71 RecordComponentData &operator=(RecordComponentData &&) =
delete;
78 void push_chunk(
IOTask &&task);
99 BaseRecordComponentData::reset();
106 template <
typename,
typename>
107 class BaseRecordData;
115 template <
typename T,
typename T_key,
typename T_container>
116 friend class Container;
117 friend class Iteration;
118 friend class ParticleSpecies;
120 friend class BaseRecord;
121 template <
typename,
typename>
126 friend class DynamicMemoryView;
128 friend class MeshRecordComponent;
129 template <
typename T>
130 friend T &internal::makeOwning(
T &self,
Series);
133 enum class Allocation
173 uint8_t getDimensionality()
const;
174 Extent getExtent()
const;
184 template <
typename T>
195 template <
typename T>
224 template <
typename T>
225 std::shared_ptr<T>
loadChunk(Offset = {0u}, Extent = {-1u});
227#define OPENPMD_ENUMERATE_TYPES(type) , std::shared_ptr<type>
228 using shared_ptr_dataset_types = auxiliary::detail::variant_tail_t<
230 OPENPMD_ENUMERATE_TYPES)>;
231#undef OPENPMD_ENUMERATE_TYPES
266 template <
typename T>
267 void loadChunk(std::shared_ptr<T> data, Offset offset, Extent extent);
285 template <
typename T>
286 void loadChunk(std::shared_ptr<
T[]> data, Offset offset, Extent extent);
303 template <
typename T>
324 template <
typename T>
325 void storeChunk(std::shared_ptr<T> data, Offset offset, Extent extent);
336 template <
typename T>
337 void storeChunk(std::shared_ptr<
T[]> data, Offset offset, Extent extent);
351 template <
typename T>
366 template <
typename T,
typename Del>
367 void storeChunk(std::unique_ptr<T, Del> data, Offset offset, Extent extent);
381 template <
typename T>
399 template <
typename T_ContiguousContainer>
400 typename std::enable_if_t<
401 auxiliary::IsContiguousContainer_v<T_ContiguousContainer>>
403 T_ContiguousContainer &data,
404 Offset offset = {0u},
405 Extent extent = {-1u});
440 template <
typename T,
typename F>
448 template <
typename T>
449 DynamicMemoryView<T>
storeChunk(Offset, Extent);
481 template <
typename Visitor,
typename... Args>
482 auto visit(Args &&...args) ->
decltype(Visitor::template call<char>(
483 std::declval<RecordComponent &>(), std::forward<Args>(args)...));
485 static constexpr char const *
const SCALAR =
"\vScalar";
489 void read(
bool require_unit_si);
508 std::shared_ptr<Data_t> m_recordComponentData;
513 inline Data_t
const &get()
const
517 return *m_recordComponentData;
522 setDatasetDefined(*m_recordComponentData);
523 return *m_recordComponentData;
526 inline std::shared_ptr<Data_t> getShared()
528 return m_recordComponentData;
531 inline void setData(std::shared_ptr<internal::RecordComponentData> data)
533 m_recordComponentData = std::move(data);
534 BaseRecordComponent::setData(m_recordComponentData);
537 void readBase(
bool require_unit_si);
539 template <
typename T>
540 void verifyChunk(Offset
const &, Extent
const &)
const;
542 void verifyChunk(
Datatype, Offset
const &, Extent
const &)
const;
549 struct HomogenizeExtents
551 std::deque<RecordComponent> without_extent;
552 std::optional<Extent> retrieved_extent;
553 bool verify_homogeneous_extents =
true;
555 explicit HomogenizeExtents();
556 HomogenizeExtents(
bool verify_homogeneous_extents);
559 auto merge(
Attributable const &callsite, HomogenizeExtents)
560 -> HomogenizeExtents &;
567#include "openPMD/UndefDatatypeMacros.hpp"
569#include "RecordComponent.tpp"
Layer to manage storage of attributes associated with file objects.
Definition Attributable.hpp:222
Definition Attribute.hpp:64
Definition Dataset.hpp:38
A view into a buffer that might be reallocated at some points and thus has changing base pointers ove...
Definition Span.hpp:97
Self-contained description of a single IO operation.
Definition IOTask.hpp:836
Definition RecordComponent.hpp:114
DynamicMemoryView< T > storeChunk(Offset offset, Extent extent, F &&createBuffer)
Overload of storeChunk() that lets the openPMD API allocate a buffer.
RecordComponent & makeEmpty(uint8_t dimensions)
Create a dataset with zero extent in each dimension.
Definition RecordComponent.cpp:748
RecordComponent & resetDataset(Dataset)
Declare the dataset's type and extent.
Definition RecordComponent.cpp:206
auto visit(Args &&...args) -> decltype(Visitor::template call< char >(std::declval< RecordComponent & >(), std::forward< Args >(args)...))
Run a template functor on the type of the record component, similar to std::visit().
bool empty() const
Returns true if this is an empty record component.
Definition RecordComponent.cpp:369
RecordComponent(BaseRecord< RecordComponent > const &)
Avoid object slicing when using a Record as a scalar Record Component.
Definition RecordComponent.cpp:190
std::shared_ptr< T > loadChunk(Offset={0u}, Extent={-1u})
Load and allocate a chunk of data.
Definition RecordComponent.cpp:754
void storeChunk(std::shared_ptr< T > data, Offset offset, Extent extent)
Store a chunk of data from a chunk of memory.
Definition RecordComponent.cpp:937
RecordComponent & makeConstant(T)
Create a dataset with regular extent and constant value.
Definition RecordComponent.cpp:733
std::enable_if_t< auxiliary::IsContiguousContainer_v< T_ContiguousContainer > > storeChunk(T_ContiguousContainer &data, Offset offset={0u}, Extent extent={-1u})
Store a chunk of data from a contiguous container.
shared_ptr_dataset_types loadChunkVariant(Offset={0u}, Extent={-1u})
std::variant-based version of allocating loadChunk<T>(Offset, Extent)
Definition RecordComponent.cpp:726
void storeChunk(std::unique_ptr< T, Del > data, Offset offset, Extent extent)
Store a chunk of data from a chunk of memory, unique pointer version.
void storeChunkRaw(T const *data, Offset offset, Extent extent)
Store a chunk of data from a chunk of memory, raw pointer version.
Definition RecordComponent.cpp:978
void loadChunkRaw(T *data, Offset offset, Extent extent)
Load a chunk of data into pre-allocated memory, raw pointer version.
Definition RecordComponent.cpp:931
Implementation for the root level of the openPMD hierarchy.
Definition Series.hpp:288
Unique Pointer class that uses a dynamic destructor type.
Definition UniquePtr.hpp:86
Definition BaseRecord.hpp:52
Definition RecordComponent.hpp:63
bool m_hasBeenExtended
User has extended the dataset, but the EXTEND task must yet be flushed to the backend.
Definition RecordComponent.hpp:95
std::queue< IOTask > m_chunks
Chunk reading/writing requests on the contained dataset.
Definition RecordComponent.hpp:76
Attribute m_constantValue
Stores the value for constant record components.
Definition RecordComponent.hpp:83
bool m_isEmpty
True if this component is an empty dataset, i.e.
Definition RecordComponent.hpp:90
Public definitions of openPMD-api.
Definition Date.cpp:29
@ T
time
Definition UnitDimension.hpp:41
Datatype
Concrete datatype of an object available at runtime.
Definition Datatype.hpp:51
Definition Attributable.hpp:251
Definition TypeTraits.hpp:200
Parameters recursively passed through the openPMD hierarchy when flushing.
Definition AbstractIOHandler.hpp:106