mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Making sure score data is removed from the unstructured mesh.
This commit is contained in:
parent
4ce7df9f54
commit
0bcc9f2c06
3 changed files with 31 additions and 0 deletions
|
|
@ -298,6 +298,9 @@ public:
|
|||
//! Add a score to the mesh instance
|
||||
void add_score(std::string score) const;
|
||||
|
||||
//! Remove a score from the mesh instance
|
||||
void remove_score(std::string score) const;
|
||||
|
||||
//! Set data for a score
|
||||
void set_score_data(const std::string& score,
|
||||
std::vector<double> values,
|
||||
|
|
|
|||
24
src/mesh.cpp
24
src/mesh.cpp
|
|
@ -2015,6 +2015,30 @@ UnstructuredMesh::add_score(std::string score) const {
|
|||
auto score_tags = this->get_score_tags(score);
|
||||
}
|
||||
|
||||
void UnstructuredMesh::remove_score(std::string score) const {
|
||||
moab::ErrorCode rval;
|
||||
moab::Tag tag;
|
||||
auto value_name = score + "_mean";
|
||||
rval = mbi_->tag_get_handle(value_name.c_str(), tag);
|
||||
if (rval != moab::MB_SUCCESS) return;
|
||||
|
||||
rval = mbi_->tag_delete(tag);
|
||||
if (rval != moab::MB_SUCCESS) {
|
||||
auto msg = fmt::format("Failed to delete mesh tag for the score {}"
|
||||
" on unstructured mesh {}", score, id_);
|
||||
fatal_error(msg);
|
||||
}
|
||||
|
||||
auto std_dev_name = score + "_std_dev";
|
||||
rval = mbi_->tag_get_handle(std_dev_name.c_str(), tag);
|
||||
if (rval != moab::MB_SUCCESS) {
|
||||
auto msg = fmt::format("Std. Dev. mesh tag does not exist for the score {}"
|
||||
" on unstructured mesh {}", score, id_);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
UnstructuredMesh::set_score_data(const std::string& score,
|
||||
std::vector<double> values,
|
||||
|
|
|
|||
|
|
@ -687,6 +687,8 @@ void read_source_bank(hid_t group_id)
|
|||
void write_unstructured_mesh_results() {
|
||||
|
||||
for (auto& tally : model::tallies) {
|
||||
|
||||
std::vector<std::string> tally_scores;
|
||||
for (auto filter_idx : tally->filters()) {
|
||||
auto& filter = model::tally_filters[filter_idx];
|
||||
if (filter->type() != "mesh") continue;
|
||||
|
|
@ -754,6 +756,8 @@ void write_unstructured_mesh_results() {
|
|||
w);
|
||||
// Write the unstructured mesh and data to file
|
||||
umesh->write(filename);
|
||||
|
||||
for (const auto& score : tally_scores) { umesh->remove_score(score); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue