From: bangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Sat, 13 Dec 2008 23:27:23 +0000 (+0000)
Subject: Use extractors to access only the velocity values.
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=477d5d05f7796969f9e20d77ceb7743e0d64b375;p=dealii-svn.git

Use extractors to access only the velocity values.

git-svn-id: https://svn.dealii.org/trunk@17935 0785d39b-7218-0410-832d-ea1e28bc413d
---

diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc
index f9e7107a6d..662088e58d 100644
--- a/deal.II/examples/step-31/step-31.cc
+++ b/deal.II/examples/step-31/step-31.cc
@@ -765,26 +765,21 @@ double BoussinesqFlowProblem<dim>::get_maximal_velocity () const
   const unsigned int n_q_points = quadrature_formula.size();
 
   FEValues<dim> fe_values (stokes_fe, quadrature_formula, update_values);
-  std::vector<Vector<double> > stokes_values(n_q_points,
-					     Vector<double>(dim+1));
+  std::vector<Tensor<1,dim> > velocity_values(n_q_points);
   double max_velocity = 0;
 
+  const FEValuesExtractors::Vector velocities (0);
+  
   typename DoFHandler<dim>::active_cell_iterator
     cell = stokes_dof_handler.begin_active(),
     endc = stokes_dof_handler.end();
   for (; cell!=endc; ++cell)
     {
       fe_values.reinit (cell);
-      fe_values.get_function_values (stokes_solution, stokes_values);
+      fe_values[velocities].get_function_values (stokes_solution, velocity_values);
 
       for (unsigned int q=0; q<n_q_points; ++q)
-        {
-          Tensor<1,dim> velocity;
-          for (unsigned int i=0; i<dim; ++i)
-            velocity[i] = stokes_values[q](i);
-
-          max_velocity = std::max (max_velocity, velocity.norm());
-        }
+	max_velocity = std::max (max_velocity, velocity_values[q].norm());
     }
 
   return max_velocity;