From d387fa04b8f159d44ef1426bbc4e716dd1b18bb9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 14 May 2020 10:22:09 -0600 Subject: [PATCH] Make further edits to step-50.cc. --- examples/step-50/step-50.cc | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index f96f8ab632..c1f78e0d06 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -246,7 +246,7 @@ std::shared_ptr>> Coefficient::make_coefficient_table( const MatrixFree> &mf_storage) const { - std::shared_ptr>> coefficient_table = + auto coefficient_table = std::make_shared>>(); FEEvaluation fe_eval(mf_storage); @@ -439,7 +439,7 @@ private: MatrixFreeActiveMatrix mf_system_matrix; VectorType solution; VectorType right_hand_side; - Vector error_estimator; + Vector estimated_error_per_cell; MGLevelObject mg_matrix; MGLevelObject mg_interface_in; @@ -773,15 +773,15 @@ void LaplaceProblem::assemble_system() { for (unsigned int j = 0; j < dofs_per_cell; ++j) cell_matrix(i, j) += - (coefficient_value * // epsilon(x) - fe_values.shape_grad(i, q_point) * // * grad phi_i(x) - fe_values.shape_grad(j, q_point) * // * grad phi_j(x) - fe_values.JxW(q_point)); // * dx + coefficient_value * // epsilon(x) + fe_values.shape_grad(i, q_point) * // * grad phi_i(x) + fe_values.shape_grad(j, q_point) * // * grad phi_j(x) + fe_values.JxW(q_point); // * dx cell_rhs(i) += - (fe_values.shape_value(i, q_point) * // grad phi_i(x) - rhs_values[q_point] * // * f(x) - fe_values.JxW(q_point)); // * dx + fe_values.shape_value(i, q_point) * // grad phi_i(x) + rhs_values[q_point] * // * f(x) + fe_values.JxW(q_point); // * dx } cell->get_dof_indices(local_dof_indices); @@ -855,8 +855,8 @@ void LaplaceProblem::assemble_multigrid() for (unsigned int i = 0; i < dofs_per_cell; ++i) for (unsigned int j = 0; j < dofs_per_cell; ++j) cell_matrix(i, j) += - (coefficient_value * fe_values.shape_grad(i, q_point) * - fe_values.shape_grad(j, q_point) * fe_values.JxW(q_point)); + coefficient_value * fe_values.shape_grad(i, q_point) * + fe_values.shape_grad(j, q_point) * fe_values.JxW(q_point); cell->get_mg_dof_indices(local_dof_indices); @@ -1277,7 +1277,7 @@ void LaplaceProblem::estimate() const Coefficient coefficient; - error_estimator.reinit(triangulation.n_active_cells()); + estimated_error_per_cell.reinit(triangulation.n_active_cells()); using Iterator = typename DoFHandler::active_cell_iterator; @@ -1360,11 +1360,11 @@ void LaplaceProblem::estimate() auto copier = [&](const CopyData ©_data) { if (copy_data.cell_index != numbers::invalid_unsigned_int) - error_estimator[copy_data.cell_index] += copy_data.value; + estimated_error_per_cell[copy_data.cell_index] += copy_data.value; for (auto &cdf : copy_data.face_data) for (unsigned int j = 0; j < 2; ++j) - error_estimator[cdf.cell_indices[j]] += cdf.values[j]; + estimated_error_per_cell[cdf.cell_indices[j]] += cdf.values[j]; }; const unsigned int n_gauss_points = degree + 1; @@ -1408,7 +1408,7 @@ void LaplaceProblem::refine_grid() const double refinement_fraction = 1. / (std::pow(2.0, dim) - 1.); parallel::distributed::GridRefinement::refine_and_coarsen_fixed_number( - triangulation, error_estimator, refinement_fraction, 0.0); + triangulation, estimated_error_per_cell, refinement_fraction, 0.0); triangulation.execute_coarsening_and_refinement(); } @@ -1443,8 +1443,9 @@ void LaplaceProblem::output_results(const unsigned int cycle) level(cell->active_cell_index()) = cell->level(); data_out.add_data_vector(level, "level"); - if (error_estimator.size() > 0) - data_out.add_data_vector(error_estimator, "error_estimator"); + if (estimated_error_per_cell.size() > 0) + data_out.add_data_vector(estimated_error_per_cell, + "estimated_error_per_cell"); data_out.build_patches(); -- 2.39.5