Skip to content

Commit aed1cf6

Browse files
committed
Fix this..
1 parent 1ef926f commit aed1cf6

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

include/openPMD/backend/Attributable.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ namespace internal
176176
* Attributable::setDirtyRecursive().
177177
*/
178178
bool dirtyRecursive = true;
179+
180+
/**
181+
* If frontend_parent is not null, then this is a key such that:
182+
* &(*frontend_parent)[key] == this
183+
*/
184+
std::string ownKeyWithinParent;
179185
};
180186

181187
template <typename, typename>

include/openPMD/backend/ContainerImpl.tpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ auto Container<T, T_key, T_container>::operator[](key_type const &key)
144144
auto &ret = container().insert({key, std::move(t)}).first->second;
145145
if constexpr (std::is_same_v<T_key, std::string>)
146146
{
147-
ret.writable().ownKeyWithinParent = key;
147+
ret.m_attri->ownKeyWithinParent = key;
148148
}
149149
else
150150
{
151-
ret.writable().ownKeyWithinParent = std::to_string(key);
151+
ret.m_attri->ownKeyWithinParent = std::to_string(key);
152152
}
153153
traits::GenerationPolicy<T> gen;
154154
gen(ret, this);
@@ -176,12 +176,11 @@ auto Container<T, T_key, T_container>::operator[](key_type &&key)
176176
auto &ret = container().insert({key, std::move(t)}).first->second;
177177
if constexpr (std::is_same_v<T_key, std::string>)
178178
{
179-
ret.writable().ownKeyWithinParent = std::move(key);
179+
ret.m_attri->ownKeyWithinParent = std::move(key);
180180
}
181181
else
182182
{
183-
ret.writable().ownKeyWithinParent =
184-
std::to_string(std::move(key));
183+
ret.m_attri->ownKeyWithinParent = std::to_string(std::move(key));
185184
}
186185
traits::GenerationPolicy<T> gen;
187186
gen(ret, this);

include/openPMD/backend/Writable.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ OPENPMD_private
166166
internal::AttributableData *attributable = nullptr;
167167
Writable *parent = nullptr;
168168

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

src/Iteration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Iteration::Iteration() : Attributable(NoInit())
5454
setTime(static_cast<double>(0));
5555
setDt(static_cast<double>(1));
5656
setTimeUnitSI(1);
57-
meshes.writable().ownKeyWithinParent = "meshes";
58-
particles.writable().ownKeyWithinParent = "particles";
57+
meshes.m_attri->ownKeyWithinParent = "meshes";
58+
particles.m_attri->ownKeyWithinParent = "particles";
5959
}
6060

6161
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
@@ -1084,7 +1084,7 @@ void Series::initSeries(
10841084
}
10851085

10861086
series.iterations.linkHierarchy(*this);
1087-
series.iterations.writable().ownKeyWithinParent = "data";
1087+
series.iterations.m_attri->ownKeyWithinParent = "data";
10881088
series.m_rankTable.m_attributable.linkHierarchy(*this);
10891089

10901090
series.m_name = input->name;
@@ -3687,18 +3687,19 @@ namespace debug
36873687
};
36883688
make_indent();
36893689
auto const &w = attr.writable();
3690-
std::cout << w.ownKeyWithinParent << '\t' << attr.m_attri.get()
3691-
<< " -> " << &attr.writable() << '\n';
3690+
std::cout << attr.m_attri->ownKeyWithinParent << '\t'
3691+
<< attr.m_attri.get() << " -> " << &attr.writable()
3692+
<< '\n';
36923693
make_indent();
36933694
std::cout << "Self:\t" << attr.m_attri->dirtySelf
36943695
<< "\tRec: " << attr.m_attri->dirtyRecursive << '\n';
36953696
std::cout << '\n';
36963697
graph << "{rank = same; ";
36973698
graph << "_" << attr.m_attri.get() << "[color=green, label = \"A "
3698-
<< attr.m_attri.get() << " '" << w.ownKeyWithinParent
3699-
<< "'\"]; ";
3699+
<< attr.m_attri.get() << " '"
3700+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
37003701
graph << "_" << &w << "[color=blue, label = \"W " << &w << " '"
3701-
<< w.ownKeyWithinParent << "'\"]; ";
3702+
<< attr.m_attri->ownKeyWithinParent << "'\"]; ";
37023703
graph << "}\n";
37033704
graph << "_" << &w << " -> _" << attr.m_attri.get()
37043705
<< "[dir=none];\n";

src/backend/Attributable.cpp

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

246246
res.group.push_back(findSeries->ownKeyWithinParent);
247-
findSeries = findSeries->parent;
247+
findSeries = findSeries->frontend_parent;
248248
}
249249
std::reverse(res.group.begin(), res.group.end());
250-
auto &seriesData = auxiliary::deref_dynamic_cast<internal::SeriesData>(
251-
findSeries->attributable);
250+
auto &seriesData =
251+
auxiliary::deref_dynamic_cast<internal::SeriesData>(findSeries);
252252
Series series;
253253
series.setData(
254254
std::shared_ptr<internal::SeriesData>{

0 commit comments

Comments
 (0)