]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use extractors to access only the velocity values.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 13 Dec 2008 23:27:23 +0000 (23:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 13 Dec 2008 23:27:23 +0000 (23:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@17935 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-31/step-31.cc

index f9e7107a6d07d7fddc6ce85fc1b4cd50dc76386d..662088e58dc4fdd901c8baa1ce25357e40817b31 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.