Skip to content

Commit

Permalink
ParticleInit: Implicit Int Float Conversion (#3304)
Browse files Browse the repository at this point in the history
## Summary

Fix ICX warning:
```
implicit conversion from 'int' to 'amrex::Real' (aka 'float') changes
value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
```

## Additional background

First seen in ECP-WarpX/impactx#318 during built
of pyAMReX.

## Checklist

The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
ax3l committed May 9, 2023
1 parent 85a89e2 commit 1e2154f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Src/Particle/AMReX_ParticleInit.H
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,17 @@ InitRandom (Long icount,
{
if(icount*AMREX_SPACEDIM >= std::numeric_limits<int>::max())
{
amrex::Abort("InitRandom has serialize=true, but this would cause too much particle data to be sent from IOProc. Set serialize=false, or use fewer than "+std::to_string(amrex::Math::ceil(std::numeric_limits<int>::max()/amrex::Real(AMREX_SPACEDIM)))+ "particles");
amrex::Abort(
"InitRandom has serialize=true, but this would cause too much "
"particle data to be sent from IOProc. Set serialize=false, "
"or use fewer than " +
std::to_string(
amrex::Math::ceil(
amrex::Real(std::numeric_limits<int>::max()) /
amrex::Real(AMREX_SPACEDIM)
)
) + " particles."
);
}
//
// We'll let IOProc generate the particles so we get the same
Expand Down

0 comments on commit 1e2154f

Please sign in to comment.