Skip to content

Commit 1e2154f

Browse files
authored
ParticleInit: Implicit Int Float Conversion (#3304)
## 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 BLAST-ImpactX/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
1 parent 85a89e2 commit 1e2154f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Src/Particle/AMReX_ParticleInit.H

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,17 @@ InitRandom (Long icount,
989989
{
990990
if(icount*AMREX_SPACEDIM >= std::numeric_limits<int>::max())
991991
{
992-
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");
992+
amrex::Abort(
993+
"InitRandom has serialize=true, but this would cause too much "
994+
"particle data to be sent from IOProc. Set serialize=false, "
995+
"or use fewer than " +
996+
std::to_string(
997+
amrex::Math::ceil(
998+
amrex::Real(std::numeric_limits<int>::max()) /
999+
amrex::Real(AMREX_SPACEDIM)
1000+
)
1001+
) + " particles."
1002+
);
9931003
}
9941004
//
9951005
// We'll let IOProc generate the particles so we get the same

0 commit comments

Comments
 (0)