Allow Mesh.volumes property for 1D and 2D RegularMesh (#3914)

This commit is contained in:
Jonathan Shimwell 2026-05-06 16:07:35 +01:00 committed by GitHub
parent 368ea069ca
commit e542b2f035
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -268,10 +268,11 @@ class MeshBase(IDManagerMixin, ABC):
return string
def _volume_dim_check(self):
if self.n_dimension != 3 or \
any([d == 0 for d in self.dimension]):
raise RuntimeError(f'Mesh {self.id} is not 3D. '
'Volumes cannot be provided.')
if any(d == 0 for d in self.dimension):
raise RuntimeError(
f'Mesh {self.id} has a zero-size dimension. '
'Volumes cannot be provided.'
)
@classmethod
def from_hdf5(cls, group: h5py.Group):