mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Incorporate cell instance levels into plotting. Return C_NONE if it is not a distributed cell.
This commit is contained in:
parent
4e3350ebcf
commit
39c52dcf94
2 changed files with 6 additions and 1 deletions
|
|
@ -66,11 +66,16 @@ bool check_cell_overlap(Particle& p, bool error)
|
|||
//==============================================================================
|
||||
|
||||
int cell_instance_at_level(const Particle& p, int level) {
|
||||
// throw error if the requested level is too deep for the geometry
|
||||
if (level > p.n_coord()) {
|
||||
fatal_error(fmt::format("Cell instance at level {} requested, but only {} levels exist in the model.", level, p.n_coord()));
|
||||
}
|
||||
|
||||
// determine the cell instance
|
||||
Cell& c {*model::cells[p.coord(level).cell]};
|
||||
|
||||
if (c.distribcell_index_ == C_NONE) return C_NONE;
|
||||
|
||||
int instance = 0;
|
||||
for (int i = 0; i < level; i++) {
|
||||
const auto& c_i {*model::cells[p.coord(i).cell]};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ IdData::set_value(size_t y, size_t x, const Particle& p, int level) {
|
|||
data_(y, x, 1) = NOT_FOUND;
|
||||
} else {
|
||||
data_(y, x, 0) = model::cells.at(p.coord(level).cell)->id_;
|
||||
data_(y, x, 1) = p.cell_instance();
|
||||
data_(y, x, 1) = level == p.n_coord() - 1 ? p.cell_instance() : cell_instance_at_level(p, level);
|
||||
}
|
||||
|
||||
// set material data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue