Skip to content

Commit 283a600

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 74d90ce commit 283a600

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

examples/10_streaming_write.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,37 +62,37 @@ int main()
6262
})");
6363
6464
Datatype datatype = determineDatatype<position_t>();
65-
constexpr unsigned long length = 10ul;
66-
Extent global_extent = {length};
67-
Dataset dataset = Dataset(datatype, global_extent);
68-
std::shared_ptr<position_t> local_data(
69-
new position_t[length], [](position_t const *ptr) { delete[] ptr; });
65+
constexpr unsigned long length = 10ul;
66+
Extent global_extent = {length};
67+
Dataset dataset = Dataset(datatype, global_extent);
68+
std::shared_ptr<position_t> local_data(
69+
new position_t[length], [](position_t const *ptr) { delete[] ptr; });
7070
71-
auto iterations = series.snapshots();
72-
for (size_t i = 0; i < 100; ++i)
73-
{
74-
Iteration iteration = iterations[i];
75-
Record electronPositions = iteration.particles["e"]["position"];
71+
auto iterations = series.snapshots();
72+
for (size_t i = 0; i < 100; ++i)
73+
{
74+
Iteration iteration = iterations[i];
75+
Record electronPositions = iteration.particles["e"]["position"];
7676
77-
std::iota(local_data.get(), local_data.get() + length, i * length);
78-
for (auto const &dim : {"x", "y", "z"})
79-
{
80-
RecordComponent pos = electronPositions[dim];
81-
pos.resetDataset(dataset);
82-
pos.storeChunk(local_data, Offset{0}, global_extent);
83-
}
84-
iteration.close();
77+
std::iota(local_data.get(), local_data.get() + length, i * length);
78+
for (auto const &dim : {"x", "y", "z"})
79+
{
80+
RecordComponent pos = electronPositions[dim];
81+
pos.resetDataset(dataset);
82+
pos.storeChunk(local_data, Offset{0}, global_extent);
8583
}
84+
iteration.close();
85+
}
8686
87-
/* The files in 'series' are still open until the object is destroyed, on
88-
* which it cleanly flushes and closes all open file handles.
89-
* When running out of scope on return, the 'Series' destructor is called.
90-
* Alternatively, one can call `series.close()` to the same effect as
91-
* calling the destructor, including the release of file handles.
92-
*/
93-
series.close();
87+
/* The files in 'series' are still open until the object is destroyed, on
88+
* which it cleanly flushes and closes all open file handles.
89+
* When running out of scope on return, the 'Series' destructor is called.
90+
* Alternatively, one can call `series.close()` to the same effect as
91+
* calling the destructor, including the release of file handles.
92+
*/
93+
series.close();
9494
95-
return 0;
95+
return 0;
9696
#else
9797
std::cout << "The streaming example requires that openPMD has been built "
9898
"with ADIOS2."

0 commit comments

Comments
 (0)