Merge pull request #1460 from paulromano/map-erase-fix

Prevent segfault when destructors are called
This commit is contained in:
Patrick Shriwise 2020-01-21 12:23:49 -06:00 committed by GitHub
commit 07bc6a1e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 11 deletions

View file

@ -25,8 +25,8 @@ class Material;
namespace model {
extern std::vector<std::unique_ptr<Material>> materials;
extern std::unordered_map<int32_t, int32_t> material_map;
extern std::vector<std::unique_ptr<Material>> materials;
} // namespace model

View file

@ -108,8 +108,8 @@ private:
namespace model {
extern "C" int32_t n_filters;
extern std::vector<std::unique_ptr<Filter>> tally_filters;
extern std::unordered_map<int, int> filter_map;
extern std::vector<std::unique_ptr<Filter>> tally_filters;
}
//==============================================================================

View file

@ -98,10 +98,10 @@ public:
//! True if this tally has a bin for every nuclide in the problem
bool all_nuclides_ {false};
//! Results for each bin -- the first dimension of the array is for scores
//! (e.g. flux, total reaction rate, fission reaction rate, etc.) and the
//! second dimension of the array is for the combination of filters
//! (e.g. specific cell, specific energy group, etc.)
//! Results for each bin -- the first dimension of the array is for the
//! combination of filters (e.g. specific cell, specific energy group, etc.)
//! and the second dimension of the array is for scores (e.g. flux, total
//! reaction rate, fission reaction rate, etc.)
xt::xtensor<double, 3> results_;
//! True if this tally should be written to statepoint files
@ -141,6 +141,7 @@ private:
//==============================================================================
namespace model {
extern std::unordered_map<int, int> tally_map;
extern std::vector<std::unique_ptr<Tally>> tallies;
extern std::vector<int> active_tallies;
extern std::vector<int> active_analog_tallies;
@ -148,8 +149,6 @@ namespace model {
extern std::vector<int> active_collision_tallies;
extern std::vector<int> active_meshsurf_tallies;
extern std::vector<int> active_surface_tallies;
extern std::unordered_map<int, int> tally_map;
}
namespace simulation {

View file

@ -37,8 +37,8 @@ namespace openmc {
namespace model {
std::vector<std::unique_ptr<Material>> materials;
std::unordered_map<int32_t, int32_t> material_map;
std::vector<std::unique_ptr<Material>> materials;
} // namespace model

View file

@ -40,8 +40,8 @@ namespace openmc {
//==============================================================================
namespace model {
std::vector<std::unique_ptr<Filter>> tally_filters;
std::unordered_map<int, int> filter_map;
std::vector<std::unique_ptr<Filter>> tally_filters;
}
//==============================================================================

View file

@ -45,6 +45,7 @@ namespace openmc {
//==============================================================================
namespace model {
std::unordered_map<int, int> tally_map;
std::vector<std::unique_ptr<Tally>> tallies;
std::vector<int> active_tallies;
std::vector<int> active_analog_tallies;
@ -52,7 +53,6 @@ namespace model {
std::vector<int> active_collision_tallies;
std::vector<int> active_meshsurf_tallies;
std::vector<int> active_surface_tallies;
std::unordered_map<int, int> tally_map;
}
namespace simulation {