aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/BoostedFrameDiagnostic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Diagnostics/BoostedFrameDiagnostic.cpp')
-rw-r--r--Source/Diagnostics/BoostedFrameDiagnostic.cpp204
1 files changed, 102 insertions, 102 deletions
diff --git a/Source/Diagnostics/BoostedFrameDiagnostic.cpp b/Source/Diagnostics/BoostedFrameDiagnostic.cpp
index ad4f50806..f1d437509 100644
--- a/Source/Diagnostics/BoostedFrameDiagnostic.cpp
+++ b/Source/Diagnostics/BoostedFrameDiagnostic.cpp
@@ -17,7 +17,7 @@ using namespace amrex;
namespace
{
const std::vector<std::string> particle_field_names = {"w", "x", "y", "z", "ux", "uy", "uz"};
-
+
/*
Creates the HDF5 file in truncate mode and closes it.
Should be run only by the root process.
@@ -32,7 +32,7 @@ namespace
}
/*
- Writes a single string attribute to the given group.
+ Writes a single string attribute to the given group.
Should only be called by the root process.
*/
void write_string_attribute(hid_t& group, const std::string& key, const std::string& val)
@@ -52,7 +52,7 @@ namespace
}
/*
- Writes a single double attribute to the given group.
+ Writes a single double attribute to the given group.
Should only be called by the root process.
*/
void write_double_attribute(hid_t& group, const std::string& key, const double val)
@@ -109,7 +109,7 @@ namespace
*/
void output_create_field(const std::string& file_path, const std::string& field_path,
const unsigned nx, const unsigned ny, const unsigned nz)
- {
+ {
BL_PROFILE("output_create_field");
// Open the output.
@@ -121,7 +121,7 @@ namespace
hsize_t dims[3] = {nx, nz};
#endif
hid_t grid_space = H5Screate_simple(AMREX_SPACEDIM, dims, NULL);
-
+
// Create the dataset.
hid_t dataset = H5Dcreate(file, field_path.c_str(), H5T_IEEE_F64LE,
grid_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -141,7 +141,7 @@ namespace
/*
Creates a group associated with a single particle species.
Should be run by all processes collectively.
- */
+ */
void output_create_species_group(const std::string& file_path, const std::string& species_name)
{
MPI_Comm comm = MPI_COMM_WORLD;
@@ -152,10 +152,10 @@ namespace
// Create the file access prop list.
hid_t pa_plist = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(pa_plist, comm, info);
-
+
// Open the output.
hid_t file = H5Fopen(file_path.c_str(), H5F_ACC_RDWR, pa_plist);
-
+
hid_t group = H5Gcreate(file, species_name.c_str(),
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group);
@@ -169,7 +169,7 @@ namespace
*/
long output_resize_particle_field(const std::string& file_path, const std::string& field_path,
const long num_to_add)
- {
+ {
BL_PROFILE("output_resize_particle_field");
// Open the output.
@@ -187,7 +187,7 @@ namespace
hsize_t new_size[1];
new_size[0] = dims[0] + num_to_add;
status = H5Dset_extent (dataset, new_size);
-
+
if (status < 0)
{
amrex::Abort("Error: set extent filed on dataset "
@@ -208,7 +208,7 @@ namespace
*/
void output_write_particle_field(const std::string& file_path, const std::string& field_path,
const Real* data_ptr, const long count, const long index)
- {
+ {
BL_PROFILE("output_write_particle_field");
MPI_Comm comm = MPI_COMM_WORLD;
@@ -219,15 +219,15 @@ namespace
// Create the file access prop list.
hid_t pa_plist = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(pa_plist, comm, info);
-
+
// Open the output.
hid_t file = H5Fopen(file_path.c_str(), H5F_ACC_RDWR, pa_plist);
-
+
int RANK = 1;
hsize_t offset[1];
hsize_t dims[1];
herr_t status;
-
+
hid_t dataset = H5Dopen (file, field_path.c_str(), H5P_DEFAULT);
// Make sure the dataset is there.
@@ -236,9 +236,9 @@ namespace
amrex::Abort("Error on rank " + std::to_string(mpi_rank) +
". Count not find dataset " + field_path + "\n");
}
-
+
hid_t filespace = H5Dget_space (dataset);
-
+
offset[0] = index;
dims[0] = count;
@@ -247,23 +247,23 @@ namespace
H5Pset_dxpl_mpio(collective_plist, H5FD_MPIO_INDEPENDENT);
if (count > 0) {
-
+
/* Define memory space */
hid_t memspace = H5Screate_simple (RANK, dims, NULL);
-
+
status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL,
dims, NULL);
-
+
if (status < 0)
{
amrex::Abort("Error on rank " + std::to_string(ParallelDescriptor::MyProc()) +
" could not select hyperslab.\n");
}
-
+
/* Write the data to the extended portion of dataset */
status = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, memspace,
filespace, collective_plist, data_ptr);
-
+
if (status < 0)
{
amrex::Abort("Error on rank " + std::to_string(ParallelDescriptor::MyProc()) +
@@ -272,9 +272,9 @@ namespace
status = H5Sclose (memspace);
}
-
+
ParallelDescriptor::Barrier();
-
+
// Close resources.
H5Pclose(collective_plist);
H5Sclose(filespace);
@@ -282,13 +282,13 @@ namespace
H5Fclose(file);
H5Pclose(pa_plist);
}
-
+
/*
Creates an extendible dataset, suitable for storing particle data.
Should be run on all ranks collectively.
*/
void output_create_particle_field(const std::string& file_path, const std::string& field_path)
- {
+ {
BL_PROFILE("output_create_particle_field");
MPI_Comm comm = MPI_COMM_WORLD;
@@ -299,7 +299,7 @@ namespace
// Create the file access prop list.
hid_t pa_plist = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(pa_plist, comm, info);
-
+
// Open the output.
hid_t file = H5Fopen(file_path.c_str(), H5F_ACC_RDWR, pa_plist);
@@ -307,7 +307,7 @@ namespace
hsize_t dims[1] = {0};
hsize_t maxdims[1] = {H5S_UNLIMITED};
hsize_t chunk_dims[2] = {4};
-
+
hid_t dataspace = H5Screate_simple (RANK, dims, maxdims);
// Enable chunking
@@ -316,7 +316,7 @@ namespace
hid_t dataset = H5Dcreate2 (file, field_path.c_str(), H5T_NATIVE_DOUBLE, dataspace,
H5P_DEFAULT, prop, H5P_DEFAULT);
-
+
if (dataset < 0)
{
amrex::Abort("Error: could not create dataset. H5 returned "
@@ -329,7 +329,7 @@ namespace
H5Sclose(dataspace);
H5Fclose(file);
}
-
+
/*
Write the only component in the multifab to the dataset given by field_name.
Uses hdf5-parallel.
@@ -361,7 +361,7 @@ namespace
amrex::Abort("Error on rank " + std::to_string(mpi_rank) +
". Count not find dataset " + field_path + "\n");
}
-
+
// Grab the dataspace of the field dataset from file.
hid_t file_dataspace = H5Dget_space(dataset);
@@ -388,9 +388,9 @@ namespace
const Box& box = mfi.validbox();
const int *lo_vec = box.loVect();
const int *hi_vec = box.hiVect();
-
+
transposed_data.resize(box.numPts(), 0.0);
-
+
// Set slab offset and shape.
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim)
{
@@ -399,7 +399,7 @@ namespace
slab_offsets[idim] = lo_vec[idim];
slab_dims[idim] = hi_vec[idim] - lo_vec[idim] + 1;
}
-
+
int cnt = 0;
AMREX_D_TERM(
for (int i = lo_vec[0]; i <= hi_vec[0]; ++i),
@@ -433,7 +433,7 @@ namespace
}
ParallelDescriptor::Barrier();
-
+
// Close HDF5 resources.
H5Pclose(collective_plist);
H5Sclose(file_dataspace);
@@ -447,7 +447,7 @@ namespace
namespace
{
void
- CopySlice(MultiFab& tmp, MultiFab& buf, int k_lab,
+ CopySlice(MultiFab& tmp, MultiFab& buf, int k_lab,
const Gpu::ManagedDeviceVector<int>& map_actual_fields_to_dump)
{
const int ncomp_to_dump = map_actual_fields_to_dump.size();
@@ -458,11 +458,11 @@ namespace
for (MFIter mfi(tmp, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
Array4< Real> tmp_arr = tmp[mfi].array();
Array4< Real> buf_arr = buf[mfi].array();
- // For 3D runs, tmp is a 2D (x,y) multifab, that contains only
+ // For 3D runs, tmp is a 2D (x,y) multifab, that contains only
// slice to write to file.
const Box& bx = mfi.tilebox();
- const auto field_map_ptr = map_actual_fields_to_dump.dataPtr();
+ const auto field_map_ptr = map_actual_fields_to_dump.dataPtr();
ParallelFor(bx, ncomp_to_dump,
[=] AMREX_GPU_DEVICE (int i, int j, int k, int n)
{
@@ -488,13 +488,13 @@ LorentzTransformZ(MultiFab& data, Real gamma_boost, Real beta_boost, int ncomp)
for (MFIter mfi(data, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
const Box& tile_box = mfi.tilebox();
Array4< Real > arr = data[mfi].array();
- // arr(x,y,z,comp) where 0->9 comps are
+ // arr(x,y,z,comp) where 0->9 comps are
// Ex Ey Ez Bx By Bz jx jy jz rho
Real clight = PhysConst::c;
ParallelFor(tile_box,
[=] AMREX_GPU_DEVICE (int i, int j, int k)
{
- // Transform the transverse E and B fields. Note that ez and bz are not
+ // Transform the transverse E and B fields. Note that ez and bz are not
// changed by the tranform.
Real e_lab, b_lab, j_lab, r_lab;
e_lab = gamma_boost * (arr(i, j, k, 0) + beta_boost*clight*arr(i, j, k, 4));
@@ -523,8 +523,8 @@ LorentzTransformZ(MultiFab& data, Real gamma_boost, Real beta_boost, int ncomp)
BoostedFrameDiagnostic::
BoostedFrameDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
- Real dt_snapshots_lab, int N_snapshots,
- Real gamma_boost, Real t_boost, Real dt_boost,
+ Real dt_snapshots_lab, int N_snapshots,
+ Real gamma_boost, Real t_boost, Real dt_boost,
int boost_direction, const Geometry& geom)
: gamma_boost_(gamma_boost),
dt_snapshots_lab_(dt_snapshots_lab),
@@ -537,11 +537,11 @@ BoostedFrameDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
AMREX_ALWAYS_ASSERT(WarpX::do_boosted_frame_fields or
WarpX::do_boosted_frame_particles);
-
+
inv_gamma_boost_ = 1.0 / gamma_boost_;
beta_boost_ = std::sqrt(1.0 - inv_gamma_boost_*inv_gamma_boost_);
inv_beta_boost_ = 1.0 / beta_boost_;
-
+
dz_lab_ = PhysConst::c * dt_boost_ * inv_beta_boost_ * inv_gamma_boost_;
inv_dz_lab_ = 1.0 / dz_lab_;
int Nz_lab = static_cast<unsigned>((zmax_lab - zmin_lab) * inv_dz_lab_);
@@ -563,9 +563,9 @@ BoostedFrameDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
std::vector<std::string> user_fields_to_dump;
ParmParse pp("warpx");
bool do_user_fields;
- do_user_fields = pp.queryarr("boosted_frame_diag_fields",
+ do_user_fields = pp.queryarr("boosted_frame_diag_fields",
user_fields_to_dump);
- // If user specifies fields to dump, overwrite ncomp_to_dump,
+ // If user specifies fields to dump, overwrite ncomp_to_dump,
// map_actual_fields_to_dump and mesh_field_names.
for (int i = 0; i < 10; ++i) map_actual_fields_to_dump.push_back(i);
if (do_user_fields){
@@ -588,7 +588,7 @@ BoostedFrameDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
prob_domain_lab.setLo(AMREX_SPACEDIM-1, zmin_lab + v_window_lab * t_lab);
prob_domain_lab.setHi(AMREX_SPACEDIM-1, zmax_lab + v_window_lab * t_lab);
// Construct LabSnapShot
- LabSnapShot snapshot(t_lab, t_boost, prob_domain_lab,
+ LabSnapShot snapshot(t_lab, t_boost, prob_domain_lab,
prob_ncells_lab, ncomp_to_dump,
mesh_field_names, i, *this);
snapshots_.push_back(snapshot);
@@ -602,54 +602,54 @@ BoostedFrameDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
void BoostedFrameDiagnostic::Flush(const Geometry& geom)
{
BL_PROFILE("BoostedFrameDiagnostic::Flush");
-
+
VisMF::Header::Version current_version = VisMF::GetHeaderVersion();
VisMF::SetHeaderVersion(amrex::VisMF::Header::NoFabHeader_v1);
auto & mypc = WarpX::GetInstance().GetPartContainer();
const std::vector<std::string> species_names = mypc.GetSpeciesNames();
-
+
// Loop over BFD snapshots
for (int i = 0; i < N_snapshots_; ++i) {
Real zmin_lab = snapshots_[i].prob_domain_lab_.lo(AMREX_SPACEDIM-1);
int i_lab = (snapshots_[i].current_z_lab - zmin_lab) / dz_lab_;
-
+
if (buff_counter_[i] != 0) {
if (WarpX::do_boosted_frame_fields) {
const BoxArray& ba = data_buffer_[i]->boxArray();
const int hi = ba[0].bigEnd(boost_direction_);
const int lo = hi - buff_counter_[i] + 1;
-
+
Box buff_box = geom.Domain();
buff_box.setSmall(boost_direction_, lo);
buff_box.setBig(boost_direction_, hi);
-
+
BoxArray buff_ba(buff_box);
buff_ba.maxSize(max_box_size_);
DistributionMapping buff_dm(buff_ba);
-
+
const int ncomp = data_buffer_[i]->nComp();
-
+
MultiFab tmp(buff_ba, buff_dm, ncomp, 0);
-
+
tmp.copy(*data_buffer_[i], 0, 0, ncomp);
#ifdef WARPX_USE_HDF5
for (int comp = 0; comp < ncomp; ++comp)
output_write_field(snapshots_[i].file_name, mesh_field_names[comp], tmp, comp);
-#else
+#else
std::stringstream ss;
ss << snapshots_[i].file_name << "/Level_0/" << Concatenate("buffer", i_lab, 5);
VisMF::Write(tmp, ss.str());
#endif
}
-
+
if (WarpX::do_boosted_frame_particles) {
// Loop over species to be dumped to BFD
for (int j = 0; j < mypc.nSpeciesBoostedFrameDiags(); ++j) {
// Get species name
- std::string species_name =
+ std::string species_name =
species_names[mypc.mapSpeciesBoostedFrameDiags(j)];
#ifdef WARPX_USE_HDF5
// Dump species data
@@ -691,7 +691,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
// Loop over snapshots
for (int i = 0; i < N_snapshots_; ++i) {
-
+
// Get updated z position of snapshot
const Real old_z_boost = snapshots_[i].current_z_boost;
snapshots_[i].updateCurrentZPositions(t_boost,
@@ -700,15 +700,15 @@ writeLabFrameData(const MultiFab* cell_centered_data,
Real zmin_lab = snapshots_[i].prob_domain_lab_.lo(AMREX_SPACEDIM-1);
Real zmax_lab = snapshots_[i].prob_domain_lab_.hi(AMREX_SPACEDIM-1);
-
+
// If snapshot out of the domain, nothing to do
if ( (snapshots_[i].current_z_boost < zlo_boost) or
(snapshots_[i].current_z_boost > zhi_boost) or
(snapshots_[i].current_z_lab < zmin_lab) or
(snapshots_[i].current_z_lab > zmax_lab) ) continue;
- // Get z index of data_buffer_ (i.e. in the lab frame) where
- // simulation domain (t', [zmin',zmax']), back-transformed to lab
+ // Get z index of data_buffer_ (i.e. in the lab frame) where
+ // simulation domain (t', [zmin',zmax']), back-transformed to lab
// frame, intersects with snapshot.
int i_lab = (snapshots_[i].current_z_lab - zmin_lab) / dz_lab_;
@@ -725,7 +725,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
data_buffer_[i].reset( new MultiFab(buff_ba, buff_dm, ncomp_to_dump, 0) );
}
// ... reset particle buffer particles_buffer_[i]
- if (WarpX::do_boosted_frame_particles)
+ if (WarpX::do_boosted_frame_particles)
particles_buffer_[i].resize(mypc.nSpeciesBoostedFrameDiags());
}
@@ -738,7 +738,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
snapshots_[i].current_z_boost,
*cell_centered_data, geom,
start_comp, ncomp, interpolate);
-
+
// transform it to the lab frame
LorentzTransformZ(*slice, gamma_boost_, beta_boost_, ncomp);
// Create a 2D box for the slice in the boosted frame
@@ -753,7 +753,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
// Create MultiFab tmp on slice_ba with data from slice
MultiFab tmp(slice_ba, data_buffer_[i]->DistributionMap(), ncomp, 0);
tmp.copy(*slice, 0, 0, ncomp);
-
+
// Copy data from MultiFab tmp to MultiDab data_buffer[i]
CopySlice(tmp, *data_buffer_[i], i_lab, map_actual_fields_to_dump);
}
@@ -766,7 +766,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
++buff_counter_[i];
-
+
// If buffer full, write to disk.
if (buff_counter_[i] == num_buffer_) {
@@ -781,10 +781,10 @@ writeLabFrameData(const MultiFab* cell_centered_data,
VisMF::Write(*data_buffer_[i], mesh_ss.str());
#endif
}
-
+
if (WarpX::do_boosted_frame_particles) {
// Loop over species to be dumped to BFD
- for (int j = 0; j < mypc.nSpeciesBoostedFrameDiags(); ++j) {
+ for (int j = 0; j < mypc.nSpeciesBoostedFrameDiags(); ++j) {
// Get species name
const std::string species_name = species_names[mypc.mapSpeciesBoostedFrameDiags(j)];
#ifdef WARPX_USE_HDF5
@@ -800,14 +800,14 @@ writeLabFrameData(const MultiFab* cell_centered_data,
// Write data to disk (custom)
writeParticleData(particles_buffer_[i][j], part_ss.str(), i_lab);
#endif
- }
+ }
particles_buffer_[i].clear();
}
buff_counter_[i] = 0;
}
}
-
- VisMF::SetHeaderVersion(current_version);
+
+ VisMF::SetHeaderVersion(current_version);
}
#ifdef WARPX_USE_HDF5
@@ -817,12 +817,12 @@ writeParticleDataHDF5(const WarpXParticleContainer::DiagnosticParticleData& pdat
const std::string& name, const std::string& species_name)
{
auto np = pdata.GetRealData(DiagIdx::w).size();
-
+
Vector<long> particle_counts(ParallelDescriptor::NProcs(), 0);
Vector<long> particle_offsets(ParallelDescriptor::NProcs(), 0);
-
+
ParallelAllGather::AllGather(np, particle_counts.data(), ParallelContext::CommunicatorAll());
-
+
long total_np = 0;
for (int i = 0; i < ParallelDescriptor::NProcs(); ++i) {
particle_offsets[i] = total_np;
@@ -830,7 +830,7 @@ writeParticleDataHDF5(const WarpXParticleContainer::DiagnosticParticleData& pdat
}
if (total_np == 0) return;
-
+
long old_np = 0;
if (ParallelDescriptor::IOProcessor())
{
@@ -844,7 +844,7 @@ writeParticleDataHDF5(const WarpXParticleContainer::DiagnosticParticleData& pdat
// Note, this has the effect of an MPI Barrier between the above resize operation
// and the below write.
ParallelDescriptor::ReduceLongMax(old_np);
-
+
// Write data here
for (int k = 0; k < static_cast<int>(particle_field_names.size()); ++k)
{
@@ -853,7 +853,7 @@ writeParticleDataHDF5(const WarpXParticleContainer::DiagnosticParticleData& pdat
pdata.GetRealData(k).data(),
particle_counts[ParallelDescriptor::MyProc()],
particle_offsets[ParallelDescriptor::MyProc()] + old_np);
- }
+ }
}
#endif
@@ -863,7 +863,7 @@ writeParticleData(const WarpXParticleContainer::DiagnosticParticleData& pdata,
const std::string& name, const int i_lab)
{
BL_PROFILE("BoostedFrameDiagnostic::writeParticleData");
-
+
std::string field_name;
std::ofstream ofs;
@@ -880,27 +880,27 @@ writeParticleData(const WarpXParticleContainer::DiagnosticParticleData& pdata,
field_name = name + Concatenate("x_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
writeRealData(pdata.GetRealData(DiagIdx::x).data(), np, ofs);
- ofs.close();
+ ofs.close();
field_name = name + Concatenate("y_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
writeRealData(pdata.GetRealData(DiagIdx::y).data(), np, ofs);
- ofs.close();
+ ofs.close();
field_name = name + Concatenate("z_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
writeRealData(pdata.GetRealData(DiagIdx::z).data(), np, ofs);
- ofs.close();
-
+ ofs.close();
+
field_name = name + Concatenate("ux_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
writeRealData(pdata.GetRealData(DiagIdx::ux).data(), np, ofs);
- ofs.close();
+ ofs.close();
field_name = name + Concatenate("uy_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
writeRealData(pdata.GetRealData(DiagIdx::uy).data(), np, ofs);
- ofs.close();
+ ofs.close();
field_name = name + Concatenate("uz_", i_lab, 5) + "_" + std::to_string(MyProc);
ofs.open(field_name.c_str(), std::ios::out|std::ios::binary);
@@ -910,12 +910,12 @@ writeParticleData(const WarpXParticleContainer::DiagnosticParticleData& pdata,
void
BoostedFrameDiagnostic::
-writeMetaData ()
+writeMetaData ()
{
BL_PROFILE("BoostedFrameDiagnostic::writeMetaData");
if (ParallelDescriptor::IOProcessor()) {
-
+
if (!UtilCreateDirectory(WarpX::lab_data_directory, 0755))
CreateDirectoryFailed(WarpX::lab_data_directory);
@@ -928,22 +928,22 @@ writeMetaData ()
std::ofstream::binary);
if(!HeaderFile.good())
FileOpenFailed(HeaderFileName);
-
+
HeaderFile.precision(17);
-
+
HeaderFile << N_snapshots_ << "\n";
- HeaderFile << dt_snapshots_lab_ << "\n";
+ HeaderFile << dt_snapshots_lab_ << "\n";
HeaderFile << gamma_boost_ << "\n";
HeaderFile << beta_boost_ << "\n";
}
}
BoostedFrameDiagnostic::LabSnapShot::
-LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
- IntVect prob_ncells_lab,
+LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
+ IntVect prob_ncells_lab,
int ncomp_to_dump,
std::vector<std::string> mesh_field_names,
- int file_num_in,
+ int file_num_in,
const BoostedFrameDiagnostic& bfd)
: t_lab(t_lab_in),
prob_domain_lab_(prob_domain_lab),
@@ -967,7 +967,7 @@ LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
}
ParallelDescriptor::Barrier();
-
+
if (ParallelDescriptor::IOProcessor())
{
if (WarpX::do_boosted_frame_fields)
@@ -986,7 +986,7 @@ LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
}
ParallelDescriptor::Barrier();
-
+
if (WarpX::do_boosted_frame_particles){
auto & mypc = WarpX::GetInstance().GetPartContainer();
const std::vector<std::string> species_names = mypc.GetSpeciesNames();
@@ -994,7 +994,7 @@ LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
for (int j = 0; j < mypc.nSpeciesBoostedFrameDiags(); ++j)
{
// Loop over species to be dumped to BFD
- std::string species_name =
+ std::string species_name =
species_names[mypc.mapSpeciesBoostedFrameDiags(j)];
output_create_species_group(file_name, species_name);
for (int k = 0; k < static_cast<int>(particle_field_names.size()); ++k)
@@ -1003,10 +1003,10 @@ LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
output_create_particle_field(file_name, field_path);
}
}
- }
-#else
+ }
+#else
if (ParallelDescriptor::IOProcessor()) {
-
+
if (!UtilCreateDirectory(file_name, 0755))
CreateDirectoryFailed(file_name);
@@ -1018,13 +1018,13 @@ LabSnapShot(Real t_lab_in, Real t_boost, RealBox prob_domain_lab,
}
auto & mypc = WarpX::GetInstance().GetPartContainer();
- const std::vector<std::string> species_names = mypc.GetSpeciesNames();
-
+ const std::vector<std::string> species_names = mypc.GetSpeciesNames();
+
const std::string particles_prefix = "particle";
// Loop over species to be dumped to BFD
for(int i = 0; i < mypc.nSpeciesBoostedFrameDiags(); ++i) {
// Get species name
- std::string species_name =
+ std::string species_name =
species_names[mypc.mapSpeciesBoostedFrameDiags(i)];
const std::string fullpath = file_name + "/" + species_name;
if (!UtilCreateDirectory(fullpath, 0755))
@@ -1058,9 +1058,9 @@ writeSnapShotHeader() {
std::ofstream::binary);
if(!HeaderFile.good())
FileOpenFailed(HeaderFileName);
-
+
HeaderFile.precision(17);
-
+
HeaderFile << t_lab << "\n";
// Write domain number of cells
HeaderFile << prob_ncells_lab_[0] << ' '