mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #2307 from eepeterson/change_centroid_shapes
changing centroid/vertex shape
This commit is contained in:
commit
acb54281da
1 changed files with 8 additions and 5 deletions
|
|
@ -172,10 +172,11 @@ class StructuredMesh(MeshBase):
|
|||
-------
|
||||
vertices : numpy.ndarray
|
||||
Returns a numpy.ndarray representing the coordinates of the mesh
|
||||
vertices with a shape equal to (dim1 + 1, ..., dimn + 1, ndim).
|
||||
vertices with a shape equal to (ndim, dim1 + 1, ..., dimn + 1). Can be
|
||||
unpacked along the first dimension with xx, yy, zz = mesh.vertices.
|
||||
|
||||
"""
|
||||
return np.stack(np.meshgrid(*self._grids, indexing='ij'), axis=-1)
|
||||
return np.stack(np.meshgrid(*self._grids, indexing='ij'), axis=0)
|
||||
|
||||
@property
|
||||
def centroids(self):
|
||||
|
|
@ -185,13 +186,15 @@ class StructuredMesh(MeshBase):
|
|||
-------
|
||||
centroids : numpy.ndarray
|
||||
Returns a numpy.ndarray representing the mesh element centroid
|
||||
coordinates with a shape equal to (dim1, ..., dimn, ndim).
|
||||
coordinates with a shape equal to (ndim, dim1, ..., dimn). Can be
|
||||
unpacked along the first dimension with xx, yy, zz = mesh.centroids.
|
||||
|
||||
|
||||
"""
|
||||
ndim = self.n_dimension
|
||||
vertices = self.vertices
|
||||
s0 = (slice(0, -1),)*ndim + (slice(None),)
|
||||
s1 = (slice(1, None),)*ndim + (slice(None),)
|
||||
s0 = (slice(None),) + (slice(0, -1),)*ndim
|
||||
s1 = (slice(None),) + (slice(1, None),)*ndim
|
||||
return (vertices[s0] + vertices[s1]) / 2
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue