A few updates to address memory leaks.

This commit is contained in:
Patrick Shriwise 2020-03-29 23:01:24 -05:00
parent 42e8e62a6e
commit 48d62e7501
6 changed files with 6 additions and 8 deletions

View file

@ -600,7 +600,7 @@ private:
std::unique_ptr<libMesh::Mesh> m_; //!< pointer to the libmesh mesh instance
std::vector<std::unique_ptr<libMesh::PointLocatorBase>> point_locators_; //!< pointers to locators for each thread
std::unique_ptr<libMesh::EquationSystems> equation_systems_; //!< pointer to the equation systems of the mesh (for result output)
std::map<std::string, unsigned int> variable_map_; //!< mappint of variable names (scores) to their numbers on the mesh
std::map<std::string, unsigned int> variable_map_; //!< mapping of variable names (scores) to their numbers on the mesh
libMesh::BoundingBox bbox_; //!< bounding box of the mesh
libMesh::Sphere bsphere_; //<! bounding sphere of the mesh
std::string eq_system_name_; //!< name of the equation system holding OpenMC results

View file

@ -28,7 +28,7 @@ namespace openmc {
namespace settings {
#ifdef LIBMESH
extern libMesh::LibMeshInit* LMI;
extern std::unique_ptr<libMesh::LibMeshInit> LMI;
#endif
// Boolean flags

View file

@ -143,7 +143,7 @@ int openmc_finalize()
#endif
#ifdef LIBMESH
delete settings::LMI;
std::unique_ptr<libMesh::LibMeshInit> LMI;
#endif
return 0;

View file

@ -73,7 +73,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
#endif
#ifdef LIBMESH
settings::LMI = new libMesh::LibMeshInit(argc, argv);
settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv);
#endif

View file

@ -2195,8 +2195,7 @@ void LibMesh::initialize() {
eq_system_name_ = "mesh_" + std::to_string(id_) + "_system";
equation_systems_ =
std::unique_ptr<libMesh::EquationSystems>(new libMesh::EquationSystems(*m_));
equation_systems_ = std::make_unique<libMesh::EquationSystems>(*m_);
libMesh::ExplicitSystem& eq_sys =
equation_systems_->add_system<libMesh::ExplicitSystem>(eq_system_name_);
@ -2307,7 +2306,6 @@ void LibMesh::write(const std::string& filename) const {
exo.write_discontinuous_exodusII(filename, *equation_systems_, &systems_out);
}
void
LibMesh::bins_crossed(const Particle* p,
std::vector<int>& bins,

View file

@ -38,7 +38,7 @@ namespace openmc {
namespace settings {
#ifdef LIBMESH
libMesh::LibMeshInit* LMI;
std::unique_ptr<libMesh::LibMeshInit> LMI;
#endif
// Default values for boolean flags