diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index 1bac011e6..49d9dd872 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -506,7 +506,7 @@ private: moab::Range ehs_; //!< Range of tetrahedra EntityHandle's in the mesh moab::EntityHandle tetset_; //!< EntitySet containing all tetrahedra moab::EntityHandle kdtree_root_; //!< Root of the MOAB KDTree - unique_ptr mbi_; //!< MOAB instance + std::shared_ptr mbi_; //!< MOAB instance unique_ptr kdtree_; //!< MOAB KDTree instance vector baryc_data_; //!< Barycentric data for tetrahedra vector tag_names_; //!< Names of score tags added to the mesh diff --git a/src/mesh.cpp b/src/mesh.cpp index e81f2c82d..623589115 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1621,13 +1621,16 @@ void MOABMesh::initialize() { void MOABMesh::create_interface() { - // create MOAB instance - mbi_ = make_unique(); + if(mbi_ == nullptr){ + // create MOAB instance + mbi_ = std::make_shared(); + + // load unstructured mesh file + moab::ErrorCode rval = mbi_->load_file(filename_.c_str()); + if (rval != moab::MB_SUCCESS) { + fatal_error("Failed to load the unstructured mesh file: " + filename_); + } - // load unstructured mesh file - moab::ErrorCode rval = mbi_->load_file(filename_.c_str()); - if (rval != moab::MB_SUCCESS) { - fatal_error("Failed to load the unstructured mesh file: " + filename_); } }