From: David Wells Date: Sat, 9 Jan 2016 20:37:39 +0000 (-0500) Subject: Fix a bug with the call to SolutionTransfer. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29df713ef1af739bf58b8d14ec91f901c3a7a535;p=code-gallery.git Fix a bug with the call to SolutionTransfer. --- 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(); }