]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Optimize the get_function_values function in Vector.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Dec 2008 00:24:43 +0000 (00:24 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Dec 2008 00:24:43 +0000 (00:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@17936 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe_values.h

index df85b3bd3d57a742506bc50f84a8b5e29821609f..be2516a19e88fa136fb918106ad4f0453b8f6e92 100644 (file)
@@ -3629,10 +3629,25 @@ namespace FEValuesViews
 
     for (unsigned int shape_function=0;
         shape_function<fe_values.fe->dofs_per_cell; ++shape_function)
-      for (unsigned int q_point=0; q_point<fe_values.n_quadrature_points; ++q_point)
-       values[q_point] +=
-         dof_values(shape_function) *
-         value (shape_function, q_point);
+      {
+       const int snc = shape_function_data[shape_function].single_nonzero_component;
+       
+       if (snc == -2)
+                                          // shape function is zero for the
+                                          // selected components
+         continue;
+       else if (snc != -1)
+         for (unsigned int q_point=0; q_point<fe_values.n_quadrature_points; ++q_point)
+           values[q_point][shape_function_data[shape_function].single_nonzero_component_index]
+             += dof_values(shape_function) * fe_values.shape_values(snc,q_point);
+       else
+         for (unsigned int q_point=0; q_point<fe_values.n_quadrature_points; ++q_point)
+           for (unsigned int d=0; d<dim; ++d)    
+             if (shape_function_data[shape_function].is_nonzero_shape_function_component[d])
+               values[q_point][d]
+                 += (dof_values(shape_function) *
+                     fe_values.shape_values(shape_function_data[shape_function].row_index[d],q_point));
+      }
   }
   
 

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.