From 1262bcde7d0db05c4ee68e047727764a10a681b4 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 7 Apr 2021 17:36:02 -0500 Subject: [PATCH] Apply @paulromano's suggestions from code review Co-authored-by: Paul Romano --- include/openmc/mesh.h | 12 +++++------- src/initialize.cpp | 3 +-- src/mesh.cpp | 12 ++++++------ tools/ci/gha-install-libmesh.sh | 12 +++++------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index cc0169ce0..e9519ca0a 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -329,16 +329,14 @@ public: void to_hdf5(hid_t group) const override; -private: - - //! Setup method for the mesh. Builds data structures, - //! sets up element mapping, creates bounding boxes, etc. - virtual void initialize() = 0; - -public: // Data members bool output_ {true}; //!< Write tallies onto the unstructured mesh at the end of a run std::string filename_; //!< Path to unstructured mesh file + +private: + //! Setup method for the mesh. Builds data structures, + //! sets up element mapping, creates bounding boxes, etc. + virtual void initialize() = 0; }; #ifdef DAGMC diff --git a/src/initialize.cpp b/src/initialize.cpp index f6e927b68..e84678feb 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -69,8 +69,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm) // initialize libMesh if it hasn't been initialized already // (if initialized externally, the libmesh_init object needs to be provided also) -if (!settings::libmesh_init && !libMesh::initialized()) -{ +if (!settings::libmesh_init && !libMesh::initialized()) { #ifdef OPENMC_MPI // pass command line args, empty MPI communicator, and number of threads. // Because libMesh was not initialized, we assume that OpenMC is the primary diff --git a/src/mesh.cpp b/src/mesh.cpp index 333a5dc33..19cbeae10 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -192,7 +192,7 @@ UnstructuredMesh::UnstructuredMesh(pugi::xml_node node) : Mesh(node) { void UnstructuredMesh::surface_bins_crossed(const Particle& p, std::vector& bins) const { - throw std::runtime_error{"Unstructured mesh surface tallies are not implemented."}; + fatal_error("Unstructured mesh surface tallies are not implemented."); } std::string @@ -210,7 +210,7 @@ UnstructuredMesh::to_hdf5(hid_t group) const write_dataset(mesh_group, "library", this->library()); // write volume of each element std::vector tet_vols; - xt::xtensor centroids({(size_t)this->n_bins(), 3}); + xt::xtensor centroids({static_cast(this->n_bins()), 3}); for (int i = 0; i < this->n_bins(); i++) { tet_vols.emplace_back(this->volume(i)); auto c = this->centroid(i); @@ -2182,9 +2182,9 @@ void LibMesh::initialize() #endif for (int i = 0; i < n_threads; i++) { - pl_.emplace_back(m_->sub_point_locator()); - pl_.back()->set_contains_point_tol(FP_COINCIDENT); - pl_.back()->enable_out_of_mesh_mode(); + pl_.emplace_back(m_->sub_point_locator()); + pl_.back()->set_contains_point_tol(FP_COINCIDENT); + pl_.back()->enable_out_of_mesh_mode(); } // store first element in the mesh to use as an offset for bin indices @@ -2303,7 +2303,7 @@ LibMesh::bins_crossed(const Particle& p, std::vector& lengths) const { // TODO: Implement triangle crossings here - throw std::runtime_error{"Tracklength tallies on libMesh instances are not implemented."}; + fatal_error("Tracklength tallies on libMesh instances are not implemented."); } int diff --git a/tools/ci/gha-install-libmesh.sh b/tools/ci/gha-install-libmesh.sh index 084e85686..132963820 100755 --- a/tools/ci/gha-install-libmesh.sh +++ b/tools/ci/gha-install-libmesh.sh @@ -2,23 +2,21 @@ #!/bin/bash set -ex -CURRENT_DIR=$(pwd) - # libMESH install -cd $HOME +pushd $HOME mkdir LIBMESH && cd LIBMESH git clone https://github.com/libmesh/libmesh -b v1.6.0 --recurse-submodules mkdir build && cd build export METHODS="opt" if [[ $MPI == 'y' ]]; then -../libmesh/configure --prefix=$HOME/LIBMESH CXX=mpicxx CC=mpicc FC=mpifort F77=mpif77 \ ---enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack + ../libmesh/configure --prefix=$HOME/LIBMESH CXX=mpicxx CC=mpicc FC=mpifort F77=mpif77 \ + --enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack else -../libmesh/configure --prefix=$HOME/LIBMESH --enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack --disable-mpi + ../libmesh/configure --prefix=$HOME/LIBMESH --enable-exodus --disable-netcdf-4 --disable-eigen --disable-lapack --disable-mpi fi make -j4 install export LIBMESH_PC=$HOME/LIBMESH/lib/pkgconfig/ rm -rf $HOME/LIBMESH/build -cd $CURRENT_DIR +popd