diff --git a/example/use_block_jacobi_solver_with_default_build.py b/example/use_block_jacobi_solver_with_default_build.py index 43277f5..cbd40a0 100644 --- a/example/use_block_jacobi_solver_with_default_build.py +++ b/example/use_block_jacobi_solver_with_default_build.py @@ -97,7 +97,7 @@ ax1.set_title("cluster at depth 1") ax2.set_title("cluster at depth 2") - ax4.set_title("Hmatrix on rank 0") + ax3.set_title("Hmatrix on rank 0") ax4.set_title("Block diagonal Hmatrix on rank 0") Htool.plot(ax1, cluster, points, 1) Htool.plot(ax2, cluster, points, 2) diff --git a/src/htool/hmatrix/interfaces/virtual_generator.hpp b/src/htool/hmatrix/interfaces/virtual_generator.hpp index 20ebaa9..b28c7e6 100644 --- a/src/htool/hmatrix/interfaces/virtual_generator.hpp +++ b/src/htool/hmatrix/interfaces/virtual_generator.hpp @@ -47,12 +47,14 @@ class VirtualGeneratorWithPermutationPython : public htool::VirtualGeneratorWith VirtualGeneratorWithPermutationPython(const py::array_t &target_permutation, const py::array_t &source_permutation) : VirtualGeneratorWithPermutation(target_permutation.data(), source_permutation.data()) {} void copy_submatrix_from_user_numbering(int M, int N, const int *const rows, const int *const cols, CoefficientPrecision *ptr) const override { + if (M * N > 0) { + py::array_t mat(std::array{M, N}, ptr, py::capsule(ptr)); - py::array_t mat(std::array{M, N}, ptr, py::capsule(ptr)); - py::array_t py_rows(std::array{M, 1}, rows, py::capsule(rows)); - py::array_t py_cols(std::array{N, 1}, cols, py::capsule(cols)); + py::array_t py_rows(std::array{M, 1}, rows, py::capsule(rows)); + py::array_t py_cols(std::array{N, 1}, cols, py::capsule(cols)); - build_submatrix(py_rows, py_cols, mat); + build_submatrix(py_rows, py_cols, mat); + } } // lcov does not see it because of trampoline I assume diff --git a/tests/conftest.py b/tests/conftest.py index bf86eb6..1d8aac0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -357,62 +357,3 @@ def load_data_solver(symmetry, mu): ovr_subdomain_to_global, local_neumann_matrix, ] - - -@pytest.fixture( - params=[True, False], - ids=["block_jacobi_solver", "ddm_solver"], -) -def setup_solver_dependencies(request, load_data_solver, epsilon, eta): - [ - A, - x_ref, - f, - cluster, - neighbors, - intersections, - symmetry, - UPLO, - cluster_to_ovr_subdomain, - ovr_subdomain_to_global, - local_neumann_matrix, - ] = load_data_solver - - generator = GeneratorFromMatrix(cluster.get_permutation(), A) - default_approximation = Htool.ComplexDefaultApproximationBuilder( - generator, - cluster, - cluster, - epsilon, - eta, - symmetry, - UPLO, - mpi4py.MPI.COMM_WORLD, - ) - - solver = None - if request.param: - default_solver_builder = Htool.ComplexDefaultSolverBuilder( - default_approximation.distributed_operator, - default_approximation.block_diagonal_hmatrix, - ) - solver = default_solver_builder.solver - else: - default_solver_builder = Htool.ComplexDefaultDDMSolverBuilder( - default_approximation.distributed_operator, - default_approximation.block_diagonal_hmatrix, - generator, - ovr_subdomain_to_global, - cluster_to_ovr_subdomain, - neighbors, - intersections, - ) - solver = default_solver_builder.solver - - return ( - solver, - x_ref, - f, - default_approximation.distributed_operator, - local_neumann_matrix, - ) diff --git a/tests/test_ddm_solver.py b/tests/test_ddm_solver.py index f9013e5..5a0c5f3 100644 --- a/tests/test_ddm_solver.py +++ b/tests/test_ddm_solver.py @@ -124,7 +124,7 @@ def test_ddm_solver( + restart + " -hpddm_schwarz_method " + hpddm_schwarz_method - + " -hpddm_max_it 200 -hpddm_variant right -hpddm_compute_residual l2 -hpddm_tol " + + " -hpddm_max_it 200 -hpddm_variant right -hpddm_tol " + str(tol) ) diff --git a/tests/test_hmatrix.py b/tests/test_hmatrix.py deleted file mode 100644 index 2b00194..0000000 --- a/tests/test_hmatrix.py +++ /dev/null @@ -1,4 +0,0 @@ -import mpi4py -import pytest - -import Htool