mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Relying on the libmesh communicator to create new mesh instances.
This commit is contained in:
parent
0abf803bb7
commit
fd00bd94b2
3 changed files with 7 additions and 3 deletions
|
|
@ -55,6 +55,7 @@ extern std::vector<std::unique_ptr<Mesh>> meshes;
|
|||
namespace settings {
|
||||
// used when creating new libMesh::Mesh instances
|
||||
extern std::unique_ptr<libMesh::LibMeshInit> libmesh_init;
|
||||
extern const libMesh::Parallel::Communicator* libmesh_comm;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ if (!settings::libmesh_init && !libMesh::initialized())
|
|||
// pass command line args, empty MPI communicator, and number of threads
|
||||
settings::libmesh_init = std::make_unique<libMesh::LibMeshInit>(argc, argv, 0, n_threads);
|
||||
#endif
|
||||
|
||||
settings::libmesh_comm = &(settings::libmesh_init->comm());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ std::vector<std::unique_ptr<Mesh>> meshes;
|
|||
#ifdef LIBMESH
|
||||
namespace settings {
|
||||
std::unique_ptr<libMesh::LibMeshInit> libmesh_init;
|
||||
const libMesh::Parallel::Communicator* libmesh_comm;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2150,11 +2151,11 @@ LibMesh::LibMesh(const std::string& filename)
|
|||
|
||||
void LibMesh::initialize()
|
||||
{
|
||||
if (!settings::libmesh_init) {
|
||||
fatal_error("Attempting to use an unstructured mesh without a libMesh::LibMeshInit object.");
|
||||
if (!settings::libmesh_comm) {
|
||||
fatal_error("Attempting to use an unstructured mesh without a libMesh communicator.");
|
||||
}
|
||||
|
||||
m_ = std::make_unique<libMesh::Mesh>(settings::libmesh_init->comm(), n_dimension_);
|
||||
m_ = std::make_unique<libMesh::Mesh>(*settings::libmesh_comm, n_dimension_);
|
||||
m_->read(filename_);
|
||||
m_->prepare_for_use();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue