From 043cc607d993d8d57ad96a1764bc91fae387084a Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 18 Oct 2007 15:47:28 +0000 Subject: [PATCH] Make the program 20% faster by improving the extract_* functions git-svn-id: https://svn.dealii.org/trunk@15344 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-22/step-22.cc | 61 +++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/deal.II/examples/step-22/step-22.cc b/deal.II/examples/step-22/step-22.cc index 12e0d3f5b4..6904b50903 100644 --- a/deal.II/examples/step-22/step-22.cc +++ b/deal.II/examples/step-22/step-22.cc @@ -192,8 +192,11 @@ extract_u (const FEValuesBase &fe_values, { Tensor<1,dim> tmp; - for (unsigned int d=0; d &fe_values, const unsigned int i, const unsigned int q) { - double divergence = 0; - for (unsigned int d=0; d &fe_values, { Tensor<2,dim> tmp; - for (unsigned int d=0; d grad_phi_over_2 = fe_values.shape_grad (i,q) / 2; + + for (unsigned int e=0; e &fe_values, const unsigned int i, const unsigned int q) { - return fe_values.shape_value_component (i,q,dim); + const unsigned int component + = fe_values.get_fe().system_to_component_index(i).first; + + if (component == dim) + return fe_values.shape_value (i,q); + else + return 0; } @@ -248,7 +267,13 @@ double extract_T (const FEValuesBase &fe_values, const unsigned int i, const unsigned int q) { - return fe_values.shape_value_component (i,q,dim+1); + const unsigned int component + = fe_values.get_fe().system_to_component_index(i).first; + + if (component == dim+1) + return fe_values.shape_value (i,q); + else + return 0; } @@ -260,8 +285,12 @@ extract_grad_T (const FEValuesBase &fe_values, const unsigned int q) { Tensor<1,dim> tmp; - for (unsigned int d=0; d::solve () template void BoussinesqFlowProblem::output_results () const { - if (timestep_number % 25 != 0) + if (timestep_number % 10 != 0) return; std::vector solution_names (dim, "velocity"); -- 2.39.5