Apply suggestions from code review

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Patrick Shriwise 2021-01-05 22:20:19 -06:00
parent 8fa814d142
commit 9eb53a1af9
5 changed files with 10 additions and 13 deletions

View file

@ -340,9 +340,8 @@ public:
#ifdef DAGMC
class MOABMesh : public UnstructuredMesh {
public:
// Constructors
MOABMesh() = default;
MOABMesh(pugi::xml_node);
MOABMesh(const std::string& filename);
@ -488,7 +487,6 @@ private:
#ifdef LIBMESH
class LibMesh : public UnstructuredMesh {
public:
// Constructors
LibMesh(pugi::xml_node node);

View file

@ -652,7 +652,7 @@ class UnstructuredMesh(MeshBase):
@library.setter
def library(self, lib):
cv.check_value('mesh_lib', lib, ('moab', 'libmesh'))
cv.check_value('Unstructured mesh library', lib, ('moab', 'libmesh'))
self._library = lib
@property
@ -706,7 +706,7 @@ class UnstructuredMesh(MeshBase):
def __repr__(self):
string = super().__repr__()
string += '{: <16}=\t{}\n'.format('\tFilename', self.filename)
string += '{0: <16}=\t{}\n'.format('\tMesh Library', self.mesh_lib)
string += '{: <16}=\t{}\n'.format('\tMesh Library', self.mesh_lib)
return string
def write_data_to_vtk(self, filename, datasets, volume_normalization=True):

View file

@ -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 LMI object needs to be provided also)
if (!settings::LMI && !libMesh::initialized())
{
if (!settings::LMI && !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

View file

@ -1780,7 +1780,7 @@ double MOABMesh::volume(int bin) const
std::string MOABMesh::library() const
{
return "moab";
return "moab";
}
double MOABMesh::tet_volume(moab::EntityHandle tet) const
@ -2138,7 +2138,7 @@ void LibMesh::initialize()
}
// create an equation system for storing values
eq_system_name_ = "mesh_" + std::to_string(id_) + "_system";
eq_system_name_ = fmt::format("mesh_{}_system", id_);
equation_systems_ = std::make_unique<libMesh::EquationSystems>(*m_);
libMesh::ExplicitSystem& eq_sys =
@ -2167,7 +2167,7 @@ void LibMesh::initialize()
Position
LibMesh::centroid(int bin) const
{
auto& elem = this->get_element_from_bin(bin);
const auto& elem = this->get_element_from_bin(bin);
auto centroid = elem.centroid();
return {centroid(0), centroid(1), centroid(2)};
}
@ -2302,7 +2302,7 @@ LibMesh::get_bin(Position r) const
int
LibMesh::get_bin_from_element(const libMesh::Elem* elem) const
{
int bin = elem->id() - first_element_->id();
int bin = elem->id() - first_element_->id();
if (bin >= n_bins() || bin < 0) {
fatal_error(fmt::format("Invalid bin: {}", bin));
}

View file

@ -55,8 +55,8 @@ openmc_statepoint_write(const char* filename, bool* write_source)
write_message("Creating state point " + filename_ + "...", 5);
#if defined(LIBMESH) || defined(DAGMC)
// write unstructured mesh tallies to VTK
write_unstructured_mesh_results();
// write unstructured mesh tallies to VTK
write_unstructured_mesh_results();
#endif
hid_t file_id;