Skip to content

Commit 998f5ad

Browse files
committed
[WIP] Implement series.iterations[0]["meshes"].asContainerOf<Mesh>()
1 parent 74afeb7 commit 998f5ad

4 files changed

Lines changed: 270 additions & 177 deletions

File tree

include/openPMD/CustomHierarchy.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ namespace internal
7373
explicit CustomHierarchyData();
7474

7575
Container<RecordComponent> m_embeddedDatasets;
76+
Container<Mesh> m_embeddedMeshes;
77+
Container<ParticleSpecies> m_embeddedParticles;
7678
};
7779
} // namespace internal
7880

@@ -99,14 +101,19 @@ class CustomHierarchy : public Container<CustomHierarchy>
99101
return *m_customHierarchyData;
100102
}
101103

102-
void readMeshes(std::string const &meshesPath);
103-
void readParticles(std::string const &particlesPath);
104+
void readNonscalarMesh(std::string const &name);
105+
void readScalarMesh(std::string const &name);
106+
void readParticleSpecies(std::string const &name);
104107

105108
void flush_internal(
106109
internal::FlushParams const &,
107110
internal::MeshesParticlesPath &,
108111
std::vector<std::string> currentPath);
109112

113+
template <typename T>
114+
static void
115+
synchronizeContainers(Container<T> &target, Container<T> &source);
116+
110117
protected:
111118
CustomHierarchy();
112119
CustomHierarchy(NoInit);
@@ -145,7 +152,10 @@ class CustomHierarchy : public Container<CustomHierarchy>
145152

146153
Container<RecordComponent> datasets();
147154

155+
template <typename ContainedType>
156+
auto asContainerOf() -> Container<ContainedType>;
157+
148158
Container<Mesh> meshes{};
149-
Container<ParticleSpecies> particles{}; // particleSpecies?
159+
Container<ParticleSpecies> particles{};
150160
};
151161
} // namespace openPMD

include/openPMD/backend/Attributable.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ class AbstractFilePosition;
5050
class Attributable;
5151
class Iteration;
5252
class Series;
53+
class CustomHierarchy;
5354

5455
namespace internal
5556
{
5657
class AttributableData
5758
{
5859
friend class openPMD::Attributable;
60+
friend class openPMD::CustomHierarchy;
5961

6062
public:
6163
AttributableData();
@@ -83,6 +85,7 @@ namespace internal
8385

8486
template <typename, typename>
8587
class BaseRecordData;
88+
struct CustomHierarchyData;
8689
} // namespace internal
8790

8891
/** @brief Layer to manage storage of attributes associated with file objects.
@@ -110,6 +113,7 @@ class Attributable
110113
friend class Writable;
111114
friend class WriteIterations;
112115
friend class CustomHierarchy;
116+
friend class internal::CustomHierarchyData;
113117

114118
protected:
115119
// tag for internal constructor

0 commit comments

Comments
 (0)