From e332861aacacbccd40fdfaad1f946a7449fc780a Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot <15145274+bam241@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:43:59 +0200 Subject: [PATCH] adding cell name to volume calculation when possible (#2652) --- src/volume_calc.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index 0b1ea35750..b58da47508 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -534,8 +534,17 @@ int openmc_calculate_volumes() // Display domain volumes for (int j = 0; j < vol_calc.domain_ids_.size(); j++) { - write_message(4, "{}{}: {} +/- {} cm^3", domain_type, - vol_calc.domain_ids_[j], results[j].volume[0], results[j].volume[1]); + std::string cell_name {""}; + if (vol_calc.domain_type_ == VolumeCalculation::TallyDomain::CELL) { + int cell_idx = model::cell_map[vol_calc.domain_ids_[j]]; + cell_name = model::cells[cell_idx]->name(); + if (cell_name.size()) + cell_name.insert(0, " "); // prepend space for formatting + } + + write_message(4, "{}{}{}: {} +/- {} cm^3", domain_type, + vol_calc.domain_ids_[j], cell_name, results[j].volume[0], + results[j].volume[1]); } // Write volumes to HDF5 file