Skip to content

Commit

Permalink
clean and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Oct 11, 2021
1 parent 4ecfebc commit a9e4ef4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ void BTDiagnostics::DerivedInitData ()
m_buffer_box.resize(m_num_buffers);
// allocate vector of m_current_z_lab
m_current_z_lab.resize(m_num_buffers);
// allocate vector of m_num_buffers
// allocate vector of current_z_boost
m_current_z_boost.resize(m_num_buffers);
// allocate vector of old_z_boost positions
m_old_z_boost.resize(m_num_buffers);
// allocate vector of m_buff_counter to counter number of slices filled in the buffer
m_buffer_counter.resize(m_num_buffers);
Expand Down Expand Up @@ -200,7 +201,8 @@ bool
BTDiagnostics::DoComputeAndPack (int step, bool force_flush)
{
// always set to true for BTDiagnostics since back-transform buffers are potentially
// computed and packed every timstep, except at initialization when step == -1.
// computed and packed every timstep, except at initialization when step == -1, or when
// force_flush is set to true.
if (step < 0 ) {
return false;
} else {
Expand Down Expand Up @@ -741,6 +743,7 @@ void BTDiagnostics::MergeBuffersForPlotfile (int i_snapshot)
snapshot_FabFilename.c_str());
}
for (int i = 0; i < m_particles_buffer[i_snapshot].size(); ++i) {
// species filename of recently flushed buffer
std::string recent_species_prefix = recent_Buffer_filepath+"/"+m_output_species_names[i];
std::string recent_species_Header = recent_species_prefix + "/Header";
std::string recent_ParticleHdrFilename = recent_species_prefix + "/Level_0/Particle_H";
Expand All @@ -758,12 +761,13 @@ void BTDiagnostics::MergeBuffersForPlotfile (int i_snapshot)


if (m_buffer_flush_counter[i_snapshot] == 0) {
// copy WarpXHeader and warpx_job_file for the first flush
BufferSpeciesHeader.set_DataIndex(0,0,m_buffer_flush_counter[i_snapshot]);
BufferSpeciesHeader.WriteHeader();

// copy Header file for the species
std::rename(recent_species_Header.c_str(), snapshot_species_Header.c_str());
if (BufferSpeciesHeader.m_total_particles == 0) continue;
// if finite number of particles in the output, copy ParticleHdr and Data file
std::rename(recent_ParticleHdrFilename.c_str(), snapshot_ParticleHdrFilename.c_str());
std::rename(recent_ParticleDataFilename.c_str(), snapshot_ParticleDataFilename.c_str());
} else {
Expand Down
1 change: 0 additions & 1 deletion Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ WarpX::Evolve (int numsteps)

// End loop on time steps
}
amrex::Print() << " last timestep flush \n";
multi_diags->FilterComputePackFlushLastTimestep( istep[0] );

if (do_back_transformed_diagnostics) {
Expand Down

0 comments on commit a9e4ef4

Please sign in to comment.