From: Wolfgang Bangerth Date: Fri, 2 Apr 2004 20:07:04 +0000 (+0000) Subject: Make this thing work! X-Git-Tag: v8.0.0~15389 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14038204387ee0314ad0b07b682c1784062c3344;p=dealii.git Make this thing work! git-svn-id: https://svn.dealii.org/trunk@8960 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 5170d2d87d..8171dc531b 100644 --- a/deal.II/examples/step-17/step-17.cc +++ b/deal.II/examples/step-17/step-17.cc @@ -88,6 +88,7 @@ class ElasticProblem const unsigned int this_partition; unsigned int local_dofs; + std::vector partition_is_dof_owner; static unsigned int get_n_partitions (const MPI_Comm &mpi_communicator); static unsigned int get_this_partition (const MPI_Comm &mpi_communicator); @@ -213,6 +214,16 @@ void ElasticProblem::setup_system () local_dofs = DoFTools::count_dofs_with_subdomain_association (dof_handler, this_partition); + + { + partition_is_dof_owner.resize (dof_handler.n_dofs()); + std::vector subdomain_association (dof_handler.n_dofs()); + DoFTools::get_subdomain_association (dof_handler, + subdomain_association); + for (unsigned int i=0; i::solve () cg.solve (system_matrix, solution, system_rhs, preconditioner); - hanging_node_constraints.distribute (solution); + + PETScWrappers::Vector localized_solution (solution); + hanging_node_constraints.distribute (localized_solution); + + for (unsigned int i=0; i(localized_solution(i)); + solution.compress (); if (this_partition == 0) std::cout << " Solver converged in " @@ -390,13 +408,16 @@ void ElasticProblem::refine_grid () Vector estimated_error_per_cell (triangulation.n_active_cells()); // XXX - typename FunctionMap::type neumann_boundary; - Assert (false, ExcNotImplemented()); -// KellyErrorEstimator::estimate (dof_handler, -// QGauss2(), -// neumann_boundary, -// solution, -// estimated_error_per_cell); + { + PETScWrappers::Vector localized_solution (solution); + + typename FunctionMap::type neumann_boundary; + KellyErrorEstimator::estimate (dof_handler, + QGauss2(), + neumann_boundary, + localized_solution, + estimated_error_per_cell); + } GridRefinement::refine_and_coarsen_fixed_number (triangulation, estimated_error_per_cell, @@ -447,6 +468,12 @@ void ElasticProblem::output_results (const unsigned int cycle) const Assert (false, ExcInternalError()); }; + // xxx + std::vector p (triangulation.n_active_cells()); + GridTools::get_subdomain_association (triangulation, p); + Vector x(p.begin(), p.end()); + + data_out.add_data_vector (x, "partitioning"); data_out.add_data_vector (global_solution, solution_names); data_out.build_patches (); data_out.write_gmv (output); @@ -458,7 +485,7 @@ void ElasticProblem::output_results (const unsigned int cycle) const template void ElasticProblem::run () { - for (unsigned int cycle=0; cycle<12; ++cycle) + for (unsigned int cycle=0; cycle<10; ++cycle) { // xxx if (this_partition == 0)