]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a fixed size data structure for MappingFEField::InternalData::unit_tangentials. 2471/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 Apr 2016 02:31:33 +0000 (21:31 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 7 Apr 2016 11:19:20 +0000 (06:19 -0500)
include/deal.II/fe/mapping_fe_field.h
source/fe/mapping_fe_field.cc

index a7d04356c57321f0c8762157604da3f2c63c43e2..aae3975343b084d7bfcf37842ac5b1f321cc820d 100644 (file)
@@ -25,6 +25,8 @@
 #include <deal.II/fe/mapping.h>
 #include <deal.II/fe/fe.h>
 
+#include <deal.II/base/std_cxx11/array.h>
+
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -361,7 +363,7 @@ public:
      * Unit tangential vectors. Used for the computation of boundary forms and
      * normal vectors.
      *
-     * This vector has (dim-1)GeometryInfo::faces_per_cell entries. The first
+     * This array has (dim-1)*GeometryInfo::faces_per_cell entries. The first
      * GeometryInfo::faces_per_cell contain the vectors in the first
      * tangential direction for each face; the second set of
      * GeometryInfo::faces_per_cell entries contain the vectors in the second
@@ -370,7 +372,7 @@ public:
      *
      * Filled once.
      */
-    std::vector<std::vector<Tensor<1,dim> > > unit_tangentials;
+    std_cxx11::array<std::vector<Tensor<1,dim> >, GeometryInfo<dim>::faces_per_cell *(dim-1)> unit_tangentials;
 
     /**
      * Number of shape functions. If this is a Q1 mapping, then it is simply
index 54b2da4d93daf00f19badc2a58fb94b02a4afabf..7f7f2297c9c703f082eb4b3da84c21394831a671 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2001 - 2015 by the deal.II authors
+// Copyright (C) 2001 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -409,27 +409,27 @@ MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::compute_face_data
         {
           data.aux.resize (dim-1, std::vector<Tensor<1,spacedim> > (n_original_q_points));
 
-          // Compute tangentials to the
-          // unit cell.
-          const unsigned int nfaces = GeometryInfo<dim>::faces_per_cell;
-          data.unit_tangentials.resize (nfaces*(dim-1),
-                                        std::vector<Tensor<1,dim> > (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 (unsigned int i=0; i<nfaces; ++i)
+              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 (data.unit_tangentials[i].begin(),
-                             data.unit_tangentials[i].end(), tang);
+                             data.unit_tangentials[i].end(),
+                             tang);
                 }
             }
           else if (dim==3)
             {
-              for (unsigned int i=0; i<nfaces; ++i)
+              for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
                 {
                   Tensor<1,dim> tang1, tang2;
 
@@ -451,9 +451,11 @@ MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::compute_face_data
                   // for all quadrature
                   // points on this face
                   std::fill (data.unit_tangentials[i].begin(),
-                             data.unit_tangentials[i].end(), tang1);
-                  std::fill (data.unit_tangentials[nfaces+i].begin(),
-                             data.unit_tangentials[nfaces+i].end(), tang2);
+                             data.unit_tangentials[i].end(),
+                             tang1);
+                  std::fill (data.unit_tangentials[GeometryInfo<dim>::faces_per_cell+i].begin(),
+                             data.unit_tangentials[GeometryInfo<dim>::faces_per_cell+i].end(),
+                             tang2);
                 }
             }
         }

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.