diff --git a/openmc/capi/plot.py b/openmc/capi/plot.py index 22f1416b2..10a6aa280 100644 --- a/openmc/capi/plot.py +++ b/openmc/capi/plot.py @@ -178,6 +178,6 @@ _dll.openmc_id_map.restype = c_int _dll.openmc_id_map.errcheck = _error_handler def id_map(plot): - img_data = np.zeros((plot.pixels_[0], plot.pixels_[1], 2), dtype=np.dtype('int32')) + img_data = np.zeros((plot.pixels_[1], plot.pixels_[0], 2), dtype=np.dtype('int32')) out = _dll.openmc_id_map(POINTER(_Plot)(plot), img_data.ctypes.data_as(POINTER(c_int32))) return img_data diff --git a/src/plot.cpp b/src/plot.cpp index 6f7853bfb..9bf3656d9 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -988,7 +988,7 @@ extern "C" int openmc_id_map(const CPlot& pl, int* data_out) { double out_pixel = (pl.width_[1])/static_cast(height); IDData data; - data.resize({width, height, 2}); + data.resize({height, width, 2}); int in_i, out_i; double xyz[3]; @@ -1039,15 +1039,15 @@ extern "C" int openmc_id_map(const CPlot& pl, int* data_out) { j = p.n_coord - 1; if (level >=0) {j = level + 1;} if (!found_cell) { - data(x,y,0) = -1; - data(x,y,1) = -1; + data(y,x,0) = -1; + data(y,x,1) = -1; } else { Cell *c = model::cells[p.coord[j].cell]; - data(x,y,0) = c->id_; + data(y,x,0) = c->id_; if (c->type_ == FILL_UNIVERSE || p.material == MATERIAL_VOID) { - data(x,y,1) = -1; + data(y,x,1) = -1; } else { - data(x,y,1) = model::materials[p.material - 1]->id_; + data(y,x,1) = model::materials[p.material - 1]->id_; } } }