aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Diagnostics/BTDiagnostics.cpp2
-rw-r--r--Source/Diagnostics/Diagnostics.H2
-rw-r--r--Source/Diagnostics/Diagnostics.cpp1
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormat.H2
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatAscent.H3
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp2
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H3
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp5
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H3
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp4
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H3
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp4
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatSensei.H3
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp2
-rw-r--r--Source/Diagnostics/FullDiagnostics.cpp2
-rw-r--r--Source/Diagnostics/WarpXOpenPMD.H6
-rw-r--r--Source/Diagnostics/WarpXOpenPMD.cpp9
17 files changed, 36 insertions, 20 deletions
diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp
index afbe5f487..3c89d5859 100644
--- a/Source/Diagnostics/BTDiagnostics.cpp
+++ b/Source/Diagnostics/BTDiagnostics.cpp
@@ -611,7 +611,7 @@ BTDiagnostics::Flush (int i_buffer)
double const labtime = m_t_lab[i_buffer];
m_flush_format->WriteToFile(
m_varnames, m_mf_output[i_buffer], m_geom_output[i_buffer], warpx.getistep(),
- labtime, m_output_species, nlev_output, file_name,
+ labtime, m_output_species, nlev_output, file_name, m_file_min_digits,
m_plot_raw_fields, m_plot_raw_fields_guards, m_plot_raw_rho, m_plot_raw_F,
isBTD, i_buffer, m_geom_snapshot[i_buffer][0], isLastBTDFlush);
diff --git a/Source/Diagnostics/Diagnostics.H b/Source/Diagnostics/Diagnostics.H
index a1925b9a9..a406a7255 100644
--- a/Source/Diagnostics/Diagnostics.H
+++ b/Source/Diagnostics/Diagnostics.H
@@ -112,6 +112,8 @@ protected:
std::string m_diag_name;
/** Prefix for output directories */
std::string m_file_prefix;
+ /** Minimum number of digits to iteration number in file name */
+ int m_file_min_digits = 5;
/** Index of diagnostics in MultiDiagnostics::alldiags */
int m_diag_index;
/** Names of each component requested by the user.
diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp
index f12d3b55d..c7f408a80 100644
--- a/Source/Diagnostics/Diagnostics.cpp
+++ b/Source/Diagnostics/Diagnostics.cpp
@@ -48,6 +48,7 @@ Diagnostics::BaseReadParameters ()
amrex::ParmParse pp_diag_name(m_diag_name);
m_file_prefix = "diags/" + m_diag_name;
pp_diag_name.query("file_prefix", m_file_prefix);
+ pp_diag_name.query("file_min_digits", m_file_min_digits);
pp_diag_name.query("format", m_format);
pp_diag_name.query("dump_last_timestep", m_dump_last_timestep);
diff --git a/Source/Diagnostics/FlushFormats/FlushFormat.H b/Source/Diagnostics/FlushFormats/FlushFormat.H
index 865a5805a..33afa45ee 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormat.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormat.H
@@ -16,7 +16,7 @@ public:
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
- const std::string prefix,
+ const std::string prefix, const int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatAscent.H b/Source/Diagnostics/FlushFormats/FlushFormatAscent.H
index 50a72d26c..1fdecbc94 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatAscent.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormatAscent.H
@@ -33,7 +33,8 @@ public:
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
- const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
+ const std::string prefix, int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp b/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp
index 02de2f127..6d7ac2743 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp
@@ -12,7 +12,7 @@ FlushFormatAscent::WriteToFile (
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
- const std::string prefix, bool plot_raw_fields,
+ const std::string prefix, int /*file_min_digits*/, bool plot_raw_fields,
bool plot_raw_fields_guards, bool /*plot_raw_rho*/, bool plot_raw_F,
bool /*isBTD*/, int /*snapshotID*/, const amrex::Geometry& /*full_BTD_snapshot*/, bool /*isLastBTDFlush*/) const
{
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H
index a08a54d72..92e6f8fc9 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H
@@ -20,7 +20,8 @@ class FlushFormatCheckpoint final : public FlushFormatPlotfile
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
- const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
+ const std::string prefix, int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
index 7477dfcd0..e66a18f08 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
@@ -27,7 +27,8 @@ FlushFormatCheckpoint::WriteToFile (
const amrex::Vector<amrex::MultiFab>& /*mf*/,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double /*time*/,
- const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
+ const std::string prefix, int file_min_digits,
bool /*plot_raw_fields*/,
bool /*plot_raw_fields_guards*/,
bool /*plot_raw_rho*/, bool /*plot_raw_F*/,
@@ -42,7 +43,7 @@ FlushFormatCheckpoint::WriteToFile (
VisMF::Header::Version current_version = VisMF::GetHeaderVersion();
VisMF::SetHeaderVersion(amrex::VisMF::Header::NoFabHeader_v1);
- const std::string& checkpointname = amrex::Concatenate(prefix,iteration[0]);
+ const std::string& checkpointname = amrex::Concatenate(prefix, iteration[0], file_min_digits);
amrex::Print() << " Writing checkpoint " << checkpointname << "\n";
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H
index db2e7fb4a..1b6054d9d 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H
@@ -32,7 +32,8 @@ public:
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
- const amrex::Vector<ParticleDiag>& particle_diags, int /*nlev*/, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int /*nlev*/,
+ const std::string prefix, int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
index 147c8c61b..48afec5ec 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
@@ -93,7 +93,7 @@ FlushFormatOpenPMD::WriteToFile (
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int /*nlev*/,
- const std::string prefix, bool plot_raw_fields,
+ const std::string prefix, int file_min_digits, bool plot_raw_fields,
bool plot_raw_fields_guards, bool plot_raw_rho, bool plot_raw_F,
bool isBTD, int snapshotID, const amrex::Geometry& full_BTD_snapshot,
bool isLastBTDFlush) const
@@ -112,7 +112,7 @@ FlushFormatOpenPMD::WriteToFile (
output_iteration = snapshotID;
// Set step and output directory name.
- m_OpenPMDPlotWriter->SetStep(output_iteration, prefix, isBTD);
+ m_OpenPMDPlotWriter->SetStep(output_iteration, prefix, file_min_digits, isBTD);
// fields: only dumped for coarse level
m_OpenPMDPlotWriter->WriteOpenPMDFieldsAll(
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H
index b2f648d5a..c6b50fb0a 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H
@@ -27,7 +27,8 @@ public:
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
- const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
+ const std::string prefix, int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
index cbe5e2b3b..be1c70582 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
@@ -57,14 +57,14 @@ FlushFormatPlotfile::WriteToFile (
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
- const std::string prefix, bool plot_raw_fields,
+ const std::string prefix, int file_min_digits, bool plot_raw_fields,
bool plot_raw_fields_guards, bool plot_raw_rho, bool plot_raw_F,
bool /*isBTD*/, int /*snapshotID*/, const amrex::Geometry& /*full_BTD_snapshot*/,
bool /*isLastBTDFlush*/) const
{
WARPX_PROFILE("FlushFormatPlotfile::WriteToFile()");
auto & warpx = WarpX::GetInstance();
- const std::string& filename = amrex::Concatenate(prefix, iteration[0]);
+ const std::string& filename = amrex::Concatenate(prefix, iteration[0], file_min_digits);
amrex::Print() << " Writing plotfile " << filename << "\n";
Vector<std::string> rfs;
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatSensei.H b/Source/Diagnostics/FlushFormats/FlushFormatSensei.H
index 163087fba..23a5a2614 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatSensei.H
+++ b/Source/Diagnostics/FlushFormats/FlushFormatSensei.H
@@ -50,7 +50,8 @@ public:
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
- const amrex::Vector<ParticleDiag>& particle_diags, int nlev, const std::string prefix,
+ const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
+ const std::string prefix, int file_min_digits,
bool plot_raw_fields,
bool plot_raw_fields_guards,
bool plot_raw_rho, bool plot_raw_F,
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp b/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp
index 74c9fd203..6852f08b6 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp
@@ -53,7 +53,7 @@ FlushFormatSensei::WriteToFile (
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
- const std::string prefix, bool plot_raw_fields,
+ const std::string prefix, int /*file_min_digits*/, bool plot_raw_fields,
bool plot_raw_fields_guards, bool plot_raw_rho, bool plot_raw_F,
bool /*isBTD*/, int /*snapshotID*/,
const amrex::Geometry& /*full_BTD_snapshot*/, bool /*isLastBTDFlush*/) const
diff --git a/Source/Diagnostics/FullDiagnostics.cpp b/Source/Diagnostics/FullDiagnostics.cpp
index 923a3ff1b..0c759725c 100644
--- a/Source/Diagnostics/FullDiagnostics.cpp
+++ b/Source/Diagnostics/FullDiagnostics.cpp
@@ -118,7 +118,7 @@ FullDiagnostics::Flush ( int i_buffer )
m_flush_format->WriteToFile(
m_varnames, m_mf_output[i_buffer], m_geom_output[i_buffer], warpx.getistep(),
- warpx.gett_new(0), m_output_species, nlev_output, m_file_prefix,
+ warpx.gett_new(0), m_output_species, nlev_output, m_file_prefix, m_file_min_digits,
m_plot_raw_fields, m_plot_raw_fields_guards, m_plot_raw_rho, m_plot_raw_F);
FlushRaw();
diff --git a/Source/Diagnostics/WarpXOpenPMD.H b/Source/Diagnostics/WarpXOpenPMD.H
index 8ff5dbb8b..4d5c410ad 100644
--- a/Source/Diagnostics/WarpXOpenPMD.H
+++ b/Source/Diagnostics/WarpXOpenPMD.H
@@ -118,7 +118,7 @@ public:
* @note If an iteration has been written, then it will give a warning
*
*/
- void SetStep (int ts, const std::string& dirPrefix,
+ void SetStep (int ts, const std::string& dirPrefix, int file_min_digits,
bool isBTD=false);
/** Close the step
@@ -263,6 +263,10 @@ private:
*/
std::string m_dirPrefix;
+ /** This is the minimum number of digits in the step number that is used as the
+ * suffix for file names when doing file based encoding */
+ int m_file_min_digits;
+
int m_MPIRank = 0;
int m_MPISize = 1;
diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp
index 6df03d6e0..952786a11 100644
--- a/Source/Diagnostics/WarpXOpenPMD.cpp
+++ b/Source/Diagnostics/WarpXOpenPMD.cpp
@@ -302,19 +302,22 @@ WarpXOpenPMDPlot::GetFileName (std::string& filepath)
//
// OpenPMD supports timestepped names
//
- if (m_Encoding == openPMD::IterationEncoding::fileBased)
- filename = filename.append("_%06T");
+ if (m_Encoding == openPMD::IterationEncoding::fileBased) {
+ std::string fileSuffix = std::string("_%0") + std::to_string(m_file_min_digits) + std::string("T");
+ filename = filename.append(fileSuffix);
+ }
filename.append(".").append(m_OpenPMDFileType);
filepath.append(filename);
return filename;
}
-void WarpXOpenPMDPlot::SetStep (int ts, const std::string& dirPrefix,
+void WarpXOpenPMDPlot::SetStep (int ts, const std::string& dirPrefix, int file_min_digits,
bool isBTD)
{
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ts >= 0 , "openPMD iterations are unsigned");
m_dirPrefix = dirPrefix;
+ m_file_min_digits = file_min_digits;
if( ! isBTD ) {
if (m_CurrentStep >= ts) {