Skip to content
Snippets Groups Projects
Commit ca8818d9 authored by Laurin Söding's avatar Laurin Söding
Browse files

cleanup index2volume of HPRadialGridAtLevel

parent 19f5eae4
No related branches found
No related tags found
1 merge request!983BrokenLogarithmicGrid & minor fixes and adjustments
...@@ -366,11 +366,10 @@ class HPRadialGridAtLevel(MGridAtLevel): ...@@ -366,11 +366,10 @@ class HPRadialGridAtLevel(MGridAtLevel):
return super().coord2index(coord, **kwargs) return super().coord2index(coord, **kwargs)
def index2volume(self, index): def index2volume(self, index):
ndims_off = tuple(np.cumsum(tuple(g.ndim for g in self.grids))) grid_hp, grid_r = self.grids
islice = tuple(slice(l, r) for l, r in zip((0,) + ndims_off[:-1], ndims_off)) r_upper = grid_r.index2coord(index[1:2] + 0.5)
r_upper = self.grids[1].index2coord(index[islice[1]] + 0.5) r_lower = grid_r.index2coord(index[1:2] - 0.5)
r_lower = self.grids[1].index2coord(index[islice[1]] - 0.5) A_unity = grid_hp.index2volume(index[0:1])
A_unity = self.grids[0].index2volume(index[islice[0]])
return A_unity * (r_upper**3 - r_lower**3) / 3 return A_unity * (r_upper**3 - r_lower**3) / 3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment