]> https://gitweb.dealii.org/ - dealii.git/commitdiff
tensor.h: Rename cross_product to cross_product_2d/3d
authorMatthias Maier <tamiko@43-1.org>
Fri, 25 Sep 2015 22:12:08 +0000 (17:12 -0500)
committerMatthias Maier <tamiko@43-1.org>
Fri, 25 Sep 2015 22:13:01 +0000 (17:13 -0500)
include/deal.II/base/tensor.h
include/deal.II/numerics/vector_tools.templates.h
source/base/geometry_info.cc
source/fe/mapping_fe_field.cc
source/fe/mapping_q_generic.cc
source/grid/tria_accessor.cc
source/grid/tria_boundary.cc

index 1e62926f512792ed44f30ec53a1f10e41ab7fb15..4fbac9328c3384ec991a7bc68c444c0ec510f1da 100644 (file)
@@ -1720,7 +1720,7 @@ outer_product(const Tensor<rank_1, dim, Number> &src1,
 template <int dim, typename Number>
 inline
 Tensor<1,dim,Number>
-cross_product (const Tensor<1,dim,Number> &src)
+cross_product_2d (const Tensor<1,dim,Number> &src)
 {
   Assert (dim==2, ExcInternalError());
 
@@ -1746,8 +1746,8 @@ cross_product (const Tensor<1,dim,Number> &src)
 template <int dim, typename Number>
 inline
 Tensor<1,dim,Number>
-cross_product (const Tensor<1,dim,Number> &src1,
-               const Tensor<1,dim,Number> &src2)
+cross_product_3d (const Tensor<1,dim,Number> &src1,
+                  const Tensor<1,dim,Number> &src2)
 {
   Assert (dim==3, ExcInternalError());
 
index 99c45a06b7856ac2a84a6b417e856b206a51fdec..b02808c9dde7d21a14198cab04340dc5653eece4 100644 (file)
@@ -2875,8 +2875,8 @@ namespace VectorTools
 
           // now compute the
           // two normals
-          orthonormals[0] = cross_product (vector, tmp);
-          orthonormals[1] = cross_product (vector, orthonormals[0]);
+          orthonormals[0] = cross_product_3d (vector, tmp);
+          orthonormals[1] = cross_product_3d (vector, orthonormals[0]);
 
           break;
         }
@@ -4205,7 +4205,7 @@ namespace VectorTools
               // The RHS entries are:
               // \int_{edge} (tangential* boundary_value) * (tangential * edge_shape_function_i) dS.
               //
-              // In 2D, tangential*vector is equivalent to cross_product(normal, vector), so we use this instead.
+              // In 2D, tangential*vector is equivalent to cross_product_3d(normal, vector), so we use this instead.
               // This avoids possible issues with the computation of the tangent.
 
               // Store the normal at this quad point:
@@ -4395,22 +4395,22 @@ namespace VectorTools
                   const unsigned int cell_j = fe.face_to_cell_index (j_face_idx, face);
 
                   cross_product_j =
-                    cross_product(normal_vector,
-                                  fe_face_values[vec].value(cell_j, q_point));
+                    cross_product_3d(normal_vector,
+                                     fe_face_values[vec].value(cell_j, q_point));
 
                   for (unsigned int i = 0; i < associated_face_dofs; ++i)
                     {
                       const unsigned int i_face_idx = associated_face_dof_to_face_dof[i];
                       const unsigned int cell_i = fe.face_to_cell_index (i_face_idx, face);
                       cross_product_i =
-                        cross_product(normal_vector,
-                                      fe_face_values[vec].value(cell_i, q_point));
+                        cross_product_3d(normal_vector,
+                                         fe_face_values[vec].value(cell_i, q_point));
 
                       face_matrix(i, j) += fe_face_values.JxW(q_point) *
                                            cross_product_i * cross_product_j;
                     }
                   // compute rhs
-                  cross_product_rhs = cross_product(normal_vector, tmp);
+                  cross_product_rhs = cross_product_3d(normal_vector, tmp);
                   face_rhs(j) += fe_face_values.JxW(q_point) *
                                  cross_product_rhs * cross_product_j;
                 }
@@ -5719,7 +5719,7 @@ namespace VectorTools
                     // we get here only for dim==3, but at least one isn't
                     // quite smart enough to notice this and warns when
                     // compiling the function in 2d
-                    tangent = cross_product (normals[0], normals[dim-2]);
+                    tangent = cross_product_3d (normals[0], normals[dim-2]);
                     break;
                   default:
                     Assert (false, ExcNotImplemented());
index 513baa8edca5ca58ac346fb75877a3222f0d1add..8d7b354735d16f1808c8234236893f4fce0c7cd4 100644 (file)
@@ -1820,7 +1820,7 @@ namespace internal
     Tensor<1,3>
     wedge_product (const Tensor<1,3> (&derivative)[2])
     {
-      return cross_product (derivative[0], derivative[1]);
+      return cross_product_3d (derivative[0], derivative[1]);
     }
 
 
index 8460d67c5e809c10939055a11f6c8a8d6d814b1e..5db7f7227db40ec827f91fe4c781cec676aa1a64 100644 (file)
@@ -1043,11 +1043,11 @@ namespace internal
                                                       -1 : +1);
                   break;
                 case 2:
-                  output_data.boundary_forms[i] = cross_product(data.aux[0][i]);
+                  output_data.boundary_forms[i] = cross_product_2d(data.aux[0][i]);
                   break;
                 case 3:
                   output_data.boundary_forms[i] =
-                    cross_product(data.aux[0][i], data.aux[1][i]);
+                    cross_product_3d(data.aux[0][i], data.aux[1][i]);
                   break;
                 default:
                   Assert(false, ExcNotImplemented());
@@ -1080,13 +1080,13 @@ namespace internal
                       data.contravariant[point].transpose();
 
                     Tensor<1, spacedim> cell_normal =
-                      cross_product(DX_t[0], DX_t[1]);
+                      cross_product_3d(DX_t[0], DX_t[1]);
                     cell_normal /= cell_normal.norm();
 
                     // then compute the face normal from the face tangent
                     // and the cell normal:
                     output_data.boundary_forms[point] =
-                      cross_product(data.aux[0][point], cell_normal);
+                      cross_product_3d(data.aux[0][point], cell_normal);
                   }
 
               }
@@ -1293,10 +1293,10 @@ fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
 
                         if (dim==1)
                           output_data.normal_vectors[point] =
-                            cross_product(-DX_t[0]);
+                            cross_product_2d(-DX_t[0]);
                         else //dim == 2
                           output_data.normal_vectors[point] =
-                            cross_product(DX_t[0], DX_t[1]);
+                            cross_product_3d(DX_t[0], DX_t[1]);
 
                         output_data.normal_vectors[point] /= output_data.normal_vectors[point].norm();
 
index 8f9ffd3e6b6aaef03fe6c90aff7fbd84ab1f8faa..eecbed99887e1e22eb90b6405217f2a832d80c92 100644 (file)
@@ -2102,10 +2102,10 @@ fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
 
                         if (dim==1)
                           output_data.normal_vectors[point] =
-                            cross_product(-DX_t[0]);
+                            cross_product_2d(-DX_t[0]);
                         else //dim == 2
                           output_data.normal_vectors[point] =
-                            cross_product(DX_t[0], DX_t[1]);
+                            cross_product_3d(DX_t[0], DX_t[1]);
 
                         output_data.normal_vectors[point] /= output_data.normal_vectors[point].norm();
 
@@ -2246,11 +2246,11 @@ namespace internal
                     break;
                   case 2:
                     output_data.boundary_forms[i] =
-                      cross_product(data.aux[0][i]);
+                      cross_product_2d(data.aux[0][i]);
                     break;
                   case 3:
                     output_data.boundary_forms[i] =
-                      cross_product(data.aux[0][i], data.aux[1][i]);
+                      cross_product_3d(data.aux[0][i], data.aux[1][i]);
                     break;
                   default:
                     Assert(false, ExcNotImplemented());
@@ -2282,13 +2282,13 @@ namespace internal
                         data.contravariant[point].transpose();
 
                       Tensor<1, spacedim> cell_normal =
-                        cross_product(DX_t[0], DX_t[1]);
+                        cross_product_3d(DX_t[0], DX_t[1]);
                       cell_normal /= cell_normal.norm();
 
                       // then compute the face normal from the face tangent
                       // and the cell normal:
                       output_data.boundary_forms[point] =
-                        cross_product(data.aux[0][point], cell_normal);
+                        cross_product_3d(data.aux[0][point], cell_normal);
                     }
                 }
             }
index 361924f54821e22a814388e01f13bc37944575b1..bb7f9ba43833fee8a1ed9d26ce8690122a582954 100644 (file)
@@ -981,7 +981,7 @@ namespace
     const Tensor<1,3> v01 = accessor.vertex(1) - accessor.vertex(0);
     const Tensor<1,3> v02 = accessor.vertex(2) - accessor.vertex(0);
 
-    Tensor<1,3> normal = cross_product(v01, v02);
+    Tensor<1,3> normal = cross_product_3d(v01, v02);
 
     const Tensor<1,3> v03 = accessor.vertex(3) - accessor.vertex(0);
 
@@ -1003,7 +1003,7 @@ namespace
     // the face is planar. then its area is 1/2 of the norm of the
     // cross product of the two diagonals
     const Tensor<1,3> v12 = accessor.vertex(2) - accessor.vertex(1);
-    Tensor<1,3> twice_area = cross_product(v03, v12);
+    Tensor<1,3> twice_area = cross_product_3d(v03, v12);
     return 0.5 * twice_area.norm();
   }
 
index 27336e9bbf29d68611abd54565566a5e908fe2b4..b1731fcc03b06ba43e6efed52d84e3aaeb644691 100644 (file)
@@ -491,7 +491,7 @@ namespace internal
     Tensor<1,2>
     normalized_alternating_product (const Tensor<1,2> (&basis_vectors)[1])
     {
-      Tensor<1,2> tmp = cross_product (basis_vectors[0]);
+      Tensor<1,2> tmp = cross_product_2d (basis_vectors[0]);
       return tmp/tmp.norm();
     }
 
@@ -512,7 +512,7 @@ namespace internal
     Tensor<1,3>
     normalized_alternating_product (const Tensor<1,3> (&basis_vectors)[2])
     {
-      Tensor<1,3> tmp = cross_product (basis_vectors[0], basis_vectors[1]);
+      Tensor<1,3> tmp = cross_product_3d (basis_vectors[0], basis_vectors[1]);
       return tmp/tmp.norm();
     }
 
@@ -698,7 +698,7 @@ get_normals_at_vertices (const Triangulation<3>::face_iterator &face,
 
       // then compute the normal by taking the cross product. since the
       // normal is not required to be normalized, no problem here
-      face_vertex_normals[vertex] = cross_product(tangents[0], tangents[1]);
+      face_vertex_normals[vertex] = cross_product_3d(tangents[0], tangents[1]);
     };
 }
 

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.