Skip to content

Commit 29ff90a

Browse files
committed
openPMD MR: Cleanup
1 parent de0f827 commit 29ff90a

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

Source/Diagnostics/WarpXOpenPMD.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,12 @@ 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 is_ADIOS1 = false;
303+
if (m_Series != nullptr)
304+
is_ADIOS1 = (m_Series->backend() == "ADIOS1" || m_Series->backend() == "MPI_ADIOS1");
305+
if (m_OneFilePerTS && is_ADIOS1)
313306
m_Series = nullptr;
314307
else if (m_Series != nullptr)
315308
return;
@@ -318,16 +311,15 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
318311
#if defined(AMREX_USE_MPI)
319312
m_Series = std::make_unique<openPMD::Series>(
320313
filepath, access,
321-
amrex::ParallelDescriptor::Communicator(),
322-
useSteps
314+
amrex::ParallelDescriptor::Communicator()
323315
);
324316
m_MPISize = amrex::ParallelDescriptor::NProcs();
325317
m_MPIRank = amrex::ParallelDescriptor::MyProc();
326318
#else
327319
amrex::Abort("openPMD-api not built with MPI support!");
328320
#endif
329321
} else {
330-
m_Series = std::make_unique<openPMD::Series>(filepath, access, useSteps);
322+
m_Series = std::make_unique<openPMD::Series>(filepath, access);
331323
m_MPISize = 1;
332324
m_MPIRank = 1;
333325
}
@@ -886,7 +878,6 @@ WarpXOpenPMDPlot::SetupMeshComp( openPMD::Mesh& mesh,
886878
mesh.setGridSpacing(grid_spacing);
887879
mesh.setGridGlobalOffset(global_offset);
888880
mesh.setAttribute("fieldSmoothing", "none");
889-
//detail::setOpenPMDUnit(mesh, field_name);
890881
mesh_comp.resetDataset(dataset);
891882

892883
}
@@ -928,7 +919,7 @@ WarpXOpenPMDPlot::GetMeshCompNames( int meshLevel,
928919
if ( 0 == meshLevel )
929920
return;
930921

931-
field_name += "_lvl"+std::to_string(meshLevel);
922+
field_name += std::string("_lvl").append(std::to_string(meshLevel));
932923
}
933924
/*
934925
* Write Field with all mesh levels
@@ -1015,7 +1006,7 @@ WarpXOpenPMDPlot::WriteOpenPMDFieldsAll ( //const std::string& filename,
10151006
} // icomp loop
10161007
// Flush data to disk after looping over all components
10171008
m_Series->flush();
1018-
} // levels lopp (i)
1009+
} // levels loop (i)
10191010
}
10201011
#endif // WARPX_USE_OPENPMD
10211012

0 commit comments

Comments
 (0)