mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Add destructors that remove key-value pairs from maps
This commit is contained in:
parent
0c32470551
commit
7db1511f00
6 changed files with 20 additions and 2 deletions
|
|
@ -43,9 +43,10 @@ public:
|
|||
double fraction; //!< How often to use table
|
||||
};
|
||||
|
||||
// Constructors
|
||||
// Constructors and destructors
|
||||
Material() {};
|
||||
explicit Material(pugi::xml_node material_node);
|
||||
~Material();
|
||||
|
||||
// Methods
|
||||
void calculate_xs(Particle& p) const;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
//! \return Pointer to the new filter object
|
||||
static Filter* create(pugi::xml_node node);
|
||||
|
||||
virtual ~Filter() = default;
|
||||
virtual ~Filter();
|
||||
|
||||
virtual std::string type() const = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ class Tally {
|
|||
public:
|
||||
explicit Tally(int32_t id);
|
||||
|
||||
~Tally();
|
||||
|
||||
static Tally* create(int32_t id = -1);
|
||||
|
||||
void init_from_xml(pugi::xml_node node);
|
||||
|
|
|
|||
|
|
@ -332,6 +332,11 @@ Material::Material(pugi::xml_node node)
|
|||
}
|
||||
}
|
||||
|
||||
Material::~Material()
|
||||
{
|
||||
model::material_map.erase(id_);
|
||||
}
|
||||
|
||||
void Material::finalize()
|
||||
{
|
||||
// Set fissionable if any nuclide is fissionable
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ extern "C" size_t tally_filters_size()
|
|||
Filter::Filter() : index_{model::tally_filters.size()}
|
||||
{ }
|
||||
|
||||
Filter::~Filter()
|
||||
{
|
||||
model::filter_map.erase(id_);
|
||||
}
|
||||
|
||||
Filter* Filter::create(pugi::xml_node node)
|
||||
{
|
||||
// Copy filter id
|
||||
|
|
|
|||
|
|
@ -247,6 +247,11 @@ Tally::Tally(int32_t id)
|
|||
this->set_filters({});
|
||||
}
|
||||
|
||||
Tally::~Tally()
|
||||
{
|
||||
model::tally_map.erase(id_);
|
||||
}
|
||||
|
||||
Tally*
|
||||
Tally::create(int32_t id)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue