Skip to content

Commit a44f743

Browse files
committed
Offset should be a long
Overflow risk is very high for pure `int`. Also, counter is `unsigned`, so `unsigned long` for now.
1 parent 7204b2d commit a44f743

14 files changed

+18
-18
lines changed

Source/Diagnostics/Diagnostics.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected:
313313
* The first vector is for total number of snapshots and second vector loops
314314
* over the total number of species selected for diagnostics.
315315
*/
316-
amrex::Vector< amrex::Vector <int> > m_totalParticles_flushed_already;
316+
amrex::Vector< amrex::Vector <unsigned long> > m_totalParticles_flushed_already;
317317
/** Vector of total number of particles in the buffer, per species, per snapshot.
318318
* The first vector is for total number of snapshots and second vector loops
319319
* over the total number of species selected for diagnostics.

Source/Diagnostics/FlushFormats/FlushFormat.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public:
1616
const amrex::Vector<amrex::MultiFab>& mf,
1717
amrex::Vector<amrex::Geometry>& geom,
1818
amrex::Vector<int> iteration, double time,
19-
amrex::Vector<int>& totalParticlesFlushedAlready,
19+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
2020
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
2121
std::string prefix, int file_min_digits,
2222
bool plot_raw_fields,

Source/Diagnostics/FlushFormats/FlushFormatAscent.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public:
3333
const amrex::Vector<amrex::MultiFab>& mf,
3434
amrex::Vector<amrex::Geometry>& geom,
3535
amrex::Vector<int> iteration, double time,
36-
amrex::Vector<int>& totalParticlesFlushedAlready,
36+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
3737
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
3838
std::string prefix, int file_min_digits,
3939
bool plot_raw_fields,

Source/Diagnostics/FlushFormats/FlushFormatAscent.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FlushFormatAscent::WriteToFile (
1515
const amrex::Vector<amrex::MultiFab>& mf,
1616
amrex::Vector<amrex::Geometry>& geom,
1717
const amrex::Vector<int> iteration, const double time,
18-
amrex::Vector<int>& /* totalParticlesFlushedAlready*/,
18+
amrex::Vector<unsigned long>& /* totalParticlesFlushedAlready*/,
1919
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
2020
const std::string prefix, int file_min_digits, bool plot_raw_fields,
2121
bool plot_raw_fields_guards,

Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FlushFormatCheckpoint final : public FlushFormatPlotfile
2020
const amrex::Vector<amrex::MultiFab>& mf,
2121
amrex::Vector<amrex::Geometry>& geom,
2222
amrex::Vector<int> iteration, double time,
23-
amrex::Vector<int>& totalParticlesFlushedAlready,
23+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
2424
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
2525
std::string prefix, int file_min_digits,
2626
bool plot_raw_fields,

Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ FlushFormatCheckpoint::WriteToFile (
3131
const amrex::Vector<amrex::MultiFab>& /*mf*/,
3232
amrex::Vector<amrex::Geometry>& geom,
3333
const amrex::Vector<int> iteration, const double /*time*/,
34-
amrex::Vector<int>& /* totalParticlesFlushedAlready*/,
34+
amrex::Vector<unsigned long>& /* totalParticlesFlushedAlready*/,
3535
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
3636
const std::string prefix, int file_min_digits,
3737
bool /*plot_raw_fields*/,

Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public:
3232
const amrex::Vector<amrex::MultiFab>& mf,
3333
amrex::Vector<amrex::Geometry>& geom,
3434
amrex::Vector<int> iteration, double time,
35-
amrex::Vector<int>& totalParticlesFlushedAlready,
35+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
3636
const amrex::Vector<ParticleDiag>& particle_diags, int output_levels,
3737
std::string prefix, int file_min_digits,
3838
bool plot_raw_fields,

Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ FlushFormatOpenPMD::WriteToFile (
120120
const amrex::Vector<amrex::MultiFab>& mf,
121121
amrex::Vector<amrex::Geometry>& geom,
122122
const amrex::Vector<int> iteration, const double time,
123-
amrex::Vector<int>& totalParticlesFlushedAlready,
123+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
124124
const amrex::Vector<ParticleDiag>& particle_diags, int output_levels,
125125
const std::string prefix, int file_min_digits, bool plot_raw_fields,
126126
bool plot_raw_fields_guards,

Source/Diagnostics/FlushFormats/FlushFormatPlotfile.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public:
2727
const amrex::Vector<amrex::MultiFab>& mf,
2828
amrex::Vector<amrex::Geometry>& geom,
2929
amrex::Vector<int> iteration, double time,
30-
amrex::Vector<int>& totalParticlesFlushedAlready,
30+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
3131
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
3232
std::string prefix, int file_min_digits,
3333
bool plot_raw_fields,
@@ -55,7 +55,7 @@ public:
5555
void WriteParticles(const std::string& dir,
5656
const amrex::Vector<ParticleDiag>& particle_diags,
5757
amrex::Real time,
58-
amrex::Vector<int>& totalParticlesFlushedAlready,
58+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
5959
bool isBTD = false) const;
6060

6161
FlushFormatPlotfile () = default;

Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ FlushFormatPlotfile::WriteToFile (
5959
const amrex::Vector<amrex::MultiFab>& mf,
6060
amrex::Vector<amrex::Geometry>& geom,
6161
const amrex::Vector<int> iteration, const double time,
62-
amrex::Vector<int>& totalParticlesFlushedAlready,
62+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
6363
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
6464
const std::string prefix, int file_min_digits, bool plot_raw_fields,
6565
bool plot_raw_fields_guards,
@@ -342,7 +342,7 @@ void
342342
FlushFormatPlotfile::WriteParticles(const std::string& dir,
343343
const amrex::Vector<ParticleDiag>& particle_diags,
344344
const amrex::Real time,
345-
amrex::Vector<int>& totalParticlesFlushedAlready,
345+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
346346
bool isBTD) const
347347
{
348348
int i = 0;

Source/Diagnostics/FlushFormats/FlushFormatSensei.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public:
5353
const amrex::Vector<amrex::MultiFab>& mf,
5454
amrex::Vector<amrex::Geometry>& geom,
5555
amrex::Vector<int> iteration, double time,
56-
amrex::Vector<int>& totalParticlesFlushedAlready,
56+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
5757
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
5858
std::string prefix, int file_min_digits,
5959
bool plot_raw_fields,

Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ FlushFormatSensei::WriteToFile (
4848
const amrex::Vector<amrex::MultiFab>& mf,
4949
amrex::Vector<amrex::Geometry>& geom,
5050
const amrex::Vector<int> iteration, const double time,
51-
amrex::Vector<int>& totalParticlesFlushedAlready,
51+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
5252
const amrex::Vector<ParticleDiag>& particle_diags,
5353
int nlev, const std::string prefix, int file_min_digits,
5454
bool plot_raw_fields, bool plot_raw_fields_guards,

Source/Diagnostics/WarpXOpenPMD.H

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public:
123123
void WriteOpenPMDParticles (
124124
const amrex::Vector<ParticleDiag>& particle_diags,
125125
amrex::Real time,
126-
amrex::Vector<int>& totalParticlesFlushedAlready,
126+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
127127
bool use_pinned_pc = false,
128128
bool isBTD = false,
129129
bool isLastBTDFlush = false);
@@ -303,7 +303,7 @@ private:
303303
const amrex::Vector<std::string>& int_comp_names,
304304
amrex::ParticleReal charge,
305305
amrex::ParticleReal mass,
306-
int & ParticleFlushOffset,
306+
unsigned long & ParticleFlushOffset,
307307
bool isBTD = false,
308308
bool isLastBTDFlush = false);
309309

Source/Diagnostics/WarpXOpenPMD.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD)
520520
void
521521
WarpXOpenPMDPlot::WriteOpenPMDParticles (const amrex::Vector<ParticleDiag>& particle_diags,
522522
const amrex::Real time,
523-
amrex::Vector<int>& totalParticlesFlushedAlready,
523+
amrex::Vector<unsigned long>& totalParticlesFlushedAlready,
524524
const bool use_pinned_pc,
525525
const bool isBTD,
526526
const bool isLastBTDFlush
@@ -644,7 +644,7 @@ WarpXOpenPMDPlot::DumpToFile (ParticleContainer* pc,
644644
const amrex::Vector<std::string>& int_comp_names,
645645
amrex::ParticleReal const charge,
646646
amrex::ParticleReal const mass,
647-
int & ParticleFlushOffset,
647+
unsigned long & ParticleFlushOffset,
648648
const bool isBTD,
649649
const bool isLastBTDFlush
650650
)

0 commit comments

Comments
 (0)