23 #include "openPMD/IO/AbstractIOHandler.hpp" 24 #include "openPMD/IO/Access.hpp" 25 #include "openPMD/IO/Format.hpp" 26 #include "openPMD/Iteration.hpp" 27 #include "openPMD/IterationEncoding.hpp" 28 #include "openPMD/Streaming.hpp" 29 #include "openPMD/WriteIterations.hpp" 30 #include "openPMD/auxiliary/Variant.hpp" 31 #include "openPMD/backend/Attributable.hpp" 32 #include "openPMD/backend/Container.hpp" 33 #include "openPMD/backend/ParsePreference.hpp" 34 #include "openPMD/config.hpp" 35 #include "openPMD/version.hpp" 49 #ifndef OPENPMD_private 50 #define OPENPMD_private private: 80 using IterationIndex_t = Iteration::IterationIndex_t;
174 class SeriesInternal;
197 Series(std::shared_ptr<internal::SeriesData>);
204 std::string
const &filepath,
207 std::string
const &options =
"{}");
220 std::string
const &filepath,
222 std::string
const &options =
"{}");
224 virtual ~
Series() =
default;
242 operator bool()
const;
265 uint32_t openPMDextension()
const;
274 Series &setOpenPMDextension(uint32_t openPMDextension);
280 std::string basePath()
const;
288 Series &setBasePath(std::string
const &basePath);
295 std::string meshesPath()
const;
305 Series &setMeshesPath(std::string
const &meshesPath);
312 std::string particlesPath()
const;
322 Series &setParticlesPath(std::string
const &particlesPath);
329 std::string author()
const;
336 Series &setAuthor(std::string
const &author);
343 std::string software()
const;
353 std::string
const &newName,
354 std::string
const &newVersion = std::string(
"unspecified"));
361 std::string softwareVersion()
const;
372 "Set the version with the second argument of setSoftware()")]]
Series &
373 setSoftwareVersion(std::string
const &softwareVersion);
379 std::string date()
const;
385 Series &setDate(std::string
const &date);
392 std::string softwareDependencies()
const;
400 Series &setSoftwareDependencies(std::string
const &newSoftwareDependencies);
407 std::string machine()
const;
414 Series &setMachine(std::string
const &newMachine);
444 std::string iterationFormat()
const;
456 Series &setIterationFormat(std::string
const &iterationFormat);
461 std::string name()
const;
469 Series &setName(std::string
const &name);
477 std::string backend()
const;
486 void flush(std::string backendConfig =
"{}");
530 static constexpr
char const *
const BASEPATH =
"/data/%T/";
533 using iterations_t = decltype(internal::SeriesData::iterations);
534 using iterations_iterator = iterations_t::iterator;
536 std::shared_ptr<internal::SeriesData> m_series =
nullptr;
546 throw std::runtime_error(
547 "[Series] Cannot use default-constructed Series.");
559 throw std::runtime_error(
560 "[Series] Cannot use default-constructed Series.");
564 std::unique_ptr<ParsedInput> parseInput(std::string);
574 template <
typename TracingJSON>
575 void parseJsonOptions(TracingJSON &options,
ParsedInput &);
576 bool hasExpansionPattern(std::string filenameWithExtension);
577 bool reparseExpansionPattern(std::string filenameWithExtension);
578 void init(std::unique_ptr<AbstractIOHandler>, std::unique_ptr<ParsedInput>);
591 std::future<void> flush_impl(
592 iterations_iterator begin,
593 iterations_iterator end,
595 bool flushIOHandler =
true);
597 iterations_iterator begin,
598 iterations_iterator end,
600 bool flushIOHandler =
true);
609 iterations_iterator begin,
610 iterations_iterator end,
612 bool flushIOHandler =
true);
613 void flushMeshesPath();
614 void flushParticlesPath();
615 void readFileBased();
616 void readOneIterationFileBased(std::string
const &filePath);
630 std::optional<std::deque<IterationIndex_t> > readGorVBased(
631 bool do_always_throw_errors,
633 std::set<IterationIndex_t>
const &ignoreIterations = {});
637 enum class IterationOpened : bool
662 iterations_iterator indexOf(
Iteration const &);
682 iterations_iterator it,
693 void flushStep(
bool doFlush);
699 std::optional<std::vector<IterationIndex_t> > currentSnapshot()
const;
705 #include "openPMD/ReadIterations.hpp" bool m_lastFlushSuccessful
This is to avoid that the destructor tries flushing again if an error happened.
Definition: Series.hpp:161
std::string m_filenameExtension
Filename extension as specified by the user.
Definition: Series.hpp:127
std::optional< std::string > m_overrideFilebasedFilename
Needed if reading a single iteration of a file-based series.
Definition: Series.hpp:106
bool m_parseLazily
True if a user opts into lazy parsing.
Definition: Series.hpp:153
std::optional< ParsePreference > m_parsePreference
Remember the preference that the backend specified for parsing.
Definition: Series.hpp:169
Access
File access mode to use during IO.
Definition: Access.hpp:29
Format
File format to use during IO.
Definition: Format.hpp:29
Logical compilation of data from one snapshot (e.g.
Definition: Iteration.hpp:126
StepStatus m_stepStatus
Whether a step is currently active for this iteration.
Definition: Series.hpp:149
std::optional< WriteIterations > m_writeIterations
For each instance of Series, there is only one instance of WriteIterations, stored in this Option...
Definition: Series.hpp:90
StepStatus
Used in step-based mode (i.e.
Definition: Streaming.hpp:45
IterationEncoding m_iterationEncoding
The iteration encoding used in this series.
Definition: Series.hpp:137
std::string m_filenamePostfix
Filename after the expansion pattern without filename extension.
Definition: Series.hpp:122
Format m_format
Detected IO format (backend).
Definition: Series.hpp:141
std::string m_name
Name of the iteration without filename suffix.
Definition: Series.hpp:113
std::set< IterationIndex_t > m_currentlyActiveIterations
For writing: Remember which iterations have been written in the currently active output step...
Definition: Series.hpp:96
AdvanceStatus
In step-based mode (i.e.
Definition: Streaming.hpp:20
AdvanceMode
In step-based mode (i.e.
Definition: Streaming.hpp:34
Definition: WriteIterations.hpp:53
Reading side of the streaming API.
Definition: ReadIterations.hpp:165
Implementation for the root level of the openPMD hierarchy.
Definition: Series.hpp:186
std::string m_filenamePrefix
Filename leading up to the expansion pattern.
Definition: Series.hpp:118
Public definitions of openPMD-api.
Layer to mirror structure of logical data and persistent data in file.
Definition: Writable.hpp:64
Iteration::IterationIndex_t IterationIndex_t
An unsigned integer type, used to identify Iterations in a Series.
Definition: Series.hpp:229
Data members for Series.
Definition: Series.hpp:67
Definition: Attributable.hpp:56
Definition: ReadIterations.hpp:54
Parameters recursively passed through the openPMD hierarchy when flushing.
Definition: AbstractIOHandler.hpp:84
IterationEncoding
Encoding scheme of an Iterations Series'.
Definition: IterationEncoding.hpp:32
int m_filenamePadding
The padding in file-based iteration encoding.
Definition: Series.hpp:133
Layer to manage storage of attributes associated with file objects.
Definition: Attributable.hpp:93