@@ -153,11 +153,17 @@ class MeshBase(IDManagerMixin, ABC):
153153 Unique identifier for the mesh
154154 name : str
155155 Name of the mesh
156+ lower_left : Iterable of float
157+ The lower-left coordinates
158+ upper_right : Iterable of float
159+ The upper-right coordinates
156160 bounding_box : openmc.BoundingBox
157161 Axis-aligned bounding box of the mesh as defined by the upper-right and
158162 lower-left coordinates.
159163 indices : Iterable of tuple
160164 An iterable of mesh indices for each mesh element, e.g. [(1, 1, 1), (2, 1, 1), ...]
165+ n_elements : int
166+ Number of elements in the mesh
161167 """
162168
163169 next_id = 1
@@ -179,6 +185,16 @@ def name(self, name: str):
179185 self ._name = name
180186 else :
181187 self ._name = ''
188+
189+ @property
190+ @abstractmethod
191+ def lower_left (self ):
192+ pass
193+
194+ @property
195+ @abstractmethod
196+ def upper_right (self ):
197+ pass
182198
183199 @property
184200 def bounding_box (self ) -> openmc .BoundingBox :
@@ -188,6 +204,11 @@ def bounding_box(self) -> openmc.BoundingBox:
188204 @abstractmethod
189205 def indices (self ):
190206 pass
207+
208+ @property
209+ @abstractmethod
210+ def n_elements (self ):
211+ pass
191212
192213 def __repr__ (self ):
193214 string = type (self ).__name__ + '\n '
@@ -557,10 +578,19 @@ def centroids(self):
557578 s0 = (slice (0 , - 1 ),)* ndim + (slice (None ),)
558579 s1 = (slice (1 , None ),)* ndim + (slice (None ),)
559580 return (vertices [s0 ] + vertices [s1 ]) / 2
581+
582+ @property
583+ def n_elements (self ):
584+ return np .prod (self .dimension )
560585
561586 @property
562587 def num_mesh_cells (self ):
563- return np .prod (self .dimension )
588+ warnings .warn (
589+ "The 'num_mesh_cells' attribute is deprecated and will be removed in a future version. "
590+ "Use 'n_elements' instead." ,
591+ FutureWarning , stacklevel = 2
592+ )
593+ return self .n_elements
564594
565595 def write_data_to_vtk (self ,
566596 filename : PathLike ,
@@ -822,10 +852,10 @@ def _check_vtk_dataset(self, label: str, dataset: np.ndarray):
822852 """
823853 cv .check_type ('data label' , label , str )
824854
825- if dataset .size != self .num_mesh_cells :
855+ if dataset .size != self .n_elements :
826856 raise ValueError (
827857 f"The size of the dataset '{ label } ' ({ dataset .size } ) should be"
828- f" equal to the number of mesh cells ({ self .num_mesh_cells } )"
858+ f" equal to the number of mesh cells ({ self .n_elements } )"
829859 )
830860
831861 # accept a flat array as-is, assuming it is in the correct order
0 commit comments