From b982704d4fa030140c9468b9709f22ec50d67f4f Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 9 Dec 2020 13:10:53 -0600 Subject: [PATCH] Addressing @aprilnovak's PR comments. --- docs/source/io_formats/tallies.rst | 2 +- include/openmc/settings.h | 1 - src/initialize.cpp | 3 --- src/mesh.cpp | 11 ++++++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/source/io_formats/tallies.rst b/docs/source/io_formats/tallies.rst index 974a3d093b..8c1ad91b58 100644 --- a/docs/source/io_formats/tallies.rst +++ b/docs/source/io_formats/tallies.rst @@ -276,7 +276,7 @@ should be set to: :mesh: - The unique ID of a mesh to be tallied over.z + The unique ID of a mesh to be tallied over. :distribcell: The single cell which should be tallied uniquely for all instances. diff --git a/include/openmc/settings.h b/include/openmc/settings.h index af74a442fb..85468a7330 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/src/initialize.cpp b/src/initialize.cpp index d30581e066..5e4c86fd13 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -82,9 +82,6 @@ if (!settings::LMI && !libMesh::initialized()) #endif } -if (!settings::LMI) { - fatal_error("libMesh::LibMeshInit object isn't set."); -} #endif // Start total and initialization timer diff --git a/src/mesh.cpp b/src/mesh.cpp index f8ffc70a95..6f4fd73274 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -2123,10 +2123,19 @@ LibMesh::LibMesh(const std::string& filename) void LibMesh::initialize() { - m_ = std::make_unique(settings::LMI->comm(), 3); + if (!settings::LMI) { + fatal_error("Attempting to use an unstructured mesh without a libMesh::LibMeshInit object."); + } + + m_ = std::make_unique(settings::LMI->comm(), n_dimension_); m_->read(filename_); m_->prepare_for_use(); + // ensure that the loaded mesh is 3 dimensional + if(m_->spatial_dimension() != n_dimension_) { + fatal_error(fmt::format("Mesh file {} specified for use in an unstructured mesh is not a 3D mesh.", filename_)); + } + // create an equation system for storing values eq_system_name_ = "mesh_" + std::to_string(id_) + "_system";