I was wondering if there’s a way to programmatically extract both testspace and trialspace from an existing BilinearForm?
from ngsolve.meshes import Make1DMesh
from ngsolve import H1, BilinearForm, dx
mesh = Make1DMesh(1)
X = H1(mesh, order=2)
Y = H1(mesh, order=3)
u = X.TrialFunction()
v = Y.TestFunction()
A = BilinearForm(trialspace=X, testspace=Y)
A += u * v * dx
A.Assemble()
# We can access X, but not Y
print(A.space) # <- This is X (order 2)
print("-"*40)
print(A.testspace) # <- Doesn't exist
print("-"*40)
print(A.trialspace) # <- Doesn't exist
print("-"*40)
I trawled through help(A) but found nothing of use, except a comment that A.space “may be a product space”.