diff options
author | 2023-03-23 22:34:22 +0100 | |
---|---|---|
committer | 2023-03-23 14:34:22 -0700 | |
commit | 121f4dd882964e6af3ed7fbc4100e67c86b5d574 (patch) | |
tree | 3506283c8f69c9d29481a2b7c51c65c68c3eb9b3 /Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp | |
parent | 04b96737fe1759e55c8ee83cdb783dbf315f9431 (diff) | |
download | WarpX-121f4dd882964e6af3ed7fbc4100e67c86b5d574.tar.gz WarpX-121f4dd882964e6af3ed7fbc4100e67c86b5d574.tar.zst WarpX-121f4dd882964e6af3ed7fbc4100e67c86b5d574.zip |
Fix "modernize-loop-convert" issues found with clang-tidy (#3774)
* Fix all the modernize-loop-convert issues found with clang-tidy
* Fix bug
* Implement @EZoni's suggestions
Diffstat (limited to 'Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp')
-rw-r--r-- | Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp index 990f612cf..4a8a57bf3 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp @@ -315,11 +315,11 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir, bool isBTD) const { - for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) { - WarpXParticleContainer* pc = particle_diags[i].getParticleContainer(); + for (auto& part_diag : particle_diags) { + WarpXParticleContainer* pc = part_diag.getParticleContainer(); auto tmp = pc->make_alike<amrex::PinnedArenaAllocator>(); if (isBTD) { - PinnedMemoryParticleContainer* pinned_pc = particle_diags[i].getPinnedParticleContainer(); + PinnedMemoryParticleContainer* pinned_pc = part_diag.getPinnedParticleContainer(); tmp = pinned_pc->make_alike<amrex::PinnedArenaAllocator>(); } @@ -344,7 +344,7 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir, for (auto const& x : runtime_rnames) { real_names[x.second+PIdx::nattribs] = x.first; } // plot any "extra" fields by default - real_flags = particle_diags[i].m_plot_flags; + real_flags = part_diag.m_plot_flags; real_flags.resize(pc->NumRealComps(), 1); // and the names @@ -356,17 +356,17 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir, int_flags.resize(pc->NumIntComps(), 1); const auto mass = pc->AmIA<PhysicalSpecies::photon>() ? PhysConst::m_e : pc->getMass(); - RandomFilter const random_filter(particle_diags[i].m_do_random_filter, - particle_diags[i].m_random_fraction); - UniformFilter const uniform_filter(particle_diags[i].m_do_uniform_filter, - particle_diags[i].m_uniform_stride); - ParserFilter parser_filter(particle_diags[i].m_do_parser_filter, + RandomFilter const random_filter(part_diag.m_do_random_filter, + part_diag.m_random_fraction); + UniformFilter const uniform_filter(part_diag.m_do_uniform_filter, + part_diag.m_uniform_stride); + ParserFilter parser_filter(part_diag.m_do_parser_filter, utils::parser::compileParser<ParticleDiag::m_nvars> - (particle_diags[i].m_particle_filter_parser.get()), + (part_diag.m_particle_filter_parser.get()), pc->getMass()); parser_filter.m_units = InputUnits::SI; - GeometryFilter const geometry_filter(particle_diags[i].m_do_geom_filter, - particle_diags[i].m_diag_domain); + GeometryFilter const geometry_filter(part_diag.m_do_geom_filter, + part_diag.m_diag_domain); if (!isBTD) { particlesConvertUnits(ConvertDirection::WarpX_to_SI, pc, mass); @@ -380,14 +380,14 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir, }, true); particlesConvertUnits(ConvertDirection::SI_to_WarpX, pc, mass); } else { - PinnedMemoryParticleContainer* pinned_pc = particle_diags[i].getPinnedParticleContainer(); + PinnedMemoryParticleContainer* pinned_pc = part_diag.getPinnedParticleContainer(); tmp.copyParticles(*pinned_pc, true); particlesConvertUnits(ConvertDirection::WarpX_to_SI, &tmp, mass); } // real_names contains a list of all particle attributes. // real_flags & int_flags are 1 or 0, whether quantity is dumped or not. tmp.WritePlotFile( - dir, particle_diags[i].getSpeciesName(), + dir, part_diag.getSpeciesName(), real_flags, int_flags, real_names, int_names); } |