From 1ada58cbc1e70c58cfab539cc3746f40abac9a2a Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 25 Jun 2018 17:47:58 -0500 Subject: [PATCH] update --- examples/step-4/step-4.cc | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/examples/step-4/step-4.cc b/examples/step-4/step-4.cc index 021be4f293..a63c86d40e 100644 --- a/examples/step-4/step-4.cc +++ b/examples/step-4/step-4.cc @@ -257,11 +257,9 @@ void Step4::make_grid() GridGenerator::hyper_cube(triangulation, -1, 1); triangulation.refine_global(4); - std::cout << " Number of active cells: " // - << triangulation.n_active_cells() // - << std::endl // - << " Total number of cells: " // - << triangulation.n_cells() // + std::cout << " Number of active cells: " << triangulation.n_active_cells() + << std::endl + << " Total number of cells: " << triangulation.n_cells() << std::endl; } @@ -277,8 +275,7 @@ void Step4::setup_system() { dof_handler.distribute_dofs(fe); - std::cout << " Number of degrees of freedom: " // - << dof_handler.n_dofs() // + std::cout << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; DynamicSparsityPattern dsp(dof_handler.n_dofs()); @@ -369,14 +366,15 @@ void Step4::assemble_system() for (unsigned int i = 0; i < dofs_per_cell; ++i) { for (unsigned int j = 0; j < dofs_per_cell; ++j) - cell_matrix(i, j) += (fe_values.shape_grad(i, q_index) * // - fe_values.shape_grad(j, q_index) * // - fe_values.JxW(q_index)); - - cell_rhs(i) += - (fe_values.shape_value(i, q_index) * - right_hand_side.value(fe_values.quadrature_point(q_index)) * - fe_values.JxW(q_index)); + cell_matrix(i, j) += + (fe_values.shape_grad(i, q_index) * // grad phi_i(x_q) + fe_values.shape_grad(j, q_index) * // grad phi_j(x_q) + fe_values.JxW(q_index)); // dx + + const auto x_q = fe_values.quadrature_point(q_index); + cell_rhs(i) += (fe_values.shape_value(i, q_index) * // phi_i(x_q) + right_hand_side.value(x_q) * // f(x_q) + fe_values.JxW(q_index)); // dx } // As a final remark to these loops: when we assemble the local // contributions into cell_matrix(i,j), we have to multiply @@ -491,9 +489,7 @@ void Step4::output_results() const template void Step4::run() { - std::cout << "Solving problem in " // - << dim // - << " space dimensions." // + std::cout << "Solving problem in " << dim << " space dimensions." << std::endl; make_grid(); -- 2.39.5