From fb6984e0a75a759badd50db0eb169f3de2970a8f Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 25 Aug 2022 12:50:56 +0100 Subject: [PATCH] added numbers for size --- openmc/mesh.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openmc/mesh.py b/openmc/mesh.py index af830158cf..54d7ba950a 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -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)