From ab58dfb53eb40879dbe57f9065ae3687185ea429 Mon Sep 17 00:00:00 2001 From: frohne Date: Mon, 2 Apr 2012 22:53:21 +0000 Subject: [PATCH] new IndexSet to count the contact constraints git-svn-id: https://svn.dealii.org/trunk@25372 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-42/step-42.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 546ff28934..aec7a4f1f4 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -928,6 +928,8 @@ void Step4::projection_active_set () constraints.reinit(locally_relevant_dofs); active_set.clear (); + IndexSet active_set_locally_owned; + active_set_locally_owned.set_size (locally_owned_dofs.size ()); const double c = 100.0*e_modul; for (; cell!=endc; ++cell) @@ -963,6 +965,9 @@ void Step4::projection_active_set () if (locally_relevant_dofs.is_element (index_z)) active_set.add_index (index_z); + if (locally_owned_dofs.is_element (index_z)) + active_set_locally_owned.add_index (index_z); + // std::cout<< index_z << ", " // << "Error: " << lambda (index_z) + // diag_mass_matrix_vector_relevant (index_z)*c*(solution_index_z - gap) @@ -976,11 +981,8 @@ void Step4::projection_active_set () distributed_solution.compress(Insert); -//TODO: since the active sets on different processors also store "ghost" elements, -// i.e. constraints for DoFs that are locally_relevant but not locally_owned, -// the following sum doesn't make much sense. We need to count the -// *unique* elements - unsigned int sum_contact_constraints = Utilities::MPI::sum(active_set.n_elements (), mpi_communicator); + unsigned int sum_contact_constraints = Utilities::MPI::sum(active_set_locally_owned.n_elements (), + mpi_communicator); pcout << "Number of Contact-Constaints: " << sum_contact_constraints <