mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
added numbers for size
This commit is contained in:
parent
2805060ddd
commit
fb6984e0a7
1 changed files with 6 additions and 5 deletions
|
|
@ -217,7 +217,7 @@ class StructuredMesh(MeshBase):
|
|||
Raises
|
||||
------
|
||||
RuntimeError
|
||||
When the size of a dataset doesn't match the number of cells
|
||||
When the size of a dataset doesn't match the number of mesh cells
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -229,13 +229,14 @@ class StructuredMesh(MeshBase):
|
|||
from vtk.util import numpy_support as nps
|
||||
|
||||
# check that the data sets are appropriately sized
|
||||
errmsg = "The size of the dataset {} should be equal to the number of cells"
|
||||
errmsg = "The size of the dataset {} ({}) should be equal to the number of mesh cells ({})"
|
||||
for label, dataset in datasets.items():
|
||||
if isinstance(dataset, np.ndarray):
|
||||
if not dataset.size == self.dimension[0] * self.dimension[1]* self.dimension[2]:
|
||||
raise RuntimeError(errmsg.format(label))
|
||||
num_cells = self.dimension[0] * self.dimension[1] * self.dimension[2]
|
||||
if not dataset.size == num_cells:
|
||||
raise RuntimeError(errmsg.format(label, dataset.size, num_cells))
|
||||
else:
|
||||
if len(dataset) == self.dimension[0] * self.dimension[1]* self.dimension[2]:
|
||||
if len(dataset) == self.dimension[0] * self.dimension[1] * self.dimension[2]:
|
||||
raise RuntimeError(errmsg.format(label))
|
||||
cv.check_type('label', label, str)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue