Skip to content

Commit b366633

Browse files
committed
Fully re-read an Iteration in stepping mode
1 parent 2d81e52 commit b366633

10 files changed

Lines changed: 13 additions & 54 deletions

File tree

include/openPMD/Iteration.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class Iteration : public LegacyAttributable
181181
* logic for an iteration.
182182
*
183183
*/
184-
void read();
184+
void read( std::string path, bool reread = false );
185185
void readFileBased( std::string filePath, std::string const & groupPath );
186186
void readGroupBased( std::string const & groupPath );
187187
void read_impl( std::string const & groupPath );
@@ -298,7 +298,7 @@ class Iteration : public LegacyAttributable
298298
*newAccess = Access::READ_WRITE;
299299
try
300300
{
301-
read();
301+
read( "", false );
302302
}
303303
catch( ... )
304304
{

include/openPMD/RecordComponent.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,6 @@ class RecordComponent : public BaseRecordComponent
242242
*/
243243
bool
244244
dirtyRecursive() const;
245-
246-
protected:
247-
/**
248-
* Make sure to parse a RecordComponent only once.
249-
*/
250-
std::shared_ptr< bool > hasBeenRead = std::make_shared< bool >( false );
251245
}; // RecordComponent
252246

253247

include/openPMD/backend/PatchRecordComponent.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class PatchRecordComponent : public BaseRecordComponent
7575
void read();
7676

7777
std::shared_ptr< std::queue< IOTask > > m_chunks;
78-
std::shared_ptr< bool > hasBeenRead = std::make_shared< bool >( false );
7978

8079
/**
8180
* @brief Check recursively whether this RecordComponent is dirty.

src/Iteration.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,13 @@ void Iteration::deferRead( DeferredRead dr )
321321
*m_deferredRead = auxiliary::makeOption< DeferredRead >( std::move( dr ) );
322322
}
323323

324-
void Iteration::read()
324+
void Iteration::read( std::string path, bool reread )
325325
{
326+
if( reread )
327+
{
328+
read_impl( path );
329+
return;
330+
}
326331
if( !m_deferredRead->has_value() )
327332
{
328333
return;

src/Mesh.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,6 @@ Mesh::read()
331331
for( auto const& component : *pList.paths )
332332
{
333333
MeshRecordComponent& rc = (*this)[component];
334-
if ( *rc.hasBeenRead )
335-
{
336-
dirty() = false;
337-
continue;
338-
}
339334
pOpen.path = component;
340335
IOHandler()->enqueue(IOTask(&rc, pOpen));
341336
*rc.m_isConstant = true;
@@ -350,11 +345,6 @@ Mesh::read()
350345
for( auto const& component : *dList.datasets )
351346
{
352347
MeshRecordComponent & rc = ( *this )[ component ];
353-
if( *rc.hasBeenRead )
354-
{
355-
dirty() = false;
356-
continue;
357-
}
358348
dOpen.name = component;
359349
IOHandler()->enqueue(IOTask(&rc, dOpen));
360350
IOHandler()->flush();

src/Record.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ Record::read()
9898
for( auto const& component : *pList.paths )
9999
{
100100
RecordComponent& rc = (*this)[component];
101-
if ( *rc.hasBeenRead )
102-
{
103-
dirty() = false;
104-
continue;
105-
}
106101
pOpen.path = component;
107102
IOHandler()->enqueue(IOTask(&rc, pOpen));
108103
*rc.m_isConstant = true;
@@ -117,10 +112,6 @@ Record::read()
117112
for( auto const& component : *dList.datasets )
118113
{
119114
RecordComponent & rc = ( *this )[ component ];
120-
if( *rc.hasBeenRead )
121-
{
122-
continue;
123-
}
124115
dOpen.name = component;
125116
IOHandler()->enqueue(IOTask(&rc, dOpen));
126117
IOHandler()->flush();

src/RecordComponent.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,7 @@ RecordComponent::flush(std::string const& name)
248248
void
249249
RecordComponent::read()
250250
{
251-
if ( *hasBeenRead )
252-
{
253-
dirty() = false;
254-
return;
255-
}
256251
readBase();
257-
*hasBeenRead = true;
258252
}
259253

260254
void

src/Series.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,21 +1019,21 @@ SeriesImpl::readGorVBased( bool do_init )
10191019

10201020
auto readSingleIteration =
10211021
[&series, &pOpen, this]
1022-
(uint64_t index, std::string path)
1022+
(uint64_t index, std::string path, bool guardClosed )
10231023
{
10241024
if( series.iterations.contains( index ) )
10251025
{
10261026
// maybe re-read
10271027
auto & i = series.iterations.at( index );
1028-
if( i.closedByWriter() )
1028+
if( guardClosed && i.closedByWriter() )
10291029
{
10301030
return;
10311031
}
10321032
if( *i.m_closed != Iteration::CloseStatus::NotYetAccessed )
10331033
{
10341034
pOpen.path = path;
10351035
IOHandler()->enqueue( IOTask( &i, pOpen ) );
1036-
i.read();
1036+
i.read( path, /* reread = */ true );
10371037
}
10381038
}
10391039
else
@@ -1063,7 +1063,7 @@ SeriesImpl::readGorVBased( bool do_init )
10631063
for( auto const & it : *pList.paths )
10641064
{
10651065
uint64_t index = std::stoull( it );
1066-
readSingleIteration( index, it );
1066+
readSingleIteration( index, it, true );
10671067
}
10681068
break;
10691069
case IterationEncoding::variableBased:
@@ -1075,7 +1075,7 @@ SeriesImpl::readGorVBased( bool do_init )
10751075
.getAttribute( "__step__" )
10761076
.get< uint64_t >();
10771077
}
1078-
readSingleIteration( index, "" );
1078+
readSingleIteration( index, "", false );
10791079
break;
10801080
}
10811081
}

src/backend/MeshRecordComponent.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ MeshRecordComponent::MeshRecordComponent()
3232
void
3333
MeshRecordComponent::read()
3434
{
35-
if ( *hasBeenRead )
36-
{
37-
dirty() = false;
38-
return;
39-
}
4035
using DT = Datatype;
4136
Parameter< Operation::READ_ATT > aRead;
4237

@@ -60,7 +55,6 @@ MeshRecordComponent::read()
6055
throw std::runtime_error( "Unexpected Attribute datatype for 'position'");
6156

6257
readBase();
63-
*hasBeenRead = true;
6458
}
6559

6660
template< typename T >

src/backend/PatchRecordComponent.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ PatchRecordComponent::flush(std::string const& name)
105105
void
106106
PatchRecordComponent::read()
107107
{
108-
if ( *hasBeenRead )
109-
{
110-
dirty() = false;
111-
return;
112-
}
113-
114108
Parameter< Operation::READ_ATT > aRead;
115109

116110
aRead.name = "unitSI";
@@ -122,8 +116,6 @@ PatchRecordComponent::read()
122116
throw std::runtime_error("Unexpected Attribute datatype for 'unitSI'");
123117

124118
readAttributes(); // this will set dirty() = false
125-
126-
*hasBeenRead = true;
127119
}
128120

129121
bool

0 commit comments

Comments
 (0)