def get_cell_mask(self, subdomain=None):
if subdomain is None:
# http://stackoverflow.com/a/42392791/353337
return numpy.s_[:]
if subdomain.is_boundary_only:
# There are no boundary cells
return numpy.array([])
if subdomain not in self.subdomains:
self._mark_vertices(subdomain)
is_in = self.subdomains[subdomain]['vertices'][self.idx_hierarchy]
# Take `all()` over all axes except the last one (cell_ids).
n = len(is_in.shape)
return numpy.all(is_in, axis=tuple(range(n-1)))
评论列表
文章目录