From 8387d00a2718cecf092632edc8ccdd199fac353b Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 7 Dec 2017 13:48:55 -0700 Subject: [PATCH] Enable projecting boundary values for complex-valued problems. --- .../deal.II/numerics/vector_tools.templates.h | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index a134b95429..ed0806211f 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -2898,6 +2898,7 @@ namespace VectorTools } + template void invert_mass_matrix(const SparseMatrix &mass_matrix, const FilteredMatrix > &filtered_mass_matrix, @@ -2922,15 +2923,44 @@ namespace VectorTools filtered_preconditioner.clear(); } + + template void invert_mass_matrix (const SparseMatrix &mass_matrix, - const FilteredMatrix > > &filtered_mass_matrix, - FilteredMatrix > > &filtered_preconditioner, + const FilteredMatrix > &filtered_mass_matrix, + FilteredMatrix > &filtered_preconditioner, const Vector > &rhs, Vector > &boundary_projection) { - Assert (false, ExcInternalError()); + auto solve_for_one_component + = [&](const bool real_part) + { + // copy the real or imaginary part out of the rhs vector + Vector rhs_part (rhs.size()); + for (unsigned int i=0; i boundary_projection_part (boundary_projection.size()); + invert_mass_matrix (mass_matrix, + filtered_mass_matrix, + filtered_preconditioner, + rhs_part, + boundary_projection_part); + + // finally copy the real or imaginary part of the + // solution back into the global solution vector + for (unsigned int i=0; i > filtered_mass_matrix(mass_matrix, true); - FilteredMatrix > filtered_precondition; + FilteredMatrix::real_type> > filtered_mass_matrix(mass_matrix, true); + FilteredMatrix::real_type> > filtered_precondition; std::vector excluded_dofs(mass_matrix.m(), false); // we assemble mass matrix with unit weight, -- 2.39.5