From 8f69a74298d10c362e6dc68d89c59dc44aa13e20 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 12 Mar 2018 14:56:05 +0100 Subject: [PATCH] Distributed coupling now working. --- source/non_matching/coupling.cc | 89 ++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/source/non_matching/coupling.cc b/source/non_matching/coupling.cc index 7261bdc28b..84a172a08b 100644 --- a/source/non_matching/coupling.cc +++ b/source/non_matching/coupling.cc @@ -13,6 +13,8 @@ // // --------------------------------------------------------------------- +#include + #include #include @@ -36,6 +38,9 @@ #include #include +#include +#include + DEAL_II_NAMESPACE_OPEN namespace NonMatching { @@ -52,6 +57,8 @@ namespace NonMatching AssertDimension(sparsity.n_rows(), space_dh.n_dofs()); AssertDimension(sparsity.n_cols(), immersed_dh.n_dofs()); static_assert(dim1 <= dim0, "This function can only work if dim1 <= dim0"); + Assert((dynamic_cast *> + (&immersed_dh.get_triangulation()) == 0), ExcNotImplemented()); const auto &space_fe = space_dh.get_fe(); const auto &immersed_fe = immersed_dh.get_fe(); @@ -112,17 +119,21 @@ namespace NonMatching // Get the ones in the current outer cell typename DoFHandler::cell_iterator ocell(*cells[c], &space_dh); - ocell->get_dof_indices(odofs); - for (unsigned int i=0; iis_locally_owned()) { - const auto comp_i = space_fe.system_to_component_index(i).first; - if (space_gtl[comp_i] != numbers::invalid_unsigned_int) + ocell->get_dof_indices(odofs); + for (unsigned int i=0; i*> + (&immersed_dh.get_triangulation()) == 0), ExcNotImplemented()); const auto &space_fe = space_dh.get_fe(); const auto &immersed_fe = immersed_dh.get_fe(); @@ -213,39 +226,43 @@ namespace NonMatching // Get the ones in the current outer cell typename DoFHandler::active_cell_iterator ocell(*cells[c], &space_dh); - const std::vector< Point > &qps = qpoints[c]; - const std::vector< unsigned int > &ids = maps[c]; + // Make sure we act only on locally_owned cells + if (ocell->is_locally_owned()) + { + const std::vector< Point > &qps = qpoints[c]; + const std::vector< unsigned int > &ids = maps[c]; - FEValues o_fe_v(space_mapping, space_dh.get_fe(), qps, - update_values); - o_fe_v.reinit(ocell); - ocell->get_dof_indices(odofs); + FEValues o_fe_v(space_mapping, space_dh.get_fe(), qps, + update_values); + o_fe_v.reinit(ocell); + ocell->get_dof_indices(odofs); - // Reset the matrices. - cell_matrix = 0; + // Reset the matrices. + cell_matrix = 0; - for (unsigned int i=0; i