mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Rebase updates.
This commit is contained in:
parent
a371f402a2
commit
1f13efecdb
3 changed files with 13 additions and 14 deletions
|
|
@ -21,7 +21,6 @@ namespace openmc {
|
|||
|
||||
class Plot;
|
||||
|
||||
|
||||
namespace model {
|
||||
|
||||
extern std::vector<Plot> plots; //!< Plot instance container
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class _Plot(Structure):
|
|||
return self.__repr__()
|
||||
|
||||
|
||||
_dll.openmc_id_map.argtypes= [POINTER(_Plot),]
|
||||
_dll.openmc_id_map.argtypes= [POINTER(_Plot),POINTER(c_int32)]
|
||||
_dll.openmc_id_map.restype = c_int
|
||||
_dll.openmc_id_map.errcheck = _error_handler
|
||||
|
||||
|
|
@ -231,5 +231,6 @@ def id_map(plot):
|
|||
|
||||
"""
|
||||
img_data = np.zeros((plot.vRes, plot.hRes, 2), dtype=np.dtype('int32'))
|
||||
print("Calling openmc id map")
|
||||
_dll.openmc_id_map(POINTER(_Plot)(plot), img_data.ctypes.data_as(POINTER(c_int32)))
|
||||
return img_data
|
||||
|
|
|
|||
23
src/plot.cpp
23
src/plot.cpp
|
|
@ -982,7 +982,7 @@ RGBColor random_color() {
|
|||
|
||||
extern "C" int openmc_id_map(void* slice, int32_t* data_out) {
|
||||
|
||||
auto* sl = static_cast<Slice*>(slice);
|
||||
auto sl = static_cast<Slice*>(slice);
|
||||
|
||||
size_t width = sl->pixels_[0];
|
||||
size_t height = sl->pixels_[1];
|
||||
|
|
@ -1024,33 +1024,32 @@ extern "C" int openmc_id_map(void* slice, int32_t* data_out) {
|
|||
#pragma omp parallel
|
||||
{
|
||||
Particle p;
|
||||
p.initialize();
|
||||
std::copy(xyz, xyz+3, p.coord[0].xyz);
|
||||
std::copy(dir, dir+3, p.coord[0].uvw);
|
||||
p.coord[0].universe = model::root_universe;
|
||||
p.coord_[0].r = xyz;
|
||||
p.coord_[0].u = dir;
|
||||
p.coord_[0].universe = model::root_universe;
|
||||
int level = sl->level_;
|
||||
int j{};
|
||||
|
||||
#pragma omp for
|
||||
for (int y = 0; y < height; y++) {
|
||||
p.coord[0].xyz[out_i] = xyz[out_i] - out_pixel * y;
|
||||
p.coord_[0].r[out_i] = xyz[out_i] - out_pixel * y;
|
||||
for (int x = 0; x < width; x++) {
|
||||
p.coord[0].xyz[in_i] = xyz[in_i] + in_pixel * x;
|
||||
p.n_coord = 1;
|
||||
p.coord_[0].r[in_i] = xyz[in_i] + in_pixel * x;
|
||||
p.n_coord_ = 1;
|
||||
// local variables
|
||||
bool found_cell = find_cell(&p, 0);
|
||||
j = p.n_coord - 1;
|
||||
j = p.n_coord_ - 1;
|
||||
if (level >=0) {j = level + 1;}
|
||||
if (!found_cell) {
|
||||
data(y,x,0) = -1;
|
||||
data(y,x,1) = -1;
|
||||
} else {
|
||||
Cell *c = model::cells[p.coord[j].cell];
|
||||
Cell *c = model::cells[p.coord_[j].cell].get();
|
||||
data(y,x,0) = c->id_;
|
||||
if (c->type_ == FILL_UNIVERSE || p.material == MATERIAL_VOID) {
|
||||
if (c->type_ == FILL_UNIVERSE || p.material_ == MATERIAL_VOID) {
|
||||
data(y,x,1) = -1;
|
||||
} else {
|
||||
data(y,x,1) = model::materials[p.material - 1]->id_;
|
||||
data(y,x,1) = model::materials[p.material_]->id_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue