]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Resolve an issue where code could not be compiled. Use the opportunity to
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Nov 2013 00:53:54 +0000 (00:53 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Nov 2013 00:53:54 +0000 (00:53 +0000)
clean it up by removing a separate fuction that wasn't strictly needed.

git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@31809 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/fe/mapping_q1.cc

index 7c708daea1560159ed56a1d9de9432393072a969..d6524930d8a657e114a0f0e3baceebcaa40c2488 100644 (file)
@@ -89,254 +89,6 @@ MappingQ1<dim,spacedim>::compute_shapes (const std::vector<Point<dim> > &unit_po
 }
 
 
-namespace internal
-{
-  namespace MappingQ1
-  {
-    template <int spacedim>
-    void
-    compute_shapes_virtual (const unsigned int            n_shape_functions,
-                            const std::vector<Point<1> > &unit_points,
-                            typename dealii::MappingQ1<1,spacedim>::InternalData &data)
-    {
-      const unsigned int n_points=unit_points.size();
-      for (unsigned int k = 0 ; k < n_points ; ++k)
-        {
-          double x = unit_points[k](0);
-
-          if (data.shape_values.size()!=0)
-            {
-              Assert(data.shape_values.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.shape(k,0) = 1.-x;
-              data.shape(k,1) = x;
-            }
-          if (data.shape_derivatives.size()!=0)
-            {
-              Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.derivative(k,0)[0] = -1.;
-              data.derivative(k,1)[0] = 1.;
-            }
-          if (data.shape_second_derivatives.size()!=0)
-            {
-              // the following may or may not
-              // work if dim != spacedim
-              Assert (spacedim == 1, ExcNotImplemented());
-
-              Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.second_derivative(k,0)[0][0] = 0;
-              data.second_derivative(k,1)[0][0] = 0;
-            }
-        }
-    }
-
-
-    template <int spacedim>
-    void
-    compute_shapes_virtual (const unsigned int            n_shape_functions,
-                            const std::vector<Point<2> > &unit_points,
-                            typename dealii::MappingQ1<2,spacedim>::InternalData &data)
-    {
-      const unsigned int n_points=unit_points.size();
-      for (unsigned int k = 0 ; k < n_points ; ++k)
-        {
-          double x = unit_points[k](0);
-          double y = unit_points[k](1);
-
-          if (data.shape_values.size()!=0)
-            {
-              Assert(data.shape_values.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.shape(k,0) = (1.-x)*(1.-y);
-              data.shape(k,1) = x*(1.-y);
-              data.shape(k,2) = (1.-x)*y;
-              data.shape(k,3) = x*y;
-            }
-          if (data.shape_derivatives.size()!=0)
-            {
-              Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.derivative(k,0)[0] = (y-1.);
-              data.derivative(k,1)[0] = (1.-y);
-              data.derivative(k,2)[0] = -y;
-              data.derivative(k,3)[0] = y;
-              data.derivative(k,0)[1] = (x-1.);
-              data.derivative(k,1)[1] = -x;
-              data.derivative(k,2)[1] = (1.-x);
-              data.derivative(k,3)[1] = x;
-            }
-          if (data.shape_second_derivatives.size()!=0)
-            {
-              Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.second_derivative(k,0)[0][0] = 0;
-              data.second_derivative(k,1)[0][0] = 0;
-              data.second_derivative(k,2)[0][0] = 0;
-              data.second_derivative(k,3)[0][0] = 0;
-              data.second_derivative(k,0)[0][1] = 1.;
-              data.second_derivative(k,1)[0][1] = -1.;
-              data.second_derivative(k,2)[0][1] = -1.;
-              data.second_derivative(k,3)[0][1] = 1.;
-              data.second_derivative(k,0)[1][0] = 1.;
-              data.second_derivative(k,1)[1][0] = -1.;
-              data.second_derivative(k,2)[1][0] = -1.;
-              data.second_derivative(k,3)[1][0] = 1.;
-              data.second_derivative(k,0)[1][1] = 0;
-              data.second_derivative(k,1)[1][1] = 0;
-              data.second_derivative(k,2)[1][1] = 0;
-              data.second_derivative(k,3)[1][1] = 0;
-            }
-        }
-    }
-
-
-
-    template <int spacedim>
-    void
-    compute_shapes_virtual (const unsigned int            n_shape_functions,
-                            const std::vector<Point<3> > &unit_points,
-                            typename dealii::MappingQ1<3,spacedim>::InternalData &data)
-    {
-      const unsigned int n_points=unit_points.size();
-      for (unsigned int k = 0 ; k < n_points ; ++k)
-        {
-          double x = unit_points[k](0);
-          double y = unit_points[k](1);
-          double z = unit_points[k](2);
-
-          if (data.shape_values.size()!=0)
-            {
-              Assert(data.shape_values.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.shape(k,0) = (1.-x)*(1.-y)*(1.-z);
-              data.shape(k,1) = x*(1.-y)*(1.-z);
-              data.shape(k,2) = (1.-x)*y*(1.-z);
-              data.shape(k,3) = x*y*(1.-z);
-              data.shape(k,4) = (1.-x)*(1.-y)*z;
-              data.shape(k,5) = x*(1.-y)*z;
-              data.shape(k,6) = (1.-x)*y*z;
-              data.shape(k,7) = x*y*z;
-            }
-          if (data.shape_derivatives.size()!=0)
-            {
-              Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.derivative(k,0)[0] = (y-1.)*(1.-z);
-              data.derivative(k,1)[0] = (1.-y)*(1.-z);
-              data.derivative(k,2)[0] = -y*(1.-z);
-              data.derivative(k,3)[0] = y*(1.-z);
-              data.derivative(k,4)[0] = (y-1.)*z;
-              data.derivative(k,5)[0] = (1.-y)*z;
-              data.derivative(k,6)[0] = -y*z;
-              data.derivative(k,7)[0] = y*z;
-              data.derivative(k,0)[1] = (x-1.)*(1.-z);
-              data.derivative(k,1)[1] = -x*(1.-z);
-              data.derivative(k,2)[1] = (1.-x)*(1.-z);
-              data.derivative(k,3)[1] = x*(1.-z);
-              data.derivative(k,4)[1] = (x-1.)*z;
-              data.derivative(k,5)[1] = -x*z;
-              data.derivative(k,6)[1] = (1.-x)*z;
-              data.derivative(k,7)[1] = x*z;
-              data.derivative(k,0)[2] = (x-1)*(1.-y);
-              data.derivative(k,1)[2] = x*(y-1.);
-              data.derivative(k,2)[2] = (x-1.)*y;
-              data.derivative(k,3)[2] = -x*y;
-              data.derivative(k,4)[2] = (1.-x)*(1.-y);
-              data.derivative(k,5)[2] = x*(1.-y);
-              data.derivative(k,6)[2] = (1.-x)*y;
-              data.derivative(k,7)[2] = x*y;
-            }
-          if (data.shape_second_derivatives.size()!=0)
-            {
-              // the following may or may not
-              // work if dim != spacedim
-              Assert (spacedim == 3, ExcNotImplemented());
-
-              Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
-                     ExcInternalError());
-              data.second_derivative(k,0)[0][0] = 0;
-              data.second_derivative(k,1)[0][0] = 0;
-              data.second_derivative(k,2)[0][0] = 0;
-              data.second_derivative(k,3)[0][0] = 0;
-              data.second_derivative(k,4)[0][0] = 0;
-              data.second_derivative(k,5)[0][0] = 0;
-              data.second_derivative(k,6)[0][0] = 0;
-              data.second_derivative(k,7)[0][0] = 0;
-              data.second_derivative(k,0)[1][1] = 0;
-              data.second_derivative(k,1)[1][1] = 0;
-              data.second_derivative(k,2)[1][1] = 0;
-              data.second_derivative(k,3)[1][1] = 0;
-              data.second_derivative(k,4)[1][1] = 0;
-              data.second_derivative(k,5)[1][1] = 0;
-              data.second_derivative(k,6)[1][1] = 0;
-              data.second_derivative(k,7)[1][1] = 0;
-              data.second_derivative(k,0)[2][2] = 0;
-              data.second_derivative(k,1)[2][2] = 0;
-              data.second_derivative(k,2)[2][2] = 0;
-              data.second_derivative(k,3)[2][2] = 0;
-              data.second_derivative(k,4)[2][2] = 0;
-              data.second_derivative(k,5)[2][2] = 0;
-              data.second_derivative(k,6)[2][2] = 0;
-              data.second_derivative(k,7)[2][2] = 0;
-
-              data.second_derivative(k,0)[0][1] = (1.-z);
-              data.second_derivative(k,1)[0][1] = -(1.-z);
-              data.second_derivative(k,2)[0][1] = -(1.-z);
-              data.second_derivative(k,3)[0][1] = (1.-z);
-              data.second_derivative(k,4)[0][1] = z;
-              data.second_derivative(k,5)[0][1] = -z;
-              data.second_derivative(k,6)[0][1] = -z;
-              data.second_derivative(k,7)[0][1] = z;
-              data.second_derivative(k,0)[1][0] = (1.-z);
-              data.second_derivative(k,1)[1][0] = -(1.-z);
-              data.second_derivative(k,2)[1][0] = -(1.-z);
-              data.second_derivative(k,3)[1][0] = (1.-z);
-              data.second_derivative(k,4)[1][0] = z;
-              data.second_derivative(k,5)[1][0] = -z;
-              data.second_derivative(k,6)[1][0] = -z;
-              data.second_derivative(k,7)[1][0] = z;
-
-              data.second_derivative(k,0)[0][2] = (1.-y);
-              data.second_derivative(k,1)[0][2] = -(1.-y);
-              data.second_derivative(k,2)[0][2] = y;
-              data.second_derivative(k,3)[0][2] = -y;
-              data.second_derivative(k,4)[0][2] = -(1.-y);
-              data.second_derivative(k,5)[0][2] = (1.-y);
-              data.second_derivative(k,6)[0][2] = -y;
-              data.second_derivative(k,7)[0][2] = y;
-              data.second_derivative(k,0)[2][0] = (1.-y);
-              data.second_derivative(k,1)[2][0] = -(1.-y);
-              data.second_derivative(k,2)[2][0] = y;
-              data.second_derivative(k,3)[2][0] = -y;
-              data.second_derivative(k,4)[2][0] = -(1.-y);
-              data.second_derivative(k,5)[2][0] = (1.-y);
-              data.second_derivative(k,6)[2][0] = -y;
-              data.second_derivative(k,7)[2][0] = y;
-
-              data.second_derivative(k,0)[1][2] = (1.-x);
-              data.second_derivative(k,1)[1][2] = x;
-              data.second_derivative(k,2)[1][2] = -(1.-x);
-              data.second_derivative(k,3)[1][2] = -x;
-              data.second_derivative(k,4)[1][2] = -(1.-x);
-              data.second_derivative(k,5)[1][2] = -x;
-              data.second_derivative(k,6)[1][2] = (1.-x);
-              data.second_derivative(k,7)[1][2] = x;
-              data.second_derivative(k,0)[2][1] = (1.-x);
-              data.second_derivative(k,1)[2][1] = x;
-              data.second_derivative(k,2)[2][1] = -(1.-x);
-              data.second_derivative(k,3)[2][1] = -x;
-              data.second_derivative(k,4)[2][1] = -(1.-x);
-              data.second_derivative(k,5)[2][1] = -x;
-              data.second_derivative(k,6)[2][1] = (1.-x);
-              data.second_derivative(k,7)[2][1] = x;
-            }
-        }
-    }
-  }
-}
-
 
 template<int dim, int spacedim>
 void
@@ -344,9 +96,235 @@ MappingQ1<dim, spacedim>::
 compute_shapes_virtual (const std::vector<Point<dim> > &unit_points,
                         InternalData &data) const
 {
-  internal::MappingQ1::
-  compute_shapes_virtual<spacedim> (n_shape_functions,
-                                    unit_points, data);
+  const unsigned int n_points=unit_points.size();
+
+  for (unsigned int k = 0 ; k < n_points ; ++k)
+    {
+      switch (dim)
+       {
+       case 1:
+       {
+         double x = unit_points[k](0);
+
+         if (data.shape_values.size()!=0)
+           {
+             Assert(data.shape_values.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.shape(k,0) = 1.-x;
+             data.shape(k,1) = x;
+           }
+         if (data.shape_derivatives.size()!=0)
+           {
+             Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.derivative(k,0)[0] = -1.;
+             data.derivative(k,1)[0] = 1.;
+           }
+         if (data.shape_second_derivatives.size()!=0)
+           {
+             // the following may or may not
+             // work if dim != spacedim
+             Assert (spacedim == 1, ExcNotImplemented());
+
+             Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.second_derivative(k,0)[0][0] = 0;
+             data.second_derivative(k,1)[0][0] = 0;
+           }
+         break;
+       }
+
+       case 2:
+       {
+         double x = unit_points[k](0);
+         double y = unit_points[k](1);
+
+         if (data.shape_values.size()!=0)
+           {
+             Assert(data.shape_values.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.shape(k,0) = (1.-x)*(1.-y);
+             data.shape(k,1) = x*(1.-y);
+             data.shape(k,2) = (1.-x)*y;
+             data.shape(k,3) = x*y;
+           }
+         if (data.shape_derivatives.size()!=0)
+           {
+             Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.derivative(k,0)[0] = (y-1.);
+             data.derivative(k,1)[0] = (1.-y);
+             data.derivative(k,2)[0] = -y;
+             data.derivative(k,3)[0] = y;
+             data.derivative(k,0)[1] = (x-1.);
+             data.derivative(k,1)[1] = -x;
+             data.derivative(k,2)[1] = (1.-x);
+             data.derivative(k,3)[1] = x;
+           }
+         if (data.shape_second_derivatives.size()!=0)
+           {
+             Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.second_derivative(k,0)[0][0] = 0;
+             data.second_derivative(k,1)[0][0] = 0;
+             data.second_derivative(k,2)[0][0] = 0;
+             data.second_derivative(k,3)[0][0] = 0;
+             data.second_derivative(k,0)[0][1] = 1.;
+             data.second_derivative(k,1)[0][1] = -1.;
+             data.second_derivative(k,2)[0][1] = -1.;
+             data.second_derivative(k,3)[0][1] = 1.;
+             data.second_derivative(k,0)[1][0] = 1.;
+             data.second_derivative(k,1)[1][0] = -1.;
+             data.second_derivative(k,2)[1][0] = -1.;
+             data.second_derivative(k,3)[1][0] = 1.;
+             data.second_derivative(k,0)[1][1] = 0;
+             data.second_derivative(k,1)[1][1] = 0;
+             data.second_derivative(k,2)[1][1] = 0;
+             data.second_derivative(k,3)[1][1] = 0;
+           }
+
+         break;
+       }
+
+       case 3:
+       {
+         double x = unit_points[k](0);
+         double y = unit_points[k](1);
+         double z = unit_points[k](2);
+
+         if (data.shape_values.size()!=0)
+           {
+             Assert(data.shape_values.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.shape(k,0) = (1.-x)*(1.-y)*(1.-z);
+             data.shape(k,1) = x*(1.-y)*(1.-z);
+             data.shape(k,2) = (1.-x)*y*(1.-z);
+             data.shape(k,3) = x*y*(1.-z);
+             data.shape(k,4) = (1.-x)*(1.-y)*z;
+             data.shape(k,5) = x*(1.-y)*z;
+             data.shape(k,6) = (1.-x)*y*z;
+             data.shape(k,7) = x*y*z;
+           }
+         if (data.shape_derivatives.size()!=0)
+           {
+             Assert(data.shape_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.derivative(k,0)[0] = (y-1.)*(1.-z);
+             data.derivative(k,1)[0] = (1.-y)*(1.-z);
+             data.derivative(k,2)[0] = -y*(1.-z);
+             data.derivative(k,3)[0] = y*(1.-z);
+             data.derivative(k,4)[0] = (y-1.)*z;
+             data.derivative(k,5)[0] = (1.-y)*z;
+             data.derivative(k,6)[0] = -y*z;
+             data.derivative(k,7)[0] = y*z;
+             data.derivative(k,0)[1] = (x-1.)*(1.-z);
+             data.derivative(k,1)[1] = -x*(1.-z);
+             data.derivative(k,2)[1] = (1.-x)*(1.-z);
+             data.derivative(k,3)[1] = x*(1.-z);
+             data.derivative(k,4)[1] = (x-1.)*z;
+             data.derivative(k,5)[1] = -x*z;
+             data.derivative(k,6)[1] = (1.-x)*z;
+             data.derivative(k,7)[1] = x*z;
+             data.derivative(k,0)[2] = (x-1)*(1.-y);
+             data.derivative(k,1)[2] = x*(y-1.);
+             data.derivative(k,2)[2] = (x-1.)*y;
+             data.derivative(k,3)[2] = -x*y;
+             data.derivative(k,4)[2] = (1.-x)*(1.-y);
+             data.derivative(k,5)[2] = x*(1.-y);
+             data.derivative(k,6)[2] = (1.-x)*y;
+             data.derivative(k,7)[2] = x*y;
+           }
+         if (data.shape_second_derivatives.size()!=0)
+           {
+             // the following may or may not
+             // work if dim != spacedim
+             Assert (spacedim == 3, ExcNotImplemented());
+
+             Assert(data.shape_second_derivatives.size()==n_shape_functions*n_points,
+                    ExcInternalError());
+             data.second_derivative(k,0)[0][0] = 0;
+             data.second_derivative(k,1)[0][0] = 0;
+             data.second_derivative(k,2)[0][0] = 0;
+             data.second_derivative(k,3)[0][0] = 0;
+             data.second_derivative(k,4)[0][0] = 0;
+             data.second_derivative(k,5)[0][0] = 0;
+             data.second_derivative(k,6)[0][0] = 0;
+             data.second_derivative(k,7)[0][0] = 0;
+             data.second_derivative(k,0)[1][1] = 0;
+             data.second_derivative(k,1)[1][1] = 0;
+             data.second_derivative(k,2)[1][1] = 0;
+             data.second_derivative(k,3)[1][1] = 0;
+             data.second_derivative(k,4)[1][1] = 0;
+             data.second_derivative(k,5)[1][1] = 0;
+             data.second_derivative(k,6)[1][1] = 0;
+             data.second_derivative(k,7)[1][1] = 0;
+             data.second_derivative(k,0)[2][2] = 0;
+             data.second_derivative(k,1)[2][2] = 0;
+             data.second_derivative(k,2)[2][2] = 0;
+             data.second_derivative(k,3)[2][2] = 0;
+             data.second_derivative(k,4)[2][2] = 0;
+             data.second_derivative(k,5)[2][2] = 0;
+             data.second_derivative(k,6)[2][2] = 0;
+             data.second_derivative(k,7)[2][2] = 0;
+
+             data.second_derivative(k,0)[0][1] = (1.-z);
+             data.second_derivative(k,1)[0][1] = -(1.-z);
+             data.second_derivative(k,2)[0][1] = -(1.-z);
+             data.second_derivative(k,3)[0][1] = (1.-z);
+             data.second_derivative(k,4)[0][1] = z;
+             data.second_derivative(k,5)[0][1] = -z;
+             data.second_derivative(k,6)[0][1] = -z;
+             data.second_derivative(k,7)[0][1] = z;
+             data.second_derivative(k,0)[1][0] = (1.-z);
+             data.second_derivative(k,1)[1][0] = -(1.-z);
+             data.second_derivative(k,2)[1][0] = -(1.-z);
+             data.second_derivative(k,3)[1][0] = (1.-z);
+             data.second_derivative(k,4)[1][0] = z;
+             data.second_derivative(k,5)[1][0] = -z;
+             data.second_derivative(k,6)[1][0] = -z;
+             data.second_derivative(k,7)[1][0] = z;
+
+             data.second_derivative(k,0)[0][2] = (1.-y);
+             data.second_derivative(k,1)[0][2] = -(1.-y);
+             data.second_derivative(k,2)[0][2] = y;
+             data.second_derivative(k,3)[0][2] = -y;
+             data.second_derivative(k,4)[0][2] = -(1.-y);
+             data.second_derivative(k,5)[0][2] = (1.-y);
+             data.second_derivative(k,6)[0][2] = -y;
+             data.second_derivative(k,7)[0][2] = y;
+             data.second_derivative(k,0)[2][0] = (1.-y);
+             data.second_derivative(k,1)[2][0] = -(1.-y);
+             data.second_derivative(k,2)[2][0] = y;
+             data.second_derivative(k,3)[2][0] = -y;
+             data.second_derivative(k,4)[2][0] = -(1.-y);
+             data.second_derivative(k,5)[2][0] = (1.-y);
+             data.second_derivative(k,6)[2][0] = -y;
+             data.second_derivative(k,7)[2][0] = y;
+
+             data.second_derivative(k,0)[1][2] = (1.-x);
+             data.second_derivative(k,1)[1][2] = x;
+             data.second_derivative(k,2)[1][2] = -(1.-x);
+             data.second_derivative(k,3)[1][2] = -x;
+             data.second_derivative(k,4)[1][2] = -(1.-x);
+             data.second_derivative(k,5)[1][2] = -x;
+             data.second_derivative(k,6)[1][2] = (1.-x);
+             data.second_derivative(k,7)[1][2] = x;
+             data.second_derivative(k,0)[2][1] = (1.-x);
+             data.second_derivative(k,1)[2][1] = x;
+             data.second_derivative(k,2)[2][1] = -(1.-x);
+             data.second_derivative(k,3)[2][1] = -x;
+             data.second_derivative(k,4)[2][1] = -(1.-x);
+             data.second_derivative(k,5)[2][1] = -x;
+             data.second_derivative(k,6)[2][1] = (1.-x);
+             data.second_derivative(k,7)[2][1] = x;
+           }
+         break;
+       }
+
+       default:
+             Assert (false, ExcNotImplemented());
+       }
+    }
 }
 
 

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.