diff options
author | 2021-06-09 20:00:02 -0700 | |
---|---|---|
committer | 2021-06-09 20:00:02 -0700 | |
commit | 4974f07209ebc5e0578fc383057b4be383cdf318 (patch) | |
tree | 975c08a91b02f5c584e8b38c5536faf2c8257933 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 0967eb5835bf0ff5c82d97a98316a9b9f6c936fd (diff) | |
download | WarpX-4974f07209ebc5e0578fc383057b4be383cdf318.tar.gz WarpX-4974f07209ebc5e0578fc383057b4be383cdf318.tar.zst WarpX-4974f07209ebc5e0578fc383057b4be383cdf318.zip |
ion_map_ids: static & const access (#2010)
This fixes the `ion_map_ids` atom-to-number object:
- declare static, so the file can be included in multiple
translation units
- use `.at()`:
- missing entries do not cause an insertion
- missing entries will throw
- access is `const`, so we can declare the whole object
`static const` as well.
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index a8140d4f4..ae7111550 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -2324,7 +2324,7 @@ PhysicalParticleContainer::InitIonizationModule () // Add runtime integer component for ionization level AddIntComp("ionization_level"); // Get atomic number and ionization energies from file - int ion_element_id = ion_map_ids[physical_element]; + int const ion_element_id = ion_map_ids.at(physical_element); ion_atomic_number = ion_atomic_numbers[ion_element_id]; Vector<Real> h_ionization_energies(ion_atomic_number); int offset = ion_energy_offsets[ion_element_id]; |