Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Dec 18, 2024
1 parent e0b8fce commit 88fb6dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/felupe/assembly/_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,22 +283,15 @@ def assemble(self, values=None, parallel=False, block=True, out=None):
for val, form in zip(values, self.forms):
res.append(form.assemble(val, parallel=parallel, out=out))

if block and self.mode == 2:
if block and (self.mode == 2 or self.mode == 3):
K = np.zeros((self.nv, self.nu), dtype=object)
for a, (i, j) in enumerate(zip(self.i, self.j)):
K[i, j] = res[a]
if i != j:
if self.mode == 2 and i != j:
K[j, i] = res[a].T

res = bmat(K).tocsr()

if block and self.mode == 3:
K = np.zeros((self.nv, self.nu), dtype=object)
for a, (i, j) in enumerate(zip(self.i, self.j)):
K[i, j] = res[a]

res = bmat(K).tocsr()

if block and self.mode == 1:
res = vstack(res).tocsr()

Expand Down
14 changes: 14 additions & 0 deletions tests/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ def test_mixed():

assert b.shape == (z, 1)

L = fem.IntegralForm([f[0], None, f[2]], v, r.dV)
x = L.integrate()
b = L.assemble(x)

assert b.shape == (z, 1)

a = fem.IntegralForm(
[A[0], A[1], A[2], A[1], A[3], A[4], A[2], A[4], A[5]], v, r.dV, v
)
y = a.integrate()
K = a.assemble(y)

assert K.shape == (z, z)

r, v, f, A = pre_axi_mixed()

for parallel in [False, True]:
Expand Down

0 comments on commit 88fb6dc

Please sign in to comment.