mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Fix get_pandas_dataframe for non-3D mesh surface
This commit is contained in:
parent
90c3e37180
commit
0ed8bfa792
1 changed files with 24 additions and 14 deletions
|
|
@ -817,40 +817,50 @@ class MeshSurfaceFilter(MeshFilter):
|
|||
# Find mesh dimensions - use 3D indices for simplicity
|
||||
if len(self.mesh.dimension) == 3:
|
||||
nx, ny, nz = self.mesh.dimension
|
||||
n_surfs = 12
|
||||
elif len(self.mesh.dimension) == 2:
|
||||
nx, ny = self.mesh.dimension
|
||||
nz = 1
|
||||
n_surfs = 8
|
||||
else:
|
||||
nx = self.mesh.dimension
|
||||
ny = nz = 1
|
||||
n_surfs = 4
|
||||
|
||||
# Generate multi-index sub-column for x-axis
|
||||
filter_bins = np.arange(1, nx + 1)
|
||||
repeat_factor = 12 * stride
|
||||
repeat_factor = n_surfs * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'x')] = filter_bins
|
||||
|
||||
# Generate multi-index sub-column for y-axis
|
||||
filter_bins = np.arange(1, ny + 1)
|
||||
repeat_factor = 12 * nx * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'y')] = filter_bins
|
||||
if (len(self.mesh.dimension) > 1):
|
||||
filter_bins = np.arange(1, ny + 1)
|
||||
repeat_factor = n_surfs * nx * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'y')] = filter_bins
|
||||
|
||||
# Generate multi-index sub-column for z-axis
|
||||
filter_bins = np.arange(1, nz + 1)
|
||||
repeat_factor = 12 * nx * ny * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'z')] = filter_bins
|
||||
if (len(self.mesh.dimension) > 2):
|
||||
filter_bins = np.arange(1, nz + 1)
|
||||
repeat_factor = n_surfs * nx * ny * stride
|
||||
filter_bins = np.repeat(filter_bins, repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'z')] = filter_bins
|
||||
|
||||
# Generate multi-index sub-column for surface
|
||||
repeat_factor = stride
|
||||
filter_bins = np.repeat(_CURRENT_NAMES, repeat_factor)
|
||||
if len(self.mesh.dimension) == 3:
|
||||
filter_bins = np.repeat(_CURRENT_NAMES, repeat_factor)
|
||||
elif len(self.mesh.dimension) == 2:
|
||||
filter_bins = np.repeat(_CURRENT_NAMES[:8], repeat_factor)
|
||||
else:
|
||||
filter_bins = np.repeat(_CURRENT_NAMES[:4], repeat_factor)
|
||||
tile_factor = data_size // len(filter_bins)
|
||||
filter_bins = np.tile(filter_bins, tile_factor)
|
||||
filter_dict[(mesh_key, 'surf')] = filter_bins
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue