Skip to content

Commit

Permalink
update with get_submat_hmatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreMarchand20 committed Nov 16, 2023
1 parent e7f50e6 commit fc946fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions example/use_block_jacobi_solver_with_no_default_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@


# Solver with block Jacobi preconditionner
block_diagonal_hmatrix = hmatrix.get_sub_hmatrix(
cluster.get_cluster_on_partition(mpi4py.MPI.COMM_WORLD.rank),
cluster.get_cluster_on_partition(mpi4py.MPI.COMM_WORLD.rank),
)
default_solver_builder = Htool.DefaultSolverBuilder(
distributed_operator,
hmatrix.get_block_diagonal_hmatrix(),
block_diagonal_hmatrix,
)
solver = default_solver_builder.solver

Expand Down Expand Up @@ -127,5 +131,5 @@
Htool.plot(ax1, cluster, points, 1)
Htool.plot(ax2, cluster, points, 2)
Htool.plot(ax3, hmatrix)
Htool.plot(ax4, hmatrix.get_block_diagonal_hmatrix())
Htool.plot(ax4, block_diagonal_hmatrix)
plt.show()
4 changes: 2 additions & 2 deletions src/htool/hmatrix/hmatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ void declare_HMatrix(py::module &m, const std::string &className) {
// });

py_class.def(
"get_block_diagonal_hmatrix", [](const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix) {
return &*hmatrix.get_diagonal_hmatrix();
"get_sub_hmatrix", [](const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix, const Cluster<CoordinatePrecision> &target_cluster, const Cluster<CoordinatePrecision> &source_cluster) {
return &*hmatrix.get_sub_hmatrix(target_cluster, source_cluster);

Check warning on line 94 in src/htool/hmatrix/hmatrix.hpp

View check run for this annotation

Codecov / codecov/patch

src/htool/hmatrix/hmatrix.hpp#L92-L94

Added lines #L92 - L94 were not covered by tests
},
py::return_value_policy::reference_internal);
py_class.def("get_tree_parameters", [](const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix) {
Expand Down

0 comments on commit fc946fa

Please sign in to comment.