From: Jean-Paul Pelteret Date: Wed, 29 Apr 2020 20:38:40 +0000 (+0200) Subject: Update physics tests to use QP range based loop X-Git-Tag: v9.2.0-rc1~111^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ce91b5d89407ba055e18b5e041deedab011afae;p=dealii.git Update physics tests to use QP range based loop --- diff --git a/tests/physics/step-18-rotation_matrix.cc b/tests/physics/step-18-rotation_matrix.cc index e1a61f1a7c..9fce0e15a6 100644 --- a/tests/physics/step-18-rotation_matrix.cc +++ b/tests/physics/step-18-rotation_matrix.cc @@ -402,7 +402,8 @@ namespace Step18 fe_values.reinit(cell); for (unsigned int i = 0; i < dofs_per_cell; ++i) for (unsigned int j = 0; j < dofs_per_cell; ++j) - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values.quadrature_point_indices()) { const SymmetricTensor<2, dim> eps_phi_i = get_strain(fe_values, i, q_point), @@ -418,7 +419,8 @@ namespace Step18 { const unsigned int component_i = fe.system_to_component_index(i).first; - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values.quadrature_point_indices()) { const SymmetricTensor<2, dim> &old_stress = local_quadrature_points_data[q_point].old_stress; diff --git a/tests/physics/step-18.cc b/tests/physics/step-18.cc index 0292da33ea..cdda878fa0 100644 --- a/tests/physics/step-18.cc +++ b/tests/physics/step-18.cc @@ -418,7 +418,8 @@ namespace Step18 fe_values.reinit(cell); for (unsigned int i = 0; i < dofs_per_cell; ++i) for (unsigned int j = 0; j < dofs_per_cell; ++j) - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values.quadrature_point_indices()) { const SymmetricTensor<2, dim> eps_phi_i = get_strain(fe_values, i, q_point), @@ -434,7 +435,8 @@ namespace Step18 { const unsigned int component_i = fe.system_to_component_index(i).first; - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values.quadrature_point_indices()) { const SymmetricTensor<2, dim> &old_stress = local_quadrature_points_data[q_point].old_stress; diff --git a/tests/physics/step-44-standard_tensors-material_push_forward.cc b/tests/physics/step-44-standard_tensors-material_push_forward.cc index 52973660b9..ddff955d07 100644 --- a/tests/physics/step-44-standard_tensors-material_push_forward.cc +++ b/tests/physics/step-44-standard_tensors-material_push_forward.cc @@ -1426,7 +1426,8 @@ namespace Step44 scratch.solution_total, scratch.solution_values_p_total); scratch.fe_values_ref[J_fe].get_function_values( scratch.solution_total, scratch.solution_values_J_total); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) lqph[q_point]->update_values(scratch.solution_grads_u_total[q_point], scratch.solution_values_p_total[q_point], scratch.solution_values_J_total[q_point]); @@ -1535,7 +1536,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double JxW = fe_values_ref.JxW(q_point); @@ -1560,7 +1562,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double J_tilde_qp = lqph[q_point]->get_J_tilde(); @@ -1658,7 +1661,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1681,7 +1685,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> tau = lqph[q_point]->get_tau(); const SymmetricTensor<4, dim> Jc = lqph[q_point]->get_Jc(); @@ -1783,7 +1788,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1802,7 +1808,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const SymmetricTensor<2, dim> tau = lqph[q_point]->get_tau(); const double det_F = lqph[q_point]->get_det_F(); @@ -1831,8 +1838,8 @@ namespace Step44 cell->face(face)->boundary_id() == 6) { scratch.fe_face_values_ref.reinit(cell, face); - for (unsigned int f_q_point = 0; f_q_point < n_q_points_f; - ++f_q_point) + for (const unsigned int f_q_point : + scratch.fe_face_values_ref.quadrature_point_indices()) { const Tensor<1, dim> &N = scratch.fe_face_values_ref.normal_vector(f_q_point); diff --git a/tests/physics/step-44-standard_tensors-spatial.cc b/tests/physics/step-44-standard_tensors-spatial.cc index d5463d9a4e..ac83a20a5d 100644 --- a/tests/physics/step-44-standard_tensors-spatial.cc +++ b/tests/physics/step-44-standard_tensors-spatial.cc @@ -1226,7 +1226,8 @@ namespace Step44 scratch.solution_total, scratch.solution_values_p_total); scratch.fe_values_ref[J_fe].get_function_values( scratch.solution_total, scratch.solution_values_J_total); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) lqph[q_point]->update_values(scratch.solution_grads_u_total[q_point], scratch.solution_values_p_total[q_point], scratch.solution_values_J_total[q_point]); @@ -1335,7 +1336,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double JxW = fe_values_ref.JxW(q_point); @@ -1360,7 +1362,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double J_tilde_qp = lqph[q_point]->get_J_tilde(); @@ -1458,7 +1461,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1481,7 +1485,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> tau = lqph[q_point]->get_tau(); const SymmetricTensor<4, dim> Jc = lqph[q_point]->get_Jc(); @@ -1583,7 +1588,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1602,7 +1608,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const SymmetricTensor<2, dim> tau = lqph[q_point]->get_tau(); const double det_F = lqph[q_point]->get_det_F(); @@ -1631,8 +1638,8 @@ namespace Step44 cell->face(face)->boundary_id() == 6) { scratch.fe_face_values_ref.reinit(cell, face); - for (unsigned int f_q_point = 0; f_q_point < n_q_points_f; - ++f_q_point) + for (const unsigned int f_q_point : + scratch.fe_face_values_ref.quadrature_point_indices()) { const Tensor<1, dim> &N = scratch.fe_face_values_ref.normal_vector(f_q_point); diff --git a/tests/physics/step-44.cc b/tests/physics/step-44.cc index 1f050ffc8f..0cbbecb2fb 100644 --- a/tests/physics/step-44.cc +++ b/tests/physics/step-44.cc @@ -1239,7 +1239,8 @@ namespace Step44 scratch.solution_total, scratch.solution_values_p_total); scratch.fe_values_ref[J_fe].get_function_values( scratch.solution_total, scratch.solution_values_J_total); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) lqph[q_point]->update_values(scratch.solution_grads_u_total[q_point], scratch.solution_values_p_total[q_point], scratch.solution_values_J_total[q_point]); @@ -1348,7 +1349,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double JxW = fe_values_ref.JxW(q_point); @@ -1373,7 +1375,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + fe_values_ref.quadrature_point_indices()) { const double det_F_qp = lqph[q_point]->get_det_F(); const double J_tilde_qp = lqph[q_point]->get_J_tilde(); @@ -1471,7 +1474,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1494,7 +1498,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> tau = lqph[q_point]->get_tau(); const SymmetricTensor<4, dim> Jc = lqph[q_point]->get_Jc(); @@ -1594,7 +1599,8 @@ namespace Step44 const std::vector>> lqph = quadrature_point_history.get_data(cell); Assert(lqph.size() == n_q_points, ExcInternalError()); - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const Tensor<2, dim> F_inv = lqph[q_point]->get_F_inv(); for (unsigned int k = 0; k < dofs_per_cell; ++k) @@ -1613,7 +1619,8 @@ namespace Step44 Assert(k_group <= J_dof, ExcInternalError()); } } - for (unsigned int q_point = 0; q_point < n_q_points; ++q_point) + for (const unsigned int q_point : + scratch.fe_values_ref.quadrature_point_indices()) { const SymmetricTensor<2, dim> tau = lqph[q_point]->get_tau(); const double det_F = lqph[q_point]->get_det_F(); @@ -1642,8 +1649,8 @@ namespace Step44 cell->face(face)->boundary_id() == 6) { scratch.fe_face_values_ref.reinit(cell, face); - for (unsigned int f_q_point = 0; f_q_point < n_q_points_f; - ++f_q_point) + for (const unsigned int f_q_point : + scratch.fe_face_values_ref.quadrature_point_indices()) { const Tensor<1, dim> &N = scratch.fe_face_values_ref.normal_vector(f_q_point);