diff --git a/tests/unit/backends/test_backends_proper_orthogonal_decomposition.py b/tests/unit/backends/test_backends_proper_orthogonal_decomposition.py index 123fcd2..edfd66f 100644 --- a/tests/unit/backends/test_backends_proper_orthogonal_decomposition.py +++ b/tests/unit/backends/test_backends_proper_orthogonal_decomposition.py @@ -82,14 +82,24 @@ def tensors_list_mat(mesh: dolfinx.mesh.Mesh) -> rbnicsx.backends.TensorsList: return tensors_list -@pytest.mark.parametrize("normalize", [True, False]) +@pytest.mark.parametrize("N", [None, 2]) +@pytest.mark.parametrize("tol", [None, 0.0]) +@pytest.mark.parametrize("normalize", [None, True, False]) def test_backends_proper_orthogonal_decomposition_functions( # type: ignore[no-any-unimported] - functions_list: rbnicsx.backends.FunctionsList, inner_product: ufl.Form, normalize: bool + functions_list: rbnicsx.backends.FunctionsList, inner_product: ufl.Form, + N: typing.Optional[int], tol: typing.Optional[float], normalize: typing.Optional[bool] ) -> None: """Check rbnicsx.backends.proper_orthogonal_decomposition for the case of dolfinx.fem.Function snapshots.""" + kwargs = dict() + if N is not None: + kwargs["N"] = N + if tol is not None: + kwargs["tol"] = tol + if normalize is not None: + kwargs["normalize"] = normalize compute_inner_product = rbnicsx.backends.bilinear_form_action(inner_product) eigenvalues, modes, eigenvectors = rbnicsx.backends.proper_orthogonal_decomposition( - functions_list[:2], compute_inner_product, N=2, tol=0.0, normalize=normalize) + functions_list[:2], compute_inner_product, **kwargs) assert len(eigenvalues) == 2 assert np.isclose(eigenvalues[0], 5) assert np.isclose(eigenvalues[1], 0) diff --git a/tests/unit/online/test_online_proper_orthogonal_decomposition.py b/tests/unit/online/test_online_proper_orthogonal_decomposition.py index 77e9bd5..73cda42 100644 --- a/tests/unit/online/test_online_proper_orthogonal_decomposition.py +++ b/tests/unit/online/test_online_proper_orthogonal_decomposition.py @@ -139,16 +139,25 @@ def tensors_list_mat(request: _pytest.fixtures.SubRequest) -> rbnicsx.online.Ten return request.getfixturevalue(request.param) # type: ignore[no-any-return] +@pytest.mark.parametrize("N", [None, 2]) +@pytest.mark.parametrize("tol", [None, 0.0]) @pytest.mark.parametrize("normalize", [True, False]) def test_online_proper_orthogonal_decomposition_functions( # type: ignore[no-any-unimported] functions_list: rbnicsx.online.FunctionsList, inner_product: typing.Callable[[int], petsc4py.PETSc.Mat], - normalize: bool + N: typing.Optional[int], tol: typing.Optional[float], normalize: typing.Optional[bool] ) -> None: """Check rbnicsx.online.proper_orthogonal_decomposition for the case of snapshots stored in a FunctionsList.""" size = functions_list[0].size inner_product_matrix = inner_product(size) + kwargs = dict() + if N is not None: + kwargs["N"] = N + if tol is not None: + kwargs["tol"] = tol + if normalize is not None: + kwargs["normalize"] = normalize eigenvalues, modes, eigenvectors = rbnicsx.online.proper_orthogonal_decomposition( - functions_list[:2], inner_product_matrix, N=2, tol=0.0, normalize=normalize) + functions_list[:2], inner_product_matrix, **kwargs) assert len(eigenvalues) == 2 sum_squares_first_size_numbers = size * (size + 1) * (2 * size + 1) / 6 assert np.isclose(eigenvalues[0], 5 * sum_squares_first_size_numbers)