]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Also optimize get_function_gradients/hessians.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Dec 2008 00:32:48 +0000 (00:32 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 14 Dec 2008 00:32:48 +0000 (00:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@17937 0785d39b-7218-0410-832d-ea1e28bc413d

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

index be2516a19e88fa136fb918106ad4f0453b8f6e92..a2e9d94ed61ee352a15e5eaa30cb525673cc1abb 100644 (file)
@@ -3681,10 +3681,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) *
-         gradient (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_gradients[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_gradients[shape_function_data[shape_function].row_index[d]][q_point]);
+      }
   }
 
 
@@ -3717,10 +3732,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) *
-         hessian (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_hessians[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_hessians[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.