Commit 4a05f59b authored by Lukas Platz's avatar Lukas Platz
Browse files

domain_tuple: add total_volume property

parent 156c9d79
Pipeline #62398 passed with stages
in 7 minutes and 2 seconds
......@@ -125,6 +125,13 @@ class DomainTuple(object):
return self._size
def total_volume(self):
res = 1.
for d in self._dom:
res *= d.total_volume
return res
def axes(self):
"""tuple of tuple of int : axis indices of the underlying domains"""
......@@ -273,11 +273,13 @@ class Field(object):
the total volume of the requested sub-domain.
if spaces is None:
return self._domain.total_volume
if np.isscalar(spaces):
return self._domain[spaces].total_volume
if spaces is None:
spaces = range(len(self._domain))
# tuple of spaces given
res = 1.
for i in spaces:
res *= self._domain[i].total_volume
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment