From: heister Date: Tue, 12 Feb 2013 23:23:18 +0000 (+0000) Subject: remove calls to compress() without arguments from all deal steps, add missing calls... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a7f0fbc86c85f7c1fc003927d83196c16c39de8;p=dealii-svn.git remove calls to compress() without arguments from all deal steps, add missing calls to compress, use simpler distribute_local_to_global calls git-svn-id: https://svn.dealii.org/trunk@28351 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-17/step-17.cc b/deal.II/examples/step-17/step-17.cc index 45756bebea..f90d693cab 100644 --- a/deal.II/examples/step-17/step-17.cc +++ b/deal.II/examples/step-17/step-17.cc @@ -497,21 +497,20 @@ namespace Step17 // not be associated with the cell we are presently treating, and // are therefore not represented in the local matrix and vector), // but it can be done while distributing the local system to the - // global one. This is what the following two calls do, i.e. they + // global one. This is what the following call does, i.e. we // distribute to the global objects and at the same time make sure // that hanging node constraints are taken care of: cell->get_dof_indices (local_dof_indices); hanging_node_constraints - .distribute_local_to_global (cell_matrix, + .distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, - system_matrix); - - hanging_node_constraints - .distribute_local_to_global (cell_rhs, - local_dof_indices, - system_rhs); + system_matrix, system_rhs); } + // Now compress the vector and the system matrix: + system_matrix.compress(); + system_rhs.compress(VectorOperation::add); + // The global matrix and right hand side vectors have now been // formed. Note that since we took care of this already above, we do not // have to condense away hanging node constraints any more. @@ -601,11 +600,6 @@ namespace Step17 // a distributed vector that has all the constrained nodes fixed. solution = localized_solution; - // After this has happened, flush the PETSc buffers. This may or may not - // be strictly necessary here (the PETSc documentation is not very verbose - // on these things), but certainly doesn't hurt either. - solution.compress (); - // Finally return the number of iterations it took to converge, to allow // for some output: return solver_control.last_step(); @@ -827,7 +821,7 @@ namespace Step17 for (unsigned int i=0; iget_dof_indices (local_dof_indices); hanging_node_constraints - .distribute_local_to_global (cell_matrix, + .distribute_local_to_global (cell_matrix, cell_rhs, local_dof_indices, - system_matrix); - - hanging_node_constraints - .distribute_local_to_global (cell_rhs, - local_dof_indices, - system_rhs); + system_matrix, system_rhs); } + // Now compress the vector and the system matrix: + system_matrix.compress(); + system_rhs.compress(VectorOperation::add); + + // The last step is to again fix up boundary values, just as we already // did in previous programs. A slight complication is that the // apply_boundary_values function wants to have a solution @@ -1634,7 +1634,7 @@ namespace Step18 for (unsigned int i=0; i