Skip to content

Commit 595ba4e

Browse files
committed
style
1 parent 1ae4509 commit 595ba4e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

firedrake/assemble.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,14 +1375,11 @@ def _make_sparsity(test, trial, mat_type, sub_mat_type, maps_and_regions):
13751375
rmap = unghosted_lgmap(sparsity._dsets[0].lgmap, test.function_space())
13761376
cmap = unghosted_lgmap(sparsity._dsets[1].lgmap, trial.function_space())
13771377
sparsity._lgmaps = (rmap, cmap)
1378-
13791378
elif mat_type == "nest" and sub_mat_type == "is":
1380-
Vrow = test.function_space()
1381-
Vcol = trial.function_space()
1382-
for i, j in numpy.ndindex((len(Vrow), len(Vcol))):
1379+
for i, j in numpy.ndindex(sparsity.shape):
13831380
block = sparsity[i, j]
1384-
rmap = unghosted_lgmap(block._dsets[0].lgmap, Vrow[i])
1385-
cmap = unghosted_lgmap(block._dsets[1].lgmap, Vcol[j])
1381+
rmap = unghosted_lgmap(block._dsets[0].lgmap, test.function_space()[i])
1382+
cmap = unghosted_lgmap(block._dsets[1].lgmap, trial.function_space()[j])
13861383
block._lgmaps = (rmap, cmap)
13871384
return sparsity
13881385

@@ -2209,14 +2206,12 @@ def masked_lgmap(lgmap, mask, block=True):
22092206

22102207

22112208
def unghosted_lgmap(lgmap, V, block=True):
2212-
block_size = lgmap.getBlockSize() if block else 1
2213-
22142209
mesh_dm = V.mesh().topology_dm
2215-
depth = mesh_dm.getDepth()
2216-
start, end = mesh_dm.getDepthStratum(depth)
2210+
start, end = mesh_dm.getHeightStratum(0)
22172211

22182212
own = []
22192213
for i, W in enumerate(V):
2214+
bsize = W.block_size
22202215
W_local_ises_indices = V.dof_dset.local_ises[i].indices
22212216
section = W.dm.getDefaultSection()
22222217
for seed in range(start, end):
@@ -2230,7 +2225,7 @@ def unghosted_lgmap(lgmap, V, block=True):
22302225
continue
22312226
off = section.getOffset(p)
22322227
# Local indices within W
2233-
W_indices = slice(block_size * off, block_size * (off + dof))
2228+
W_indices = slice(bsize * off, bsize * (off + dof))
22342229
own.extend(W_local_ises_indices[W_indices])
22352230

22362231
mask = numpy.setdiff1d(range(len(lgmap.indices)), own)

0 commit comments

Comments
 (0)