Skip to content

Commit a2d01bc

Browse files
committed
Fix this..
1 parent f0aa9b8 commit a2d01bc

File tree

7 files changed

+25
-23
lines changed

7 files changed

+25
-23
lines changed

include/openPMD/backend/Attributable.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ namespace internal
173173
* Attributable::setDirtyRecursive().
174174
*/
175175
bool dirtyRecursive = true;
176+
177+
/**
178+
* If frontend_parent is not null, then this is a key such that:
179+
* &(*frontend_parent)[key] == this
180+
*/
181+
std::string ownKeyWithinParent;
176182
};
177183

178184
template <typename, typename>

include/openPMD/backend/Container.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ class Container : virtual public Attributable
301301
auto &ret = container().insert({key, std::move(t)}).first->second;
302302
if constexpr (std::is_same_v<T_key, std::string>)
303303
{
304-
ret.writable().ownKeyWithinParent = key;
304+
ret.m_attri->ownKeyWithinParent = key;
305305
}
306306
else
307307
{
308-
ret.writable().ownKeyWithinParent = std::to_string(key);
308+
ret.m_attri->ownKeyWithinParent = std::to_string(key);
309309
}
310310
traits::GenerationPolicy<T> gen;
311311
gen(ret, this);
@@ -342,11 +342,11 @@ class Container : virtual public Attributable
342342
auto &ret = container().insert({key, std::move(t)}).first->second;
343343
if constexpr (std::is_same_v<T_key, std::string>)
344344
{
345-
ret.writable().ownKeyWithinParent = std::move(key);
345+
ret.m_attri->ownKeyWithinParent = std::move(key);
346346
}
347347
else
348348
{
349-
ret.writable().ownKeyWithinParent =
349+
ret.m_attri->ownKeyWithinParent =
350350
std::to_string(std::move(key));
351351
}
352352
traits::GenerationPolicy<T> gen;

include/openPMD/backend/Writable.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,6 @@ OPENPMD_private
165165
internal::AttributableData *attributable = nullptr;
166166
Writable *parent = nullptr;
167167

168-
/**
169-
* If parent is not null, then this is a key such that:
170-
* &(*parent)[key] == this
171-
*/
172-
std::string ownKeyWithinParent;
173168
/**
174169
* @brief Whether a Writable has been written to the backend.
175170
*

src/Iteration.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Iteration::Iteration() : Attributable(NoInit())
5353
setTime(static_cast<double>(0));
5454
setDt(static_cast<double>(1));
5555
setTimeUnitSI(1);
56-
meshes.writable().ownKeyWithinParent = "meshes";
57-
particles.writable().ownKeyWithinParent = "particles";
56+
meshes.m_attri->ownKeyWithinParent = "meshes";
57+
particles.m_attri->ownKeyWithinParent = "particles";
5858
}
5959

6060
template <typename T>

src/ParticleSpecies.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace openPMD
3030
{
3131
ParticleSpecies::ParticleSpecies()
3232
{
33-
particlePatches.writable().ownKeyWithinParent = "particlePatches";
33+
particlePatches.m_attri->ownKeyWithinParent = "particlePatches";
3434
}
3535

3636
void ParticleSpecies::read()

src/Series.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ void Series::initSeries(
10801080
}
10811081

10821082
series.iterations.linkHierarchy(*this);
1083-
series.iterations.writable().ownKeyWithinParent = "data";
1083+
series.iterations.m_attri->ownKeyWithinParent = "data";
10841084
series.m_rankTable.m_attributable.linkHierarchy(*this);
10851085

10861086
series.m_name = input->name;
@@ -3664,18 +3664,19 @@ namespace debug
36643664
};
36653665
make_indent();
36663666
auto const &w = attr.writable();
3667-
std::cout << w.ownKeyWithinParent << '\t' << attr.m_attri.get()
3668-
<< " -> " << &attr.writable() << '\n';
3667+
std::cout << attr.m_attri->ownKeyWithinParent << '\t'
3668+
<< attr.m_attri.get() << " -> " << &attr.writable()
3669+
<< '\n';
36693670
make_indent();
36703671
std::cout << "Self:\t" << attr.m_attri->dirtySelf
36713672
<< "\tRec: " << attr.m_attri->dirtyRecursive << '\n';
36723673
std::cout << '\n';
36733674
graph << "{rank = same; ";
36743675
graph << "_" << attr.m_attri.get() << "[color=green, label = \"A "
3675-
<< attr.m_attri.get() << " '" << w.ownKeyWithinParent
3676-
<< "'\"]; ";
3676+
<< attr.m_attri.get() << " '"
3677+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
36773678
graph << "_" << &w << "[color=blue, label = \"W " << &w << " '"
3678-
<< w.ownKeyWithinParent << "'\"]; ";
3679+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
36793680
graph << "}\n";
36803681
graph << "_" << &w << " -> _" << attr.m_attri.get()
36813682
<< "[dir=none];\n";

src/backend/Attributable.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,19 @@ std::string Attributable::MyPath::openPMDPath() const
229229
auto Attributable::myPath() const -> MyPath
230230
{
231231
MyPath res;
232-
Writable const *findSeries = &writable();
233-
while (findSeries->parent)
232+
internal::AttributableData *findSeries = m_attri.get();
233+
while (findSeries->frontend_parent)
234234
{
235235
// we don't need to push_back the ownKeyWithinParent of the Series class
236236
// so it's alright that this loop doesn't ask the key of the last found
237237
// Writable
238238

239239
res.group.push_back(findSeries->ownKeyWithinParent);
240-
findSeries = findSeries->parent;
240+
findSeries = findSeries->frontend_parent;
241241
}
242242
std::reverse(res.group.begin(), res.group.end());
243-
auto &seriesData = auxiliary::deref_dynamic_cast<internal::SeriesData>(
244-
findSeries->attributable);
243+
auto &seriesData =
244+
auxiliary::deref_dynamic_cast<internal::SeriesData>(findSeries);
245245
Series series;
246246
series.setData(
247247
std::shared_ptr<internal::SeriesData>{

0 commit comments

Comments
 (0)