Changes in filter_mesh.cpp from PullRequest Inc. review

This commit is contained in:
Paul Romano 2020-04-23 09:23:34 -05:00
parent 89803284e5
commit 977ea5b602
2 changed files with 10 additions and 1 deletions

View file

@ -282,6 +282,7 @@ read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
}
}
// Perform final tasks -- reading S(a,b) tables, normalizing densities
for (auto& mat : model::materials) {
for (const auto& table : mat->thermal_tables_) {
// Get name of S(a,b) table
@ -408,6 +409,8 @@ void read_ce_cross_sections_xml()
} else {
// If no directory is listed in cross_sections.xml, by default select the
// directory in which the cross_sections.xml file resides
// TODO: Use std::filesystem functionality when C++17 is adopted
auto pos = filename.rfind("/");
if (pos == std::string::npos) {
// no '/' found, probably a Windows directory

View file

@ -1,6 +1,7 @@
#include "openmc/tallies/filter_mesh.h"
#include <fmt/core.h>
#include <gsl/gsl>
#include "openmc/capi.h"
#include "openmc/constants.h"
@ -54,7 +55,7 @@ MeshFilter::to_statepoint(hid_t filter_group) const
std::string
MeshFilter::text_label(int bin) const
{
auto& mesh = *model::meshes[mesh_];
auto& mesh = *model::meshes.at(mesh_);
return mesh.bin_label(bin);
}
@ -72,6 +73,11 @@ MeshFilter::set_mesh(int32_t mesh)
extern "C" int
openmc_mesh_filter_get_mesh(int32_t index, int32_t* index_mesh)
{
if (!index_mesh) {
set_errmsg("Mesh index argument is a null pointer.");
return OPENMC_E_INVALID_ARGUMENT;
}
// Make sure this is a valid index to an allocated filter.
if (int err = verify_filter(index)) return err;