From: Wolfgang Bangerth Date: Thu, 18 Oct 2007 15:47:28 +0000 (+0000) Subject: Make the program 20% faster by improving the extract_* functions X-Git-Tag: v8.0.0~9741 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7346d2ddd7851a9c2654b15095da4d1ce422bb10;p=dealii.git Make the program 20% faster by improving the extract_* functions git-svn-id: https://svn.dealii.org/trunk@15344 0785d39b-7218-0410-832d-ea1e28bc413d --- 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");