Skip to content

Commit

Permalink
openPMD MR: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed May 19, 2021
1 parent 03040ae commit a3ab59e
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions Source/Diagnostics/WarpXOpenPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,10 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
std::string filepath = m_dirPrefix;
GetFileName(filepath);

std::string useSteps = R"(
{
"adios2": {
"engine": {
"type": "bp4",
"usesteps": true
}
}
}
)";
// close a previously open series before creating a new one
// see ADIOS1 limitation: https://github.com/openPMD/openPMD-api/pull/686
if (m_OneFilePerTS)
bool const is_ADIOS1 = (m_Series->backend() == "ADIOS1" || m_Series->backend() == "MPI_ADIOS1");
if (m_OneFilePerTS && is_ADIOS1)
m_Series = nullptr;
else if (m_Series != nullptr)
return;
Expand All @@ -318,16 +309,15 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
#if defined(AMREX_USE_MPI)
m_Series = std::make_unique<openPMD::Series>(
filepath, access,
amrex::ParallelDescriptor::Communicator(),
useSteps
amrex::ParallelDescriptor::Communicator()
);
m_MPISize = amrex::ParallelDescriptor::NProcs();
m_MPIRank = amrex::ParallelDescriptor::MyProc();
#else
amrex::Abort("openPMD-api not built with MPI support!");
#endif
} else {
m_Series = std::make_unique<openPMD::Series>(filepath, access, useSteps);
m_Series = std::make_unique<openPMD::Series>(filepath, access);
m_MPISize = 1;
m_MPIRank = 1;
}
Expand Down Expand Up @@ -886,7 +876,6 @@ WarpXOpenPMDPlot::SetupMeshComp( openPMD::Mesh& mesh,
mesh.setGridSpacing(grid_spacing);
mesh.setGridGlobalOffset(global_offset);
mesh.setAttribute("fieldSmoothing", "none");
//detail::setOpenPMDUnit(mesh, field_name);
mesh_comp.resetDataset(dataset);

}
Expand Down Expand Up @@ -928,7 +917,7 @@ WarpXOpenPMDPlot::GetMeshCompNames( int meshLevel,
if ( 0 == meshLevel )
return;

field_name += "_lvl"+std::to_string(meshLevel);
field_name += std::string("_lvl").append(std::to_string(meshLevel));
}
/*
* Write Field with all mesh levels
Expand Down Expand Up @@ -1015,7 +1004,7 @@ WarpXOpenPMDPlot::WriteOpenPMDFieldsAll ( //const std::string& filename,
} // icomp loop
// Flush data to disk after looping over all components
m_Series->flush();
} // levels lopp (i)
} // levels loop (i)
}
#endif // WARPX_USE_OPENPMD

Expand Down

0 comments on commit a3ab59e

Please sign in to comment.