Skip to content

Commit

Permalink
dolfinx.fem.VectorFunctionSpace has been deprecated in favor of passi…
Browse files Browse the repository at this point in the history
…ng a shape argument to dolfin.fem.FunctionSpace. Furthermore, the base function space class has been renamed to dolfinx.fem.FunctionSpaceBase, with dolfinx.fem.FunctionSpace being a deprecated free function which calls dolfinx.fem.functionspace.
  • Loading branch information
francesco-ballarin committed Sep 11, 2023
1 parent 2a454c2 commit ccd1013
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 53 deletions.
6 changes: 3 additions & 3 deletions rbnicsx/backends/functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class FunctionsList(FunctionsListBase[dolfinx.fem.Function]):
Finite element space provided as input.
"""

def __init__(self, function_space: dolfinx.fem.FunctionSpace) -> None:
self._function_space: dolfinx.fem.FunctionSpace = function_space
def __init__(self, function_space: dolfinx.fem.FunctionSpaceBase) -> None:
self._function_space: dolfinx.fem.FunctionSpaceBase = function_space
super().__init__(function_space.mesh.comm)

@property
def function_space(self) -> dolfinx.fem.FunctionSpace:
def function_space(self) -> dolfinx.fem.FunctionSpaceBase:
"""Return the common finite element space of any Function that will be added to this list."""
return self._function_space

Expand Down
6 changes: 4 additions & 2 deletions rbnicsx/backends/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
from rbnicsx.io import on_rank_zero


def import_function(function_space: dolfinx.fem.FunctionSpace, directory: str, filename: str) -> dolfinx.fem.Function:
def import_function(
function_space: dolfinx.fem.FunctionSpaceBase, directory: str, filename: str
) -> dolfinx.fem.Function:
"""
Import a dolfinx.fem.Function from file.
Expand All @@ -46,7 +48,7 @@ def import_function(function_space: dolfinx.fem.FunctionSpace, directory: str, f


def import_functions(
function_space: dolfinx.fem.FunctionSpace, directory: str, filename: str
function_space: dolfinx.fem.FunctionSpaceBase, directory: str, filename: str
) -> typing.List[dolfinx.fem.Function]:
"""
Import a list of dolfinx.fem.Function from file.
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/backends/test_backends_export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def mesh() -> dolfinx.mesh.Mesh:

def test_backends_export_import_function(mesh: dolfinx.mesh.Mesh) -> None:
"""Check I/O for a dolfinx.fem.Function."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
function = dolfinx.fem.Function(V)
function.vector.set(1.0)

Expand All @@ -42,7 +42,7 @@ def test_backends_export_import_function(mesh: dolfinx.mesh.Mesh) -> None:

def test_backends_export_import_functions(mesh: dolfinx.mesh.Mesh) -> None:
"""Check I/O for a list of dolfinx.fem.Function."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
functions = list()
indices = list()
for i in range(2):
Expand All @@ -62,7 +62,7 @@ def test_backends_export_import_functions(mesh: dolfinx.mesh.Mesh) -> None:

def test_backends_export_import_vector(mesh: dolfinx.mesh.Mesh) -> None:
"""Check I/O for a petsc4py.PETSc.Vec."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_form = ufl.inner(1, v) * ufl.dx
linear_form_cpp = dolfinx.fem.form(linear_form)
Expand All @@ -78,7 +78,7 @@ def test_backends_export_import_vector(mesh: dolfinx.mesh.Mesh) -> None:

def test_backends_export_import_vectors(mesh: dolfinx.mesh.Mesh) -> None:
"""Check I/O for a list of petsc4py.PETSc.Vec."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_forms = [ufl.inner(i + 1, v) * ufl.dx for i in range(2)]
linear_forms_cpp = dolfinx.fem.form(linear_forms)
Expand All @@ -100,7 +100,7 @@ def test_backends_export_import_matrix( # type: ignore[no-any-unimported]
to_dense_matrix: typing.Callable[[petsc4py.PETSc.Mat], np.typing.NDArray[petsc4py.PETSc.ScalarType]]
) -> None:
"""Check I/O for a petsc4py.PETSc.Mat."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_form = ufl.inner(u, v) * ufl.dx
Expand All @@ -120,7 +120,7 @@ def test_backends_export_import_matrices( # type: ignore[no-any-unimported]
to_dense_matrix: typing.Callable[[petsc4py.PETSc.Mat], np.typing.NDArray[petsc4py.PETSc.ScalarType]]
) -> None:
"""Check I/O for a list of petsc4py.PETSc.Mat."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_forms = [(i + 1) * ufl.inner(u, v) * ufl.dx for i in range(2)]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/backends/test_backends_functions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def functions_list(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.FunctionsList:
"""Generate a rbnicsx.backends.FunctionsList with two entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
functions_list = rbnicsx.backends.FunctionsList(V)
for i in range(2):
function = dolfinx.fem.Function(V)
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_backends_functions_list_mul(functions_list: rbnicsx.backends.FunctionsL

def test_backends_functions_list_mul_empty(mesh: dolfinx.mesh.Mesh) -> None:
"""Check rbnicsx.backends.FunctionsList.__mul__ with empty list."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
empty_functions_list = rbnicsx.backends.FunctionsList(V)

online_vec = rbnicsx.online.create_vector(0)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/backends/test_backends_gram_schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def functions(mesh: dolfinx.mesh.Mesh) -> typing.List[dolfinx.fem.Function]:
"""Generate a list of pairwise linearly independent functions."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
function0 = dolfinx.fem.Function(V)
with function0.vector.localForm() as function0_local:
function0_local.set(1)
Expand All @@ -44,7 +44,7 @@ def functions(mesh: dolfinx.mesh.Mesh) -> typing.List[dolfinx.fem.Function]:
@pytest.fixture
def inner_product(mesh: dolfinx.mesh.Mesh) -> ufl.Form: # type: ignore[no-any-unimported]
"""Generate a UFL form storing the L^2 inner product."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
return ufl.inner(u, v) * ufl.dx
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_backends_gram_schmidt_zero( # type: ignore[no-any-unimported]
mesh: dolfinx.mesh.Mesh, inner_product: ufl.Form
) -> None:
"""Check rbnicsx.backends.gram_schmidt when adding a linearly dependent function (e.g., zero)."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))

functions_list = rbnicsx.backends.FunctionsList(V)
assert len(functions_list) == 0
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/backends/test_backends_mesh_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _(x: np.typing.NDArray[np.float64]) -> np.typing.NDArray[np.float64]:
def shape_parametrization(mesh: dolfinx.mesh.Mesh) -> dolfinx.fem.Function:
"""Generate a shape parametrization of the unit square for use in tests in this file."""
assert len(mesh.geometry.cmaps) == 1
M = dolfinx.fem.VectorFunctionSpace(mesh, ("Lagrange", mesh.geometry.cmaps[0].degree))
M = dolfinx.fem.functionspace(mesh, ("Lagrange", mesh.geometry.cmaps[0].degree, (mesh.geometry.dim, )))
shape_parametrization = dolfinx.fem.Function(M)
shape_parametrization.interpolate(shape_parametrization_expression(mesh.topology.dim))
return shape_parametrization
Expand All @@ -72,7 +72,7 @@ def shape_parametrization(mesh: dolfinx.mesh.Mesh) -> dolfinx.fem.Function:
def identity(mesh: dolfinx.mesh.Mesh) -> dolfinx.fem.Function:
"""Generate the identity shape parametrization of the unit square for use in tests in this file."""
assert len(mesh.geometry.cmaps) == 1
M = dolfinx.fem.VectorFunctionSpace(mesh, ("Lagrange", mesh.geometry.cmaps[0].degree))
M = dolfinx.fem.functionspace(mesh, ("Lagrange", mesh.geometry.cmaps[0].degree, (mesh.geometry.dim, )))
identity = dolfinx.fem.Function(M)
identity.interpolate(lambda x: x[:mesh.topology.dim])
return identity
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backends/test_backends_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def functions_list(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.FunctionsList:
"""Generate a rbnicsx.backends.FunctionsList with several entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
functions_list = rbnicsx.backends.FunctionsList(V)
for i in range(14):
function = dolfinx.fem.Function(V)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def functions_list(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.FunctionsList:
"""Generate a rbnicsx.backends.FunctionsList with four linearly dependent entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
functions_list = rbnicsx.backends.FunctionsList(V)
for i in range(4):
function = dolfinx.fem.Function(V)
Expand All @@ -43,7 +43,7 @@ def functions_list(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.FunctionsList:
@pytest.fixture
def inner_product(mesh: dolfinx.mesh.Mesh) -> ufl.Form: # type: ignore[no-any-unimported]
"""Generate a UFL form storing the L^2 inner product."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
return ufl.inner(u, v) * ufl.dx
Expand All @@ -52,7 +52,7 @@ def inner_product(mesh: dolfinx.mesh.Mesh) -> ufl.Form: # type: ignore[no-any-u
@pytest.fixture
def tensors_list_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
"""Generate a rbnicsx.backends.TensorsList with two linearly dependent petsc4py.PETSc.Vec entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_forms = [ufl.inner(i + 1, v) * ufl.dx for i in range(2)]
linear_forms_cpp = dolfinx.fem.form(linear_forms)
Expand All @@ -68,7 +68,7 @@ def tensors_list_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
@pytest.fixture
def tensors_list_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
"""Generate a rbnicsx.backends.TensorsList with two linearly dependent petsc4py.PETSc.Mat entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_forms = [(i + 1) * ufl.inner(u, v) * ufl.dx for i in range(2)]
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_backends_proper_orthogonal_decomposition_zero( # type: ignore[no-any-u
mesh: dolfinx.mesh.Mesh, inner_product: ufl.Form, normalize: bool
) -> None:
"""Check rbnicsx.backends.proper_orthogonal_decomposition for the case of all zero snapshots."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
functions_list = rbnicsx.backends.FunctionsList(V)
functions_list.extend([dolfinx.fem.Function(V) for _ in range(2)])
compute_inner_product = rbnicsx.backends.bilinear_form_action(inner_product)
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/backends/test_backends_tensors_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def tensors_1d_array_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArray:
"""Generate a rbnicsx.backends.TensorsArray with six petsc4py.PETSc.Vec entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_forms = [ufl.inner(i + 1, v) * ufl.dx for i in range(6)]
linear_forms_cpp = dolfinx.fem.form(linear_forms)
Expand All @@ -49,7 +49,7 @@ def tensors_1d_array_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArr
@pytest.fixture
def tensors_2d_array_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArray:
"""Generate a rbnicsx.backends.TensorsArray with two-by-three petsc4py.PETSc.Vec entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_forms = [ufl.inner(i + 1, v) * ufl.dx for i in range(6)]
linear_forms_cpp = dolfinx.fem.form(linear_forms)
Expand All @@ -67,7 +67,7 @@ def tensors_2d_array_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArr
@pytest.fixture
def tensors_1d_array_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArray:
"""Generate a rbnicsx.backends.TensorsArray with six petsc4py.PETSc.Mat entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_forms = [(i + 1) * ufl.inner(u, v) * ufl.dx for i in range(6)]
Expand All @@ -85,7 +85,7 @@ def tensors_1d_array_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArr
@pytest.fixture
def tensors_2d_array_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsArray:
"""Generate a rbnicsx.backends.TensorsArray with two-by-three petsc4py.PETSc.Mat entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_forms = [(i + 1) * ufl.inner(u, v) * ufl.dx for i in range(6)]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/backends/test_backends_tensors_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def mesh() -> dolfinx.mesh.Mesh:
@pytest.fixture
def tensors_list_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
"""Generate a rbnicsx.backends.TensorsList with two petsc4py.PETSc.Vec entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)
linear_forms = [ufl.inner(i + 1, v) * ufl.dx for i in range(2)]
linear_forms_cpp = dolfinx.fem.form(linear_forms)
Expand All @@ -49,7 +49,7 @@ def tensors_list_vec(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
@pytest.fixture
def tensors_list_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList:
"""Generate a rbnicsx.backends.TensorsList with two petsc4py.PETSc.Mat entries."""
V = dolfinx.fem.FunctionSpace(mesh, ("Lagrange", 1))
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
bilinear_forms = [(i + 1) * ufl.inner(u, v) * ufl.dx for i in range(2)]
Expand Down
6 changes: 3 additions & 3 deletions tutorials/01_thermal_block.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
"\n",
" def __init__(self) -> None:\n",
" # Define function space\n",
" V = dolfinx.fem.FunctionSpace(mesh, (\"Lagrange\", 1))\n",
" V = dolfinx.fem.functionspace(mesh, (\"Lagrange\", 1))\n",
" self._V = V\n",
" # Define trial and test functions\n",
" u = ufl.TrialFunction(V)\n",
Expand Down Expand Up @@ -272,7 +272,7 @@
" self._bcs = bcs\n",
"\n",
" @property\n",
" def function_space(self) -> dolfinx.fem.FunctionSpace:\n",
" def function_space(self) -> dolfinx.fem.FunctionSpaceBase:\n",
" \"\"\"Return the function space of the problem.\"\"\"\n",
" return self._V\n",
"\n",
Expand Down Expand Up @@ -412,7 +412,7 @@
" self._restriction = restriction\n",
"\n",
" @property\n",
" def function_space(self) -> dolfinx.fem.FunctionSpace:\n",
" def function_space(self) -> dolfinx.fem.FunctionSpaceBase:\n",
" \"\"\"Return the function space of the eigenvalue problem.\"\"\"\n",
" return self._V\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions tutorials/02_elastic_block.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"\n",
" def __init__(self) -> None:\n",
" # Define function space\n",
" V = dolfinx.fem.VectorFunctionSpace(mesh, (\"Lagrange\", 1))\n",
" V = dolfinx.fem.functionspace(mesh, (\"Lagrange\", 1, (mesh.geometry.dim, )))\n",
" self._V = V\n",
" # Define trial and test functions\n",
" u = ufl.TrialFunction(V)\n",
Expand Down Expand Up @@ -249,7 +249,7 @@
" + lambda_1 * ufl.inner(ufl.tr(ufl.sym(ufl.grad(u))), ufl.tr(ufl.sym(ufl.grad(v)))))\n",
"\n",
" @property\n",
" def function_space(self) -> dolfinx.fem.FunctionSpace:\n",
" def function_space(self) -> dolfinx.fem.FunctionSpaceBase:\n",
" \"\"\"Return the function space of the problem.\"\"\"\n",
" return self._V\n",
"\n",
Expand Down
10 changes: 6 additions & 4 deletions tutorials/03_hole.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@
" def __init__(self, mu: np.typing.NDArray[np.float64]) -> None:\n",
" # Define function space\n",
" assert len(mesh.geometry.cmaps) == 1\n",
" M = dolfinx.fem.VectorFunctionSpace(mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree))\n",
" M = dolfinx.fem.functionspace(\n",
" mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree, (mesh.geometry.dim, )))\n",
" # Interpolate affine shape parametrization expression on a dolfinx Function\n",
" shape_parametrization = dolfinx.fem.Function(M)\n",
" for (label, expression) in enumerate(self.get_shape_parametrization_expression(mu)):\n",
Expand Down Expand Up @@ -379,7 +380,8 @@
" def __init__(self, mu: np.typing.NDArray[np.float64]) -> None:\n",
" # Define function space\n",
" assert len(mesh.geometry.cmaps) == 1\n",
" M = dolfinx.fem.VectorFunctionSpace(mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree))\n",
" M = dolfinx.fem.functionspace(\n",
" mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree, (mesh.geometry.dim, )))\n",
" # Define trial and test functions\n",
" m = ufl.TrialFunction(M)\n",
" n = ufl.TestFunction(M)\n",
Expand Down Expand Up @@ -491,7 +493,7 @@
"\n",
" def __init__(self) -> None:\n",
" # Define function space\n",
" V = dolfinx.fem.FunctionSpace(mesh, (\"Lagrange\", 1))\n",
" V = dolfinx.fem.functionspace(mesh, (\"Lagrange\", 1))\n",
" self._V = V\n",
" # Define trial and test functions\n",
" u = ufl.TrialFunction(V)\n",
Expand All @@ -513,7 +515,7 @@
" self._mu = np.zeros(mu_symb.value.shape)\n",
"\n",
" @property\n",
" def function_space(self) -> dolfinx.fem.FunctionSpace:\n",
" def function_space(self) -> dolfinx.fem.FunctionSpaceBase:\n",
" \"\"\"Return the function space of the problem.\"\"\"\n",
" return self._V\n",
"\n",
Expand Down
7 changes: 4 additions & 3 deletions tutorials/04_graetz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@
" def __init__(self, mu: np.typing.NDArray[np.float64]) -> None:\n",
" # Define function space\n",
" assert len(mesh.geometry.cmaps) == 1\n",
" M = dolfinx.fem.VectorFunctionSpace(mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree))\n",
" M = dolfinx.fem.functionspace(\n",
" mesh, (\"Lagrange\", mesh.geometry.cmaps[0].degree, (mesh.geometry.dim, )))\n",
" # Interpolate affine shape parametrization expression on a dolfinx Function\n",
" shape_parametrization = dolfinx.fem.Function(M)\n",
" shape_parametrization.interpolate(\n",
Expand Down Expand Up @@ -228,7 +229,7 @@
"\n",
" def __init__(self) -> None:\n",
" # Define function space\n",
" V = dolfinx.fem.FunctionSpace(mesh, (\"Lagrange\", 1))\n",
" V = dolfinx.fem.functionspace(mesh, (\"Lagrange\", 1))\n",
" self._V = V\n",
" # Define trial and test functions\n",
" u = ufl.TrialFunction(V)\n",
Expand Down Expand Up @@ -265,7 +266,7 @@
" self._mesh_motion: typing.Optional[rbnicsx.backends.MeshMotion] = None\n",
"\n",
" @property\n",
" def function_space(self) -> dolfinx.fem.FunctionSpace:\n",
" def function_space(self) -> dolfinx.fem.FunctionSpaceBase:\n",
" \"\"\"Return the function space of the problem.\"\"\"\n",
" return self._V\n",
"\n",
Expand Down
Loading

0 comments on commit ccd1013

Please sign in to comment.