aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Diagnostics/ReducedDiags/BeamRelevant.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldEnergy.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldMaximum.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldMomentum.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldProbe.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldReduction.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/LoadBalanceEfficiency.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleNumber.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ReducedDiags.H4
-rw-r--r--Source/Diagnostics/ReducedDiags/ReducedDiags.cpp12
-rw-r--r--Source/Diagnostics/ReducedDiags/RhoMaximum.cpp2
16 files changed, 23 insertions, 21 deletions
diff --git a/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp b/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp
index a99d476fa..ac5f3fd66 100644
--- a/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp
+++ b/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp
@@ -77,7 +77,7 @@ BeamRelevant::BeamRelevant (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
index 294e78d36..c9ce3523f 100644
--- a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
+++ b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
@@ -59,7 +59,7 @@ ChargeOnEB::ChargeOnEB (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
index 0d054af61..9db42f77c 100644
--- a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
@@ -46,7 +46,7 @@ FieldEnergy::FieldEnergy (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp b/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp
index 89cfc5a1b..eb93b5424 100644
--- a/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp
@@ -61,7 +61,7 @@ FieldMaximum::FieldMaximum (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
index 53a93e2a2..b9a90b67e 100644
--- a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
@@ -58,7 +58,7 @@ FieldMomentum::FieldMomentum (std::string rd_name)
if (amrex::ParallelDescriptor::IOProcessor())
{
- if (m_IsNotRestart)
+ if (m_write_header)
{
// Open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
index 3f37c4902..669b18d29 100644
--- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
@@ -157,7 +157,7 @@ FieldProbe::FieldProbe (std::string rd_name)
"Field probe interp_order should be less than or equal to algo.particle_shape");
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/FieldReduction.cpp b/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
index 9e8bea8ed..f4b521c10 100644
--- a/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
@@ -64,7 +64,7 @@ FieldReduction::FieldReduction (std::string rd_name)
if (amrex::ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/LoadBalanceEfficiency.cpp b/Source/Diagnostics/ReducedDiags/LoadBalanceEfficiency.cpp
index d2be65fcc..6dd066d53 100644
--- a/Source/Diagnostics/ReducedDiags/LoadBalanceEfficiency.cpp
+++ b/Source/Diagnostics/ReducedDiags/LoadBalanceEfficiency.cpp
@@ -34,7 +34,7 @@ LoadBalanceEfficiency::LoadBalanceEfficiency (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
index 19622765e..f6b23d3ec 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
@@ -54,7 +54,7 @@ ParticleEnergy::ParticleEnergy (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp
index 67e595659..6e0a2d45a 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp
@@ -122,7 +122,7 @@ ParticleExtrema::ParticleExtrema (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs;
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
index c8945b645..91f0b41f9 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
@@ -123,7 +123,7 @@ ParticleHistogram::ParticleHistogram (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp b/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
index e45577c36..0adfc1ba9 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
@@ -52,7 +52,7 @@ ParticleMomentum::ParticleMomentum (std::string rd_name)
if (ParallelDescriptor::IOProcessor())
{
- if (m_IsNotRestart)
+ if (m_write_header)
{
// Open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ParticleNumber.cpp b/Source/Diagnostics/ReducedDiags/ParticleNumber.cpp
index f37cec056..8c0377a3a 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleNumber.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleNumber.cpp
@@ -48,7 +48,7 @@ ParticleNumber::ParticleNumber (std::string rd_name)
if (amrex::ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};
diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.H b/Source/Diagnostics/ReducedDiags/ReducedDiags.H
index 43fb1b76b..b8102330d 100644
--- a/Source/Diagnostics/ReducedDiags/ReducedDiags.H
+++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.H
@@ -36,8 +36,8 @@ public:
/// output intervals
utils::parser::IntervalsParser m_intervals;
- /// check if it is a restart run
- int m_IsNotRestart = 1;
+ /// check if header should be written
+ bool m_write_header = false;
/// separator in the output file
std::string m_sep = " ";
diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
index 05cf2fad2..7a2cb6df2 100644
--- a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
+++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
@@ -40,19 +40,21 @@ ReducedDiags::ReducedDiags (std::string rd_name)
std::string restart_chkfile = "";
const ParmParse pp_amr("amr");
pp_amr.query("restart", restart_chkfile);
- m_IsNotRestart = restart_chkfile.empty();
+ bool IsNotRestart = restart_chkfile.empty();
if (ParallelDescriptor::IOProcessor())
{
// create folder
constexpr int permission_flag_rwxrxrx = 0755;
- if (!UtilCreateDirectory(m_path, permission_flag_rwxrxrx))
- { CreateDirectoryFailed(m_path); }
+ if (!amrex::UtilCreateDirectory(m_path, permission_flag_rwxrxrx))
+ { amrex::CreateDirectoryFailed(m_path); }
// replace / create output file
- if ( m_IsNotRestart ) // not a restart
+ std::string rd_full_file_name = m_path + m_rd_name + "." + m_extension;
+ m_write_header = IsNotRestart || !amrex::FileExists(rd_full_file_name); // not a restart or file doesn't exist
+ if (m_write_header)
{
- std::ofstream ofs{m_path+m_rd_name+"."+m_extension, std::ios::trunc};
+ std::ofstream ofs{rd_full_file_name, std::ios::trunc};
ofs.close();
}
}
diff --git a/Source/Diagnostics/ReducedDiags/RhoMaximum.cpp b/Source/Diagnostics/ReducedDiags/RhoMaximum.cpp
index e15d6e882..79698682b 100644
--- a/Source/Diagnostics/ReducedDiags/RhoMaximum.cpp
+++ b/Source/Diagnostics/ReducedDiags/RhoMaximum.cpp
@@ -90,7 +90,7 @@ RhoMaximum::RhoMaximum (std::string rd_name)
if (amrex::ParallelDescriptor::IOProcessor())
{
- if ( m_IsNotRestart )
+ if ( m_write_header )
{
// open file
std::ofstream ofs{m_path + m_rd_name + "." + m_extension, std::ofstream::out};