mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Promote moab instance from unique to shared ptr and check null before calling constructor
This commit is contained in:
parent
9ab4ae4755
commit
12bd847129
2 changed files with 10 additions and 7 deletions
|
|
@ -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<moab::Interface> mbi_; //!< MOAB instance
|
||||
std::shared_ptr<moab::Interface> mbi_; //!< MOAB instance
|
||||
unique_ptr<moab::AdaptiveKDTree> kdtree_; //!< MOAB KDTree instance
|
||||
vector<moab::Matrix3> baryc_data_; //!< Barycentric data for tetrahedra
|
||||
vector<std::string> tag_names_; //!< Names of score tags added to the mesh
|
||||
|
|
|
|||
15
src/mesh.cpp
15
src/mesh.cpp
|
|
@ -1621,13 +1621,16 @@ void MOABMesh::initialize() {
|
|||
void
|
||||
MOABMesh::create_interface()
|
||||
{
|
||||
// create MOAB instance
|
||||
mbi_ = make_unique<moab::Core>();
|
||||
if(mbi_ == nullptr){
|
||||
// create MOAB instance
|
||||
mbi_ = std::make_shared<moab::Core>();
|
||||
|
||||
// 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_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue