Skip to content

Commit b76d4b6

Browse files
committed
openPMD MR: Cleanup
1 parent de0f827 commit b76d4b6

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

Source/Diagnostics/WarpXOpenPMD.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,10 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
297297
std::string filepath = m_dirPrefix;
298298
GetFileName(filepath);
299299

300-
std::string useSteps = R"(
301-
{
302-
"adios2": {
303-
"engine": {
304-
"type": "bp4",
305-
"usesteps": true
306-
}
307-
}
308-
}
309-
)";
310300
// close a previously open series before creating a new one
311301
// see ADIOS1 limitation: https://github.com/openPMD/openPMD-api/pull/686
312-
if (m_OneFilePerTS)
302+
bool const is_ADIOS1 = (m_Series->backend() == "ADIOS1" || m_Series->backend() == "MPI_ADIOS1");
303+
if (m_OneFilePerTS && is_ADIOS1)
313304
m_Series = nullptr;
314305
else if (m_Series != nullptr)
315306
return;
@@ -318,16 +309,15 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
318309
#if defined(AMREX_USE_MPI)
319310
m_Series = std::make_unique<openPMD::Series>(
320311
filepath, access,
321-
amrex::ParallelDescriptor::Communicator(),
322-
useSteps
312+
amrex::ParallelDescriptor::Communicator()
323313
);
324314
m_MPISize = amrex::ParallelDescriptor::NProcs();
325315
m_MPIRank = amrex::ParallelDescriptor::MyProc();
326316
#else
327317
amrex::Abort("openPMD-api not built with MPI support!");
328318
#endif
329319
} else {
330-
m_Series = std::make_unique<openPMD::Series>(filepath, access, useSteps);
320+
m_Series = std::make_unique<openPMD::Series>(filepath, access);
331321
m_MPISize = 1;
332322
m_MPIRank = 1;
333323
}
@@ -886,7 +876,6 @@ WarpXOpenPMDPlot::SetupMeshComp( openPMD::Mesh& mesh,
886876
mesh.setGridSpacing(grid_spacing);
887877
mesh.setGridGlobalOffset(global_offset);
888878
mesh.setAttribute("fieldSmoothing", "none");
889-
//detail::setOpenPMDUnit(mesh, field_name);
890879
mesh_comp.resetDataset(dataset);
891880

892881
}
@@ -928,7 +917,7 @@ WarpXOpenPMDPlot::GetMeshCompNames( int meshLevel,
928917
if ( 0 == meshLevel )
929918
return;
930919

931-
field_name += "_lvl"+std::to_string(meshLevel);
920+
field_name += std::string("_lvl").append(std::to_string(meshLevel));
932921
}
933922
/*
934923
* Write Field with all mesh levels
@@ -1015,7 +1004,7 @@ WarpXOpenPMDPlot::WriteOpenPMDFieldsAll ( //const std::string& filename,
10151004
} // icomp loop
10161005
// Flush data to disk after looping over all components
10171006
m_Series->flush();
1018-
} // levels lopp (i)
1007+
} // levels loop (i)
10191008
}
10201009
#endif // WARPX_USE_OPENPMD
10211010

0 commit comments

Comments
 (0)