mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Enforcing shape when settings lower/upper ww bounds
This commit is contained in:
parent
5ae7617963
commit
2909182443
1 changed files with 29 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ from xml.etree import ElementTree as ET
|
|||
import numpy as np
|
||||
|
||||
from openmc.filter import _PARTICLES
|
||||
from openmc.mesh import MeshBase
|
||||
from openmc.mesh import MeshBase, UnstructuredMesh
|
||||
import openmc.checkvalue as cv
|
||||
|
||||
from ._xml import get_text
|
||||
|
|
@ -178,14 +178,28 @@ class WeightWindows(IDManagerMixin):
|
|||
cv.check_type('Energy bounds', bnds, Iterable, Real)
|
||||
self._energy_bounds = np.array(bnds)
|
||||
|
||||
@property
|
||||
def num_energy_bins(self):
|
||||
return self.energy_bounds.size - 1
|
||||
|
||||
@property
|
||||
def lower_ww_bounds(self):
|
||||
return self._lower_ww_bounds
|
||||
|
||||
@lower_ww_bounds.setter
|
||||
def lower_ww_bounds(self, bounds):
|
||||
cv.check_type('Lower WW bounds', bounds, Iterable, Real)
|
||||
self._lower_ww_bounds = np.array(bounds)
|
||||
cv.check_iterable_type('Lower WW bounds',
|
||||
bounds,
|
||||
Real,
|
||||
min_depth=1,
|
||||
max_depth=4)
|
||||
# reshape data according to mesh and energy bins
|
||||
bounds = np.asarray(bounds)
|
||||
if isinstance(self.mesh, UnstructuredMesh):
|
||||
bounds.reshape(-1, self.num_energy_bins)
|
||||
else:
|
||||
bounds.reshape(*self.mesh.dimension, self.num_energy_bins)
|
||||
self._lower_ww_bounds = bounds
|
||||
|
||||
@property
|
||||
def upper_ww_bounds(self):
|
||||
|
|
@ -193,8 +207,18 @@ class WeightWindows(IDManagerMixin):
|
|||
|
||||
@upper_ww_bounds.setter
|
||||
def upper_ww_bounds(self, bounds):
|
||||
cv.check_type('Upper WW bounds', bounds, Iterable, Real)
|
||||
self._upper_ww_bounds = np.array(bounds)
|
||||
cv.check_iterable_type('Upper WW bounds',
|
||||
bounds,
|
||||
Real,
|
||||
min_depth=1,
|
||||
max_depth=4)
|
||||
# reshape data according to mesh and energy bins
|
||||
bounds = np.asarray(bounds)
|
||||
if isinstance(self.mesh, UnstructuredMesh):
|
||||
bounds.reshape(-1, self.num_energy_bins)
|
||||
else:
|
||||
bounds.reshape(*self.mesh.dimension, self.num_energy_bins)
|
||||
self._upper_ww_bounds = bounds
|
||||
|
||||
@property
|
||||
def survival_ratio(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue