From 4e1ed5799d48852d6a90fa7ba97bc00dbfae5431 Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Fri, 19 Oct 2018 17:17:59 -0400 Subject: [PATCH] Update the cell map in openmc_cell_set_id --- src/cell.cpp | 15 +++++++++++++-- src/cmfd_data.F90 | 8 -------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/cell.cpp b/src/cell.cpp index 8896cde98..65582d780 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -650,7 +650,6 @@ read_cells(pugi::xml_node* node) } // Fill the cell map. - // TODO: update this map when openmc_extend_cells is called for (int i = 0; i < cells.size(); i++) { int32_t id = cells[i]->id_; auto search = cell_map.find(id); @@ -780,7 +779,19 @@ extern "C" { int32_t cell_id(Cell* c) {return c->id_;} - void cell_set_id(Cell* c, int32_t id) {c->id_ = id;} + void + cell_set_id(Cell* c, int32_t id) + { + c->id_ = id; + + // Find the index of this cell and update the cell map. + for (int i = 0; i < cells.size(); i++) { + if (cells[i] == c) { + cell_map[id] = i; + break; + } + } + } int cell_type(Cell* c) {return c->type_;} diff --git a/src/cmfd_data.F90 b/src/cmfd_data.F90 index b090c6394..f2fb4dc26 100644 --- a/src/cmfd_data.F90 +++ b/src/cmfd_data.F90 @@ -82,14 +82,6 @@ contains real(8) :: flux ! temp variable for flux type(RegularMesh) :: m ! pointer for mesh object - interface - function mesh_filter_get_mesh(filt) result(index_mesh) bind(C) - import C_PTR, C_INT - type(C_PTR), value :: filt - integer(C_INT) :: index_mesh - end function mesh_filter_get_mesh - end interface - ! Extract spatial and energy indices from object nx = cmfd % indices(1) ny = cmfd % indices(2)