Skip to content

Commit c77a51e

Browse files
committed
Fix this..
1 parent 492d9af commit c77a51e

File tree

7 files changed

+25
-23
lines changed

7 files changed

+25
-23
lines changed

include/openPMD/backend/Attributable.hpp

Lines changed: 6 additions & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ OPENPMD_private
163163
internal::AttributableData *attributable = nullptr;
164164
Writable *parent = nullptr;
165165

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

src/Iteration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Iteration::Iteration() : Attributable(NoInit())
5151
setTime(static_cast<double>(0));
5252
setDt(static_cast<double>(1));
5353
setTimeUnitSI(1);
54-
meshes.writable().ownKeyWithinParent = "meshes";
55-
particles.writable().ownKeyWithinParent = "particles";
54+
meshes.m_attri->ownKeyWithinParent = "meshes";
55+
particles.m_attri->ownKeyWithinParent = "particles";
5656
}
5757

5858
template <typename T>

src/ParticleSpecies.cpp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ void Series::initSeries(
11111111
}
11121112

11131113
series.iterations.linkHierarchy(*this);
1114-
series.iterations.writable().ownKeyWithinParent = "iterations";
1114+
series.iterations.m_attri->ownKeyWithinParent = "iterations";
11151115
series.m_rankTable.m_attributable.linkHierarchy(*this);
11161116

11171117
series.m_name = input->name;
@@ -3449,18 +3449,19 @@ namespace debug
34493449
};
34503450
make_indent();
34513451
auto const &w = attr.writable();
3452-
std::cout << w.ownKeyWithinParent << '\t' << attr.m_attri.get()
3453-
<< " -> " << &attr.writable() << '\n';
3452+
std::cout << attr.m_attri->ownKeyWithinParent << '\t'
3453+
<< attr.m_attri.get() << " -> " << &attr.writable()
3454+
<< '\n';
34543455
make_indent();
34553456
std::cout << "Self:\t" << attr.m_attri->dirtySelf
34563457
<< "\tRec: " << attr.m_attri->dirtyRecursive << '\n';
34573458
std::cout << '\n';
34583459
graph << "{rank = same; ";
34593460
graph << "_" << attr.m_attri.get() << "[color=green, label = \"A "
3460-
<< attr.m_attri.get() << " '" << w.ownKeyWithinParent
3461-
<< "'\"]; ";
3461+
<< attr.m_attri.get() << " '"
3462+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
34623463
graph << "_" << &w << "[color=blue, label = \"W " << &w << " '"
3463-
<< w.ownKeyWithinParent << "'\"]; ";
3464+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
34643465
graph << "}\n";
34653466
graph << "_" << &w << " -> _" << attr.m_attri.get()
34663467
<< "[dir=none];\n";

src/backend/Attributable.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,19 @@ std::string Attributable::MyPath::openPMDPath() const
232232
auto Attributable::myPath() const -> MyPath
233233
{
234234
MyPath res;
235-
Writable const *findSeries = &writable();
236-
while (findSeries->parent)
235+
internal::AttributableData *findSeries = m_attri.get();
236+
while (findSeries->frontend_parent)
237237
{
238238
// we don't need to push_back the ownKeyWithinParent of the Series class
239239
// so it's alright that this loop doesn't ask the key of the last found
240240
// Writable
241241

242242
res.group.push_back(findSeries->ownKeyWithinParent);
243-
findSeries = findSeries->parent;
243+
findSeries = findSeries->frontend_parent;
244244
}
245245
std::reverse(res.group.begin(), res.group.end());
246-
auto &seriesData = auxiliary::deref_dynamic_cast<internal::SeriesData>(
247-
findSeries->attributable);
246+
auto &seriesData =
247+
auxiliary::deref_dynamic_cast<internal::SeriesData>(findSeries);
248248
Series series;
249249
series.setData(std::shared_ptr<internal::SeriesData>{
250250
&seriesData, [](auto const *) {}});

0 commit comments

Comments
 (0)