]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use common style and re-indent function.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Feb 2012 16:23:44 +0000 (16:23 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Feb 2012 16:23:44 +0000 (16:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@25126 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/fe/fe_values.cc

index 3c9aa45faf80dc2645bb3ee876827057e9cff60d..9d4701a991ca53aaea77ca81696de8d1a0d237b5 100644 (file)
@@ -797,168 +797,190 @@ namespace FEValuesViews
   void
   Vector<dim,spacedim>::
   get_function_curls (const InputVector &fe_function,
-               std::vector<curl_type> &curls) const {
-     typedef FEValuesBase<dim,spacedim> FVB;
-
-     Assert (fe_values.update_flags & update_gradients,
-         typename FVB::ExcAccessToUninitializedField());
-     Assert (curls.size() == fe_values.n_quadrature_points,
-         ExcDimensionMismatch (curls.size(), fe_values.n_quadrature_points));
-     Assert (fe_values.present_cell.get () != 0,
-         ExcMessage ("FEValues object is not reinited to any cell"));
-     Assert (fe_function.size () == fe_values.present_cell->n_dofs_for_dof_handler (),
-         ExcDimensionMismatch (fe_function.size (), fe_values.present_cell->n_dofs_for_dof_handler ()));
-     // get function values of dofs on this cell
-     dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
-     fe_values.present_cell->get_interpolated_dof_values (fe_function, dof_values);
-
-     std::fill (curls.begin (), curls.end (), curl_type ());
-
-     switch (dim) {
-       case 1: {
-           Assert (false, ExcMessage("Computing the curl in 1d is not a useful operation"));
-          break;
+                     std::vector<curl_type> &curls) const
+  {
+    typedef FEValuesBase<dim,spacedim> FVB;
+
+    Assert (fe_values.update_flags & update_gradients,
+           typename FVB::ExcAccessToUninitializedField());
+    Assert (curls.size() == fe_values.n_quadrature_points,
+           ExcDimensionMismatch (curls.size(), fe_values.n_quadrature_points));
+    Assert (fe_values.present_cell.get () != 0,
+           ExcMessage ("FEValues object is not reinited to any cell"));
+    Assert (fe_function.size () == fe_values.present_cell->n_dofs_for_dof_handler (),
+           ExcDimensionMismatch (fe_function.size (), fe_values.present_cell->n_dofs_for_dof_handler ()));
+                                    // get function values of dofs on this cell
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
+    fe_values.present_cell->get_interpolated_dof_values (fe_function, dof_values);
+
+    std::fill (curls.begin (), curls.end (), curl_type ());
+
+    switch (dim)
+      {
+       case 1:
+       {
+         Assert (false, ExcMessage("Computing the curl in 1d is not a useful operation"));
+         break;
        }
 
-        case 2: {
-           for (unsigned int shape_function = 0;
-            shape_function < fe_values.fe->dofs_per_cell; ++shape_function) {
+        case 2:
+       {
+         for (unsigned int shape_function = 0;
+              shape_function < fe_values.fe->dofs_per_cell; ++shape_function)
+           {
               const int snc = shape_function_data[shape_function].single_nonzero_component;
 
               if (snc == -2)
-                 // shape function is zero for the selected components
-                 continue;
+                                                // shape function is zero for the selected components
+               continue;
 
               const double value = dof_values (shape_function);
 
               if (value == 0.)
-                 continue;
+               continue;
 
-              if (snc != -1) {
-                 const unsigned int comp =
-                   shape_function_data[shape_function].single_nonzero_component_index;
-                 const Tensor<1, spacedim> * shape_gradient_ptr = &fe_values.shape_gradients[snc][0];
+              if (snc != -1)
+               {
+                 const Tensor<1, spacedim> * shape_gradient_ptr = &fe_values.shape_gradients[snc][0];
 
-                 switch (shape_function_data[shape_function].single_nonzero_component_index) {
-                    case 0: {
-                       for (unsigned int q_point = 0;
-                        q_point < fe_values.n_quadrature_points; ++q_point)
+                 switch (shape_function_data[shape_function].single_nonzero_component_index)
+                   {
+                     case 0:
+                     {
+                       for (unsigned int q_point = 0;
+                            q_point < fe_values.n_quadrature_points; ++q_point)
                           curls[q_point][0] -= value * (*shape_gradient_ptr++)[1];
 
-                       break;
-                    }
-
-                    default:
-                       for (unsigned int q_point = 0;
-                        q_point < fe_values.n_quadrature_points; ++q_point)
-                          curls[q_point][0] += value * (*shape_gradient_ptr)[0];
-                 }
-              }
-
-              else {
-                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[0]) {
-                    const Tensor<1,spacedim> * shape_gradient_ptr =
-                      &fe_values.shape_gradients[shape_function_data[shape_function].row_index[0]][0];
-
-                    for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
-                       curls[q_point][0] -= value * (*shape_gradient_ptr++)[1];
-                 }
-
-                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[1]) {
-                    const Tensor<1,spacedim> * shape_gradient_ptr =
-                      &fe_values.shape_gradients[shape_function_data[shape_function].row_index[1]][0];
-
-                    for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
-                       curls[q_point][0] += value * (*shape_gradient_ptr++)[0];
-                 }
-              }
-           }
-           break;
+                       break;
+                     }
+
+                     default:
+                           for (unsigned int q_point = 0;
+                                q_point < fe_values.n_quadrature_points; ++q_point)
+                             curls[q_point][0] += value * (*shape_gradient_ptr)[0];
+                   }
+               }
+              else
+               {
+                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[0])
+                   {
+                     const Tensor<1,spacedim> * shape_gradient_ptr =
+                       &fe_values.shape_gradients[shape_function_data[shape_function].row_index[0]][0];
+
+                     for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
+                       curls[q_point][0] -= value * (*shape_gradient_ptr++)[1];
+                   }
+
+                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[1])
+                   {
+                     const Tensor<1,spacedim> * shape_gradient_ptr =
+                       &fe_values.shape_gradients[shape_function_data[shape_function].row_index[1]][0];
+
+                     for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
+                       curls[q_point][0] += value * (*shape_gradient_ptr++)[0];
+                   }
+               }
+           }
+         break;
         }
 
-        case 3: {
-           for (unsigned int shape_function = 0;
-            shape_function < fe_values.fe->dofs_per_cell; ++shape_function) {
+        case 3:
+       {
+         for (unsigned int shape_function = 0;
+              shape_function < fe_values.fe->dofs_per_cell; ++shape_function)
+           {
               const int snc = shape_function_data[shape_function].single_nonzero_component;
 
               if (snc == -2)
-                 // shape function is zero for the selected components
-                 continue;
+                                                // shape function is zero for the selected components
+               continue;
 
               const double value = dof_values (shape_function);
 
               if (value == 0.)
-                 continue;
-
-              if (snc != -1) {
-                 const unsigned int comp =
-                   shape_function_data[shape_function].single_nonzero_component_index;
-                 const Tensor<1, spacedim> * shape_gradient_ptr = &fe_values.shape_gradients[snc][0];
-
-                 switch (shape_function_data[shape_function].single_nonzero_component_index) {
-                    case 0: {
-                       for (unsigned int q_point = 0;
-                        q_point < fe_values.n_quadrature_points; ++q_point) {
-                          curls[q_point][1] += value * (*shape_gradient_ptr)[2];
-                          curls[q_point][2] -= value * (*shape_gradient_ptr++)[1];
-                       }
-
-                       break;
-                    }
-
-                    case 1: {
-                       for (unsigned int q_point = 0;
-                        q_point < fe_values.n_quadrature_points; ++q_point) {
-                          curls[q_point][0] -= value * (*shape_gradient_ptr)[2];
-                          curls[q_point][2] += value * (*shape_gradient_ptr++)[0];
-                       }
-
-                       break;
-                    }
-
-                    default:
-                       for (unsigned int q_point = 0;
-                        q_point < fe_values.n_quadrature_points; ++q_point) {
-                          curls[q_point][0] += value * (*shape_gradient_ptr)[1];
-                          curls[q_point][1] -= value * (*shape_gradient_ptr++)[0];
-                       }
-                 }
-              }
-
-              else {
-                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[0]) {
-                    const Tensor<1,spacedim> * shape_gradient_ptr =
-                      &fe_values.shape_gradients[shape_function_data[shape_function].row_index[0]][0];
-
-                    for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point) {
-                       curls[q_point][1] += value * (*shape_gradient_ptr)[2];
-                       curls[q_point][2] -= value * (*shape_gradient_ptr++)[1];
-                    }
-                 }
-
-                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[1]) {
-                    const Tensor<1,spacedim> * shape_gradient_ptr =
-                      &fe_values.shape_gradients[shape_function_data[shape_function].row_index[1]][0];
-
-                    for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point) {
-                       curls[q_point][0] -= value * (*shape_gradient_ptr)[2];
-                       curls[q_point][2] += value * (*shape_gradient_ptr++)[0];
-                    }
-                 }
-
-                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[2]) {
-                    const Tensor<1,spacedim> * shape_gradient_ptr =
-                      &fe_values.shape_gradients[shape_function_data[shape_function].row_index[2]][0];
-
-                    for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point) {
-                       curls[q_point][0] += value * (*shape_gradient_ptr)[1];
-                       curls[q_point][1] -= value * (*shape_gradient_ptr++)[0];
-                    }
-                 }
-              }
-           }
+               continue;
+
+              if (snc != -1)
+               {
+                 const Tensor<1, spacedim> * shape_gradient_ptr = &fe_values.shape_gradients[snc][0];
+
+                 switch (shape_function_data[shape_function].single_nonzero_component_index)
+                   {
+                     case 0:
+                     {
+                       for (unsigned int q_point = 0;
+                            q_point < fe_values.n_quadrature_points; ++q_point)
+                         {
+                           curls[q_point][1] += value * (*shape_gradient_ptr)[2];
+                           curls[q_point][2] -= value * (*shape_gradient_ptr++)[1];
+                         }
+
+                       break;
+                     }
+
+                     case 1:
+                     {
+                       for (unsigned int q_point = 0;
+                            q_point < fe_values.n_quadrature_points; ++q_point)
+                         {
+                           curls[q_point][0] -= value * (*shape_gradient_ptr)[2];
+                           curls[q_point][2] += value * (*shape_gradient_ptr++)[0];
+                         }
+
+                       break;
+                     }
+
+                     default:
+                           for (unsigned int q_point = 0;
+                                q_point < fe_values.n_quadrature_points; ++q_point)
+                             {
+                               curls[q_point][0] += value * (*shape_gradient_ptr)[1];
+                               curls[q_point][1] -= value * (*shape_gradient_ptr++)[0];
+                             }
+                   }
+               }
+
+              else
+               {
+                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[0])
+                   {
+                     const Tensor<1,spacedim> * shape_gradient_ptr =
+                       &fe_values.shape_gradients[shape_function_data[shape_function].row_index[0]][0];
+
+                     for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
+                       {
+                         curls[q_point][1] += value * (*shape_gradient_ptr)[2];
+                         curls[q_point][2] -= value * (*shape_gradient_ptr++)[1];
+                       }
+                   }
+
+                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[1])
+                   {
+                     const Tensor<1,spacedim> * shape_gradient_ptr =
+                       &fe_values.shape_gradients[shape_function_data[shape_function].row_index[1]][0];
+
+                     for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
+                       {
+                         curls[q_point][0] -= value * (*shape_gradient_ptr)[2];
+                         curls[q_point][2] += value * (*shape_gradient_ptr++)[0];
+                       }
+                   }
+
+                 if (shape_function_data[shape_function].is_nonzero_shape_function_component[2])
+                   {
+                     const Tensor<1,spacedim> * shape_gradient_ptr =
+                       &fe_values.shape_gradients[shape_function_data[shape_function].row_index[2]][0];
+
+                     for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point)
+                       {
+                         curls[q_point][0] += value * (*shape_gradient_ptr)[1];
+                         curls[q_point][1] -= value * (*shape_gradient_ptr++)[0];
+                       }
+                   }
+               }
+           }
         }
-     }
+      }
   }
 
 

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.