diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bd7988289..e4d81b2327 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ else() #=============================================================================== if(libmesh) find_package(LIBMESH REQUIRED) + list(APPEND cxxflags ${LIBMESH_CFLAGS}) endif() #=============================================================================== @@ -415,11 +416,11 @@ if(dagmc) endif() if(libmesh) -if (debug) - target_link_libraries(libopenmc PkgConfig::LIBMESH_DEVEL) -else() - target_link_libraries(libopenmc PkgConfig::LIBMESH) -endif() + if (debug) + target_link_libraries(libopenmc PkgConfig::LIBMESH_DEVEL) + else() + target_link_libraries(libopenmc PkgConfig::LIBMESH) + endif() endif() #=============================================================================== diff --git a/src/initialize.cpp b/src/initialize.cpp index 7ec7ab0f5f..3260e051ee 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -70,7 +70,11 @@ int openmc_init(int argc, char* argv[], const void* intracomm) // initialize libmesh if (!settings::LMI && !libMesh::initialized()) { +#ifdef OPENMC_MPI + settings::LMI = std::make_unique(argc, argv, n_threads, comm); +#else settings::LMI = std::make_unique(argc, argv, n_threads); +#endif settings::libmesh_comm = &(settings::LMI->comm()); } diff --git a/src/mesh.cpp b/src/mesh.cpp index 7306d40f08..3b6891907f 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -2217,6 +2217,7 @@ void LibMesh::initialize() { // bounding box for the mesh bbox_ = libMesh::MeshTools::create_bounding_box(*m_); + } int LibMesh::n_bins() const { diff --git a/src/state_point.cpp b/src/state_point.cpp index 0eb7334b65..29430ed6cb 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -54,6 +54,11 @@ openmc_statepoint_write(const char* filename, bool* write_source) // Write message write_message("Creating state point " + filename_ + "...", 5); +#if defined(LIBMESH) || defined(DAGMC) + // write unstructured mesh tallies to VTK if possible + write_unstructured_mesh_results(); +#endif + hid_t file_id; if (mpi::master) { // Create statepoint file @@ -167,11 +172,6 @@ openmc_statepoint_write(const char* filename, bool* write_source) tally_ids.push_back(tally->id_); write_attribute(tallies_group, "ids", tally_ids); -#if defined(LIBMESH) || defined(DAGMC) - // write unstructured mesh tallies to VTK if possible - write_unstructured_mesh_results(); -#endif - // Write all tally information except results for (const auto& tally : model::tallies) { hid_t tally_group = create_group(tallies_group,