Adjusting how the LibMesh comm is stored.

This commit is contained in:
Patrick Shriwise 2020-04-24 17:22:54 -05:00
parent 7323ae526f
commit b54bbad9d9
4 changed files with 10 additions and 3 deletions

View file

@ -29,6 +29,7 @@ namespace settings {
#ifdef LIBMESH
extern std::unique_ptr<libMesh::LibMeshInit> LMI;
extern libMesh::Parallel::Communicator* libmesh_comm;
#endif
// Boolean flags

View file

@ -68,7 +68,11 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
#endif
// initialize libmesh
if (!settings::LMI) settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv, n_threads);
if (!settings::LMI && !libMesh::initialized())
{
settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv, n_threads);
settings::libmesh_comm = &(settings::LMI->comm());
}
#endif

View file

@ -2190,10 +2190,11 @@ LibMesh::centroid(int bin) const {
std::string LibMesh::library() const { return "libmesh"; }
void LibMesh::initialize() {
// always 3 for unstructured meshes
// always 3 for unstructured meshes
n_dimension_ = 3;
m_ = std::unique_ptr<libMesh::Mesh>(new libMesh::Mesh(settings::LMI->comm(), 3));
m_ = std::make_unique<libMesh::Mesh>(*settings::libmesh_comm, 3);
m_->read(filename_);
m_->prepare_for_use();

View file

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