]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use new tangential vectors
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 28 Feb 2020 18:27:35 +0000 (19:27 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 29 Feb 2020 10:01:04 +0000 (11:01 +0100)
source/fe/mapping_fe_field.cc
source/fe/mapping_manifold.cc
source/fe/mapping_q_generic.cc

index 23de12715e620dca6e364ad2f5b8dc5c46cffd8b..7135428678263727558da449ac5029358f930aef 100644 (file)
@@ -581,56 +581,22 @@ MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::compute_face_data(
             dim - 1, std::vector<Tensor<1, spacedim>>(n_original_q_points));
 
           // Compute tangentials to the unit cell.
-          for (unsigned int i = 0; i < data.unit_tangentials.size(); ++i)
-            data.unit_tangentials[i].resize(n_original_q_points);
-
-          if (dim == 2)
-            {
-              // ensure a counterclockwise
-              // orientation of tangentials
-              static const int tangential_orientation[4] = {-1, 1, 1, -1};
-              for (const unsigned int i : GeometryInfo<dim>::face_indices())
-                {
-                  Tensor<1, dim> tang;
-                  tang[1 - i / 2] = tangential_orientation[i];
-                  std::fill(data.unit_tangentials[i].begin(),
-                            data.unit_tangentials[i].end(),
-                            tang);
-                }
-            }
-          else if (dim == 3)
+          for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
             {
-              for (const unsigned int i : GeometryInfo<dim>::face_indices())
+              data.unit_tangentials[i].resize(n_original_q_points);
+              std::fill(data.unit_tangentials[i].begin(),
+                        data.unit_tangentials[i].end(),
+                        GeometryInfo<dim>::unit_tangential_vectors[i][0]);
+              if (dim > 2)
                 {
-                  Tensor<1, dim> tang1, tang2;
-
-                  const unsigned int nd =
-                    GeometryInfo<dim>::unit_normal_direction[i];
-
-                  // first tangential
-                  // vector in direction
-                  // of the (nd+1)%3 axis
-                  // and inverted in case
-                  // of unit inward normal
-                  tang1[(nd + 1) % dim] =
-                    GeometryInfo<dim>::unit_normal_orientation[i];
-                  // second tangential
-                  // vector in direction
-                  // of the (nd+2)%3 axis
-                  tang2[(nd + 2) % dim] = 1.;
-
-                  // same unit tangents
-                  // for all quadrature
-                  // points on this face
-                  std::fill(data.unit_tangentials[i].begin(),
-                            data.unit_tangentials[i].end(),
-                            tang1);
+                  data.unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                    .resize(n_original_q_points);
                   std::fill(
                     data.unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
                       .begin(),
                     data.unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
                       .end(),
-                    tang2);
+                    GeometryInfo<dim>::unit_tangential_vectors[i][1]);
                 }
             }
         }
index 392f2b250ed431793c8c1829485c16f17acbf695..fa37729a20a116b146d13426cc668b1f1b3c32db 100644 (file)
@@ -117,67 +117,23 @@ MappingManifold<dim, spacedim>::InternalData::initialize_face(
                      std::vector<Tensor<1, spacedim>>(n_original_q_points));
 
           // Compute tangentials to the unit cell.
-          for (unsigned int i = 0; i < unit_tangentials.size(); ++i)
-            unit_tangentials[i].resize(n_original_q_points);
-          switch (dim)
+          for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
             {
-              case 2:
+              unit_tangentials[i].resize(n_original_q_points);
+              std::fill(unit_tangentials[i].begin(),
+                        unit_tangentials[i].end(),
+                        GeometryInfo<dim>::unit_tangential_vectors[i][0]);
+              if (dim > 2)
                 {
-                  // ensure a counterclockwise
-                  // orientation of tangentials
-                  static const int tangential_orientation[4] = {-1, 1, 1, -1};
-                  for (unsigned int i = 0;
-                       i < GeometryInfo<dim>::faces_per_cell;
-                       ++i)
-                    {
-                      Tensor<1, dim> tang;
-                      tang[1 - i / 2] = tangential_orientation[i];
-                      std::fill(unit_tangentials[i].begin(),
-                                unit_tangentials[i].end(),
-                                tang);
-                    }
-                  break;
-                }
-              case 3:
-                {
-                  for (unsigned int i = 0;
-                       i < GeometryInfo<dim>::faces_per_cell;
-                       ++i)
-                    {
-                      Tensor<1, dim> tang1, tang2;
-
-                      const unsigned int nd =
-                        GeometryInfo<dim>::unit_normal_direction[i];
-
-                      // first tangential
-                      // vector in direction
-                      // of the (nd+1)%3 axis
-                      // and inverted in case
-                      // of unit inward normal
-                      tang1[(nd + 1) % dim] =
-                        GeometryInfo<dim>::unit_normal_orientation[i];
-                      // second tangential
-                      // vector in direction
-                      // of the (nd+2)%3 axis
-                      tang2[(nd + 2) % dim] = 1.;
-
-                      // same unit tangents
-                      // for all quadrature
-                      // points on this face
-                      std::fill(unit_tangentials[i].begin(),
-                                unit_tangentials[i].end(),
-                                tang1);
-                      std::fill(
-                        unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
-                          .begin(),
-                        unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
-                          .end(),
-                        tang2);
-                    }
-                  break;
+                  unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                    .resize(n_original_q_points);
+                  std::fill(
+                    unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                      .begin(),
+                    unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                      .end(),
+                    GeometryInfo<dim>::unit_tangential_vectors[i][1]);
                 }
-              default:
-                Assert(false, ExcNotImplemented());
             }
         }
     }
index ddc4115f7b9e2b7ac8a03b3cc2ccc1f6fc070cc1..f65cca2a4118ca89bf77e8e6dcd3e8cdef048de9 100644 (file)
@@ -841,70 +841,23 @@ MappingQGeneric<dim, spacedim>::InternalData::initialize_face(
                      std::vector<Tensor<1, spacedim>>(n_original_q_points));
 
           // Compute tangentials to the unit cell.
-          for (unsigned int i = 0; i < unit_tangentials.size(); ++i)
-            unit_tangentials[i].resize(n_original_q_points);
-          switch (dim)
+          for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
             {
-              case 2:
+              unit_tangentials[i].resize(n_original_q_points);
+              std::fill(unit_tangentials[i].begin(),
+                        unit_tangentials[i].end(),
+                        GeometryInfo<dim>::unit_tangential_vectors[i][0]);
+              if (dim > 2)
                 {
-                  // ensure a counterclockwise orientation of tangentials
-                  static const int tangential_orientation[4] = {-1, 1, 1, -1};
-                  for (unsigned int i = 0;
-                       i < GeometryInfo<dim>::faces_per_cell;
-                       ++i)
-                    {
-                      Tensor<1, dim> tang;
-                      tang[1 - i / 2] = tangential_orientation[i];
-                      std::fill(unit_tangentials[i].begin(),
-                                unit_tangentials[i].end(),
-                                tang);
-                    }
-
-                  break;
+                  unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                    .resize(n_original_q_points);
+                  std::fill(
+                    unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                      .begin(),
+                    unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
+                      .end(),
+                    GeometryInfo<dim>::unit_tangential_vectors[i][1]);
                 }
-
-              case 3:
-                {
-                  for (unsigned int i = 0;
-                       i < GeometryInfo<dim>::faces_per_cell;
-                       ++i)
-                    {
-                      Tensor<1, dim> tang1, tang2;
-
-                      const unsigned int nd =
-                        GeometryInfo<dim>::unit_normal_direction[i];
-
-                      // first tangential
-                      // vector in direction
-                      // of the (nd+1)%3 axis
-                      // and inverted in case
-                      // of unit inward normal
-                      tang1[(nd + 1) % dim] =
-                        GeometryInfo<dim>::unit_normal_orientation[i];
-                      // second tangential
-                      // vector in direction
-                      // of the (nd+2)%3 axis
-                      tang2[(nd + 2) % dim] = 1.;
-
-                      // same unit tangents
-                      // for all quadrature
-                      // points on this face
-                      std::fill(unit_tangentials[i].begin(),
-                                unit_tangentials[i].end(),
-                                tang1);
-                      std::fill(
-                        unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
-                          .begin(),
-                        unit_tangentials[GeometryInfo<dim>::faces_per_cell + i]
-                          .end(),
-                        tang2);
-                    }
-
-                  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.