From 29df713ef1af739bf58b8d14ec91f901c3a7a535 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 9 Jan 2016 15:37:39 -0500 Subject: [PATCH] Fix a bug with the call to SolutionTransfer. --- cdr/solver/cdr.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cdr/solver/cdr.cc b/cdr/solver/cdr.cc index 0be13d4..da832e6 100644 --- a/cdr/solver/cdr.cc +++ b/cdr/solver/cdr.cc @@ -273,11 +273,23 @@ void CDRProblem::refine_mesh() setup_dofs(); + // The solution_transfer object stores a pointer to + // locally_relevant_solution, so when + // parallel::distributed::SolutionTransfer::interpolate is called it uses + // those values to populate temporary. TrilinosWrappers::MPI::Vector temporary - (locally_owned_dofs, mpi_communicator); + (locally_owned_dofs, mpi_communicator); solution_transfer.interpolate(temporary); - locally_relevant_solution = temporary; - constraints.distribute(locally_relevant_solution); + // After temporary has the correct value, this call correctly + // populates completely_distributed_solution, which had its + // index set updated above with the call to setup_dofs. + completely_distributed_solution = temporary; + // Constraints cannot be applied to + // @ref GlossGhostedVector "vectors with ghost entries" since the ghost + // entries are write only, so this first goes through the completely + // distributed vector. + constraints.distribute(completely_distributed_solution); + locally_relevant_solution = completely_distributed_solution; setup_system(); } -- 2.39.5