Avoid error in Shannon entropy mesh doesn't have dimension specified

This commit is contained in:
Paul Romano 2019-11-08 17:50:22 -06:00
parent 2f68ab112d
commit 2ecd6446df
2 changed files with 5 additions and 3 deletions

View file

@ -298,4 +298,4 @@ if __name__ == '__main__':
move(fname, fname + '.original')
# Write a new geometry file.
tree.write(fname)
tree.write(fname, xml_declaration=True)

View file

@ -149,8 +149,10 @@ RegularMesh::RegularMesh(pugi::xml_node node)
"the <lower_left> coordinates on a tally mesh.");
}
// Set width and upper right coordinate
width_ = xt::eval((upper_right_ - lower_left_) / shape_);
// Set width
if (shape_.size() > 0) {
width_ = xt::eval((upper_right_ - lower_left_) / shape_);
}
} else {
fatal_error("Must specify either <upper_right> and <width> on a mesh.");
}