From: hartmann Date: Thu, 13 Jun 2002 15:09:50 +0000 (+0000) Subject: Make it work with the new interpolate functions. Comments still do not match the... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f5ca7999b1c7a73347b401cac5d1ce794918b12;p=dealii-svn.git Make it work with the new interpolate functions. Comments still do not match the code. git-svn-id: https://svn.dealii.org/trunk@6105 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index a2de018b47..7882a62887 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -2724,28 +2724,24 @@ namespace LaplaceSolver // dual solution to the (smaller) // primal space. For the // interpolation, there is a - // library function, the rest is - // standard. Further down in the - // ``estimate_error'' function we - // explain that the result of the - // interpolation is not a - // conforming finite element field, - // i.e. the interpolated dual - // solution is no more - // continuous. We could fix this - // (and do so in the - // ``estimate_error'' function), - // but since this is only for - // graphical output, we don't care - // here. + // library function, that takes a + // ``ConstraintMatrix'' object + // including the hanging node + // constraints. The rest is + // standard. template void WeightedResidual::output_solution () const { + ConstraintMatrix primal_hanging_node_constraints; + DoFTools::make_hanging_node_constraints (PrimalSolver::dof_handler, + primal_hanging_node_constraints); + primal_hanging_node_constraints.close(); Vector dual_solution (PrimalSolver::dof_handler.n_dofs()); FETools::interpolate (DualSolver::dof_handler, DualSolver::solution, PrimalSolver::dof_handler, + primal_hanging_node_constraints, dual_solution); DataOut data_out; @@ -2825,51 +2821,53 @@ namespace LaplaceSolver // cell-wise interpolated into // the finite element space in // which we have solved the dual - // problem: + // problem: But, again as in the + // ``WeightedResidual::output_solution'' + // function we first need to + // create a ConstraintMatrix + // including the hanging node + // constraints, but this time of + // the dual finite element space. + ConstraintMatrix dual_hanging_node_constraints; + DoFTools::make_hanging_node_constraints (DualSolver::dof_handler, + dual_hanging_node_constraints); + dual_hanging_node_constraints.close(); Vector primal_solution (DualSolver::dof_handler.n_dofs()); FETools::interpolate (PrimalSolver::dof_handler, PrimalSolver::solution, DualSolver::dof_handler, + dual_hanging_node_constraints, primal_solution); - // Then for the interpolation of - // the numerically approximated - // dual solution z into the - // finite element space of the - // primal solution: interpolate - // into this smaller finite - // element space... + // Then for computing the + // interpolation of the + // numerically approximated dual + // solution z into the finite + // element space of the primal + // solution and subtracting it + // from z: use the + // ``interpolate_difference'' + // function, that gives (z-I_hz) + // in the element space of the + // dual solution. + ConstraintMatrix primal_hanging_node_constraints; + DoFTools::make_hanging_node_constraints (PrimalSolver::dof_handler, + primal_hanging_node_constraints); + primal_hanging_node_constraints.close(); Vector tmp (PrimalSolver::dof_handler.n_dofs()); FETools::interpolate (DualSolver::dof_handler, DualSolver::solution, PrimalSolver::dof_handler, + primal_hanging_node_constraints, tmp); - // ...but then remark that at - // present the function that did - // this does not respect hanging - // node constraints. Doh. The - // result is that the ``tmp'' - // vector is cell-wise of the - // polynomial degree of the - // primal finite element, but may - // be discontinuous at hanging - // nodes. Fix ``fix'' this by - // building up the hanging node - // constraints for this finite - // element space, and apply them - // to the computed interpolation: - ConstraintMatrix primal_hanging_node_constraints; - DoFTools::make_hanging_node_constraints (PrimalSolver::dof_handler, - primal_hanging_node_constraints); - primal_hanging_node_constraints.close (); - primal_hanging_node_constraints.distribute (tmp); // Note that this could probably // have been more efficient since // those constraints have been // used previously when // assembling matrix and right // hand side for the primal - // problem. We leave the + // problem and writing out the + // dual solution. We leave the // optimization of the program in // this respect as an exercise. @@ -2897,6 +2895,7 @@ namespace LaplaceSolver FETools::interpolate (PrimalSolver::dof_handler, tmp, DualSolver::dof_handler, + dual_hanging_node_constraints, i_h_dual_solution); // With all this in place,