Update the cell map in openmc_cell_set_id

This commit is contained in:
Sterling Harper 2018-10-19 17:17:59 -04:00
parent 31b92723c6
commit 4e1ed5799d
2 changed files with 13 additions and 10 deletions

View file

@ -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_;}

View file

@ -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)