Skip to content

Commit

Permalink
Fix: species_type init memory (#5119)
Browse files Browse the repository at this point in the history
The `PC::physical_species` was undefined memory unless
`<species_name>.species_type` was provided in the input set.
This initializes this member variable to a clear
`PhysicalSpecies::unspecified` instead of random memory, which
caused UB in functions such as `IamA<...>` during I/O.
  • Loading branch information
ax3l authored Aug 7, 2024
1 parent ffb16f3 commit fe36717
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Particles/WarpXParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ protected:

amrex::ParticleReal charge;
amrex::ParticleReal mass;
PhysicalSpecies physical_species;
PhysicalSpecies physical_species = PhysicalSpecies::unspecified;

// Controls boundaries for particles exiting the domain
ParticleBoundaries m_boundary_conditions;
Expand Down

0 comments on commit fe36717

Please sign in to comment.