From: Wolfgang Bangerth Date: Thu, 2 May 2024 18:09:49 +0000 (+0530) Subject: Be uniform in the order of things we start the assembly loop with. X-Git-Tag: v9.6.0-rc1~324^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16955%2Fhead;p=dealii.git Be uniform in the order of things we start the assembly loop with. --- diff --git a/examples/step-20/step-20.cc b/examples/step-20/step-20.cc index d90e8d493d..63285a2705 100644 --- a/examples/step-20/step-20.cc +++ b/examples/step-20/step-20.cc @@ -488,6 +488,7 @@ namespace Step20 for (const auto &cell : dof_handler.active_cell_iterators()) { fe_values.reinit(cell); + local_matrix = 0; local_rhs = 0; diff --git a/examples/step-22/step-22.cc b/examples/step-22/step-22.cc index 453f322966..bb3b712056 100644 --- a/examples/step-22/step-22.cc +++ b/examples/step-22/step-22.cc @@ -659,6 +659,7 @@ namespace Step22 for (const auto &cell : dof_handler.active_cell_iterators()) { fe_values.reinit(cell); + local_matrix = 0; local_preconditioner_matrix = 0; local_rhs = 0; diff --git a/examples/step-4/step-4.cc b/examples/step-4/step-4.cc index d0e622d7c6..4e3f6c9a24 100644 --- a/examples/step-4/step-4.cc +++ b/examples/step-4/step-4.cc @@ -354,6 +354,7 @@ void Step4::assemble_system() for (const auto &cell : dof_handler.active_cell_iterators()) { fe_values.reinit(cell); + cell_matrix = 0; cell_rhs = 0; diff --git a/examples/step-40/step-40.cc b/examples/step-40/step-40.cc index 622700234b..a0d3e51b67 100644 --- a/examples/step-40/step-40.cc +++ b/examples/step-40/step-40.cc @@ -399,11 +399,11 @@ namespace Step40 for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) { + fe_values.reinit(cell); + cell_matrix = 0.; cell_rhs = 0.; - fe_values.reinit(cell); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) { const double rhs_value = diff --git a/examples/step-5/step-5.cc b/examples/step-5/step-5.cc index bba78459f6..394e83629d 100644 --- a/examples/step-5/step-5.cc +++ b/examples/step-5/step-5.cc @@ -178,11 +178,11 @@ void Step5::assemble_system() // coefficient value at each quadrature point. for (const auto &cell : dof_handler.active_cell_iterators()) { + fe_values.reinit(cell); + cell_matrix = 0.; cell_rhs = 0.; - fe_values.reinit(cell); - for (const unsigned int q_index : fe_values.quadrature_point_indices()) { const double current_coefficient = diff --git a/examples/step-6/step-6.cc b/examples/step-6/step-6.cc index 3dd3c7153c..9522232af0 100644 --- a/examples/step-6/step-6.cc +++ b/examples/step-6/step-6.cc @@ -271,11 +271,11 @@ void Step6::assemble_system() for (const auto &cell : dof_handler.active_cell_iterators()) { + fe_values.reinit(cell); + cell_matrix = 0; cell_rhs = 0; - fe_values.reinit(cell); - for (const unsigned int q_index : fe_values.quadrature_point_indices()) { const double current_coefficient = diff --git a/examples/step-7/step-7.cc b/examples/step-7/step-7.cc index b13c306c5c..5be9442e22 100644 --- a/examples/step-7/step-7.cc +++ b/examples/step-7/step-7.cc @@ -583,11 +583,11 @@ namespace Step7 // previous examples, so we only comment on the things that have changed. for (const auto &cell : dof_handler.active_cell_iterators()) { + fe_values.reinit(cell); + cell_matrix = 0.; cell_rhs = 0.; - fe_values.reinit(cell); - right_hand_side.value_list(fe_values.get_quadrature_points(), rhs_values); diff --git a/examples/step-8/step-8.cc b/examples/step-8/step-8.cc index 517f37bda5..f9c29a9480 100644 --- a/examples/step-8/step-8.cc +++ b/examples/step-8/step-8.cc @@ -318,11 +318,11 @@ namespace Step8 // Now we can begin with the loop over all cells: for (const auto &cell : dof_handler.active_cell_iterators()) { + fe_values.reinit(cell); + cell_matrix = 0; cell_rhs = 0; - fe_values.reinit(cell); - // Next we get the values of the coefficients at the quadrature // points. Likewise for the right hand side: lambda.value_list(fe_values.get_quadrature_points(), lambda_values);