Some cleanup of libmesh control flow and file write during state_point.

This commit is contained in:
Patrick Shriwise 2020-04-28 00:11:06 -05:00
parent dd609b4191
commit 210d99aed3
4 changed files with 16 additions and 10 deletions

View file

@ -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()
#===============================================================================

View file

@ -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<libMesh::LibMeshInit>(argc, argv, n_threads, comm);
#else
settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv, n_threads);
#endif
settings::libmesh_comm = &(settings::LMI->comm());
}

View file

@ -2217,6 +2217,7 @@ void LibMesh::initialize() {
// bounding box for the mesh
bbox_ = libMesh::MeshTools::create_bounding_box(*m_);
}
int LibMesh::n_bins() const {

View file

@ -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,