diff options
author | 2022-05-24 17:57:51 -0700 | |
---|---|---|
committer | 2022-05-24 17:57:51 -0700 | |
commit | 0344c42e27c61b286e885889028c7f77725e7f74 (patch) | |
tree | ec116dbe570b342c7df3da3e6d620cbdd4032db5 /Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp | |
parent | a681d1994aa5748d4faceb658199c1a61d418a79 (diff) | |
download | WarpX-0344c42e27c61b286e885889028c7f77725e7f74.tar.gz WarpX-0344c42e27c61b286e885889028c7f77725e7f74.tar.zst WarpX-0344c42e27c61b286e885889028c7f77725e7f74.zip |
Specify particle precision (#3065)
* Add precision to printed PIC parameters
* Added WarpX_PARTICLE_PRECISION as a build option
* Update types to ParticleReal
* Updated libwarpx to inject particles with correct ParticleReal type
* Fix syntax error
* Add logic to avoid duplicate definitions
* Use correct ParticleReal type in add_particles
* Cleaned up code, addressed comments
* Update Python/pywarpx/_libwarpx.py
Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com>
* Removed redundant functions, fixed some typing
* Modified template functions
* Cast d_w to Real
* Fixed failing tests
* Cast types to be consistent
* removed in-tree-build from pip command
* Added GPU device macros to PDim3 methods
* rerun tests
* Removed unecessary casting, update calls to use PDim3 instead of XDim3
* Refactored comments
* Added mcc fields double precision, particles single precision test
* Updated casting and formatting
* Removed cast, updated declaration
Co-authored-by: Peter Scherpelz <peter.scherpelz@modernelectron.com>
Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com>
Diffstat (limited to 'Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp')
-rw-r--r-- | Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp index 415083afd..f54f9bf37 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp @@ -198,10 +198,10 @@ void ParticleHistogram::ComputeDiags (int step) auto const GetPosition = GetParticlePosition(pti); auto & attribs = pti.GetAttribs(); - Real* const AMREX_RESTRICT d_w = attribs[PIdx::w].dataPtr(); - Real* const AMREX_RESTRICT d_ux = attribs[PIdx::ux].dataPtr(); - Real* const AMREX_RESTRICT d_uy = attribs[PIdx::uy].dataPtr(); - Real* const AMREX_RESTRICT d_uz = attribs[PIdx::uz].dataPtr(); + ParticleReal* const AMREX_RESTRICT d_w = attribs[PIdx::w].dataPtr(); + ParticleReal* const AMREX_RESTRICT d_ux = attribs[PIdx::ux].dataPtr(); + ParticleReal* const AMREX_RESTRICT d_uy = attribs[PIdx::uy].dataPtr(); + ParticleReal* const AMREX_RESTRICT d_uz = attribs[PIdx::uz].dataPtr(); long const np = pti.numParticles(); @@ -211,7 +211,7 @@ void ParticleHistogram::ComputeDiags (int step) { amrex::ParticleReal x, y, z; GetPosition(i, x, y, z); - auto const w = d_w[i]; + auto const w = (amrex::Real)d_w[i]; auto const ux = d_ux[i] / PhysConst::c; auto const uy = d_uy[i] / PhysConst::c; auto const uz = d_uz[i] / PhysConst::c; @@ -222,7 +222,6 @@ void ParticleHistogram::ComputeDiags (int step) return; // continue function if particle is not filtered out auto const f = fun_partparser(t, x, y, z, ux, uy, uz); - // determine particle bin int const bin = int(Math::floor((f-bin_min)/bin_size)); if ( bin<0 || bin>=num_bins ) return; // discard if out-of-range |