def vol(self):
"""Construct cell volumes of the 3D model as 1d array."""
if getattr(self, '_vol', None) is None:
vh = self.h
# Compute cell volumes
if self.dim == 1:
self._vol = utils.mkvc(vh[0])
elif self.dim == 2:
# Cell sizes in each direction
self._vol = utils.mkvc(np.outer(vh[0], vh[1]))
elif self.dim == 3:
# Cell sizes in each direction
self._vol = utils.mkvc(
np.outer(utils.mkvc(np.outer(vh[0], vh[1])), vh[2])
)
return self._vol
评论列表
文章目录