Small refactor of MOAB construction into its own method

This commit is contained in:
helen-brooks 2021-06-04 12:34:16 +01:00
parent c8db88dff2
commit 9ab4ae4755
2 changed files with 22 additions and 7 deletions

View file

@ -412,6 +412,9 @@ private:
// Methods
//! Create the MOAB interface pointer
void create_interface();
//! Find all intersections with faces of the mesh.
//
//! \param[in] start Staring location

View file

@ -1583,13 +1583,12 @@ MOABMesh::MOABMesh(const std::string& filename) {
}
void MOABMesh::initialize() {
// create MOAB instance
mbi_ = make_unique<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_);
}
// Create the MOAB interface and load data from file
create_interface();
// Initialise MOAB error code
moab::ErrorCode rval = moab::MB_SUCCESS;
// set member range of tetrahedral entities
rval = mbi_->get_entities_by_dimension(0, n_dimension_, ehs_);
@ -1619,6 +1618,19 @@ void MOABMesh::initialize() {
build_kdtree(ehs_);
}
void
MOABMesh::create_interface()
{
// create MOAB instance
mbi_ = make_unique<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_);
}
}
void
MOABMesh::build_kdtree(const moab::Range& all_tets)
{