Skip to content

Commit

Permalink
Add const qualifier for clang tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
archermarx committed Aug 27, 2024
1 parent 5fc31d8 commit aa84592
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/Particles/WarpXParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public:

std::array<amrex::ParticleReal, 3> meanParticleVelocity(bool local = false);

amrex::ParticleReal maxParticleVelocity(bool local = false);
amrex::ParticleReal maxParticleVelocity(bool local = false) const;

/**
* \brief Adds n particles to the simulation
Expand Down
7 changes: 4 additions & 3 deletions Source/Particles/WarpXParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,19 +1420,20 @@ std::array<ParticleReal, 3> WarpXParticleContainer::meanParticleVelocity(bool lo
return mean_v;
}

amrex::ParticleReal WarpXParticleContainer::maxParticleVelocity(bool local) {
amrex::ParticleReal WarpXParticleContainer::maxParticleVelocity(bool local) const {

const amrex::ParticleReal inv_clight_sq = 1.0_prt/(PhysConst::c*PhysConst::c);

using PType = typename WarpXParticleContainer::SuperParticleType;
amrex::ReduceOps<amrex::ReduceOpMax> reduce_ops;
const auto reduce_res = amrex::ParticleReduce<amrex::ReduceData<amrex::ParticleReal>>(
*this,
[=] AMREX_GPU_HOST_DEVICE(const PType &p) noexcept -> amrex::GpuTuple<amrex::ParticleReal> {
[=] AMREX_GPU_HOST_DEVICE(const PType &p) noexcept -> amrex::GpuTuple<amrex::ParticleReal>
{
const auto ux = p.rdata(PIdx::ux);
const auto uy = p.rdata(PIdx::uy);
const auto uz = p.rdata(PIdx::uz);
return (ux*ux + uy*uy + uz*uz) * inv_clight_sq;
return {(ux*ux + uy*uy + uz*uz) * inv_clight_sq,};
},
reduce_ops);

Expand Down

0 comments on commit aa84592

Please sign in to comment.