]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also replace std::vector<std::vector<T>> by Table<2,T> in FE_PolyTensor::InternalData. 2015/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 23 Dec 2015 05:38:59 +0000 (23:38 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 23 Dec 2015 18:17:54 +0000 (12:17 -0600)
include/deal.II/fe/fe_poly_tensor.h
source/fe/fe_poly_tensor.cc

index 3fd0a776950eaa254bdcbf88d3451d5a0e9dc115..24495748c25723b5b513728902da163a5ee3d225 100644 (file)
@@ -230,9 +230,7 @@ protected:
     if (update_flags & update_values)
       {
         values.resize (this->dofs_per_cell);
-        data->shape_values.resize (this->dofs_per_cell);
-        for (unsigned int i=0; i<this->dofs_per_cell; ++i)
-          data->shape_values[i].resize (n_q_points);
+        data->shape_values.reinit (this->dofs_per_cell, n_q_points);
         if (mapping_type != mapping_none)
           data->transformed_shape_values.resize (n_q_points);
       }
@@ -240,9 +238,7 @@ protected:
     if (update_flags & update_gradients)
       {
         grads.resize (this->dofs_per_cell);
-        data->shape_grads.resize (this->dofs_per_cell);
-        for (unsigned int i=0; i<this->dofs_per_cell; ++i)
-          data->shape_grads[i].resize (n_q_points);
+        data->shape_grads.reinit (this->dofs_per_cell, n_q_points);
         data->transformed_shape_grads.resize (n_q_points);
 
         if ( (mapping_type == mapping_raviart_thomas)
@@ -258,9 +254,7 @@ protected:
     if (update_flags & update_hessians)
       {
         grad_grads.resize (this->dofs_per_cell);
-        data->shape_grad_grads.resize (this->dofs_per_cell);
-        for (unsigned int i=0; i<this->dofs_per_cell; ++i)
-          data->shape_grad_grads[i].resize (n_q_points);
+        data->shape_grad_grads.reinit (this->dofs_per_cell, n_q_points);
         data->transformed_shape_hessians.resize (n_q_points);
         if ( mapping_type != mapping_none )
           data->untransformed_shape_hessian_tensors.resize(n_q_points);
@@ -380,33 +374,33 @@ protected:
      * Array with shape function values in quadrature points. There is one row
      * for each shape function, containing values for each quadrature point.
      */
-    std::vector<std::vector<Tensor<1,dim> > > shape_values;
+    Table<2,Tensor<1,dim> > shape_values;
 
     /**
      * Array with shape function gradients in quadrature points. There is one
      * row for each shape function, containing values for each quadrature
      * point.
      */
-    std::vector< std::vector< DerivativeForm<1, dim, spacedim> > > shape_grads;
+    Table<2,DerivativeForm<1, dim, spacedim> > shape_grads;
 
     /**
         * Array with shape function hessians in quadrature points. There is one
         * row for each shape function, containing values for each quadrature
         * point.
         */
-    std::vector< std::vector< DerivativeForm<2, dim, spacedim> > > shape_grad_grads;
+    Table<2,DerivativeForm<2, dim, spacedim> > shape_grad_grads;
 
     /**
      * Scratch arrays for intermediate computations
      */
-    mutable std::vector<double> sign_change;
-    mutable std::vector<Tensor<1, spacedim> > transformed_shape_values;
+    mutable std::vector<double>                sign_change;
+    mutable std::vector<Tensor<1, spacedim> >  transformed_shape_values;
     // for shape_gradient computations
     mutable std::vector<Tensor<2, spacedim > > transformed_shape_grads;
-    mutable std::vector<Tensor<2, dim > > untransformed_shape_grads;
+    mutable std::vector<Tensor<2, dim > >      untransformed_shape_grads;
     // for shape_hessian computations
     mutable std::vector<Tensor<3, spacedim > > transformed_shape_hessians;
-    mutable std::vector<Tensor<3, dim > > untransformed_shape_hessian_tensors;
+    mutable std::vector<Tensor<3, dim > >      untransformed_shape_hessian_tensors;
   };
 
 
index 66b0af514dc1c9fd9520e992577b38446625064c..4f9c3635c983d6841b4043c0f37efef342f19cba 100644 (file)
@@ -316,10 +316,10 @@ fill_fe_values
 
   const unsigned int n_q_points = quadrature.size();
 
-  Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size() == this->dofs_per_cell,
-         ExcDimensionMismatch(fe_data.shape_values.size(), this->dofs_per_cell));
-  Assert(!(fe_data.update_each & update_values) || fe_data.shape_values[0].size() == n_q_points,
-         ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points));
+  Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size()[0] == this->dofs_per_cell,
+         ExcDimensionMismatch(fe_data.shape_values.size()[0], this->dofs_per_cell));
+  Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size()[1] == n_q_points,
+         ExcDimensionMismatch(fe_data.shape_values.size()[1], n_q_points));
 
   // Create table with sign changes, due to the special structure of the RT elements.
   // TODO: Preliminary hack to demonstrate the overall prinicple!
@@ -364,7 +364,7 @@ fill_fe_values
             case mapping_covariant:
             case mapping_contravariant:
             {
-              mapping.transform (make_array_view(fe_data.shape_values[i]),
+              mapping.transform (make_array_view(fe_data.shape_values, i),
                                  mapping_type,
                                  mapping_internal,
                                  make_array_view(fe_data.transformed_shape_values));
@@ -379,7 +379,7 @@ fill_fe_values
             case mapping_raviart_thomas:
             case mapping_piola:
             {
-              mapping.transform (make_array_view(fe_data.shape_values[i]),
+              mapping.transform (make_array_view(fe_data.shape_values, i),
                                  mapping_piola,
                                  mapping_internal,
                                  make_array_view(fe_data.transformed_shape_values));
@@ -392,7 +392,7 @@ fill_fe_values
 
             case mapping_nedelec:
             {
-              mapping.transform (make_array_view(fe_data.shape_values[i]),
+              mapping.transform (make_array_view(fe_data.shape_values, i),
                                  mapping_covariant,
                                  mapping_internal,
                                  make_array_view(fe_data.transformed_shape_values));
@@ -423,7 +423,7 @@ fill_fe_values
             {
             case mapping_none:
             {
-              mapping.transform (make_array_view(fe_data.shape_grads[i]),
+              mapping.transform (make_array_view(fe_data.shape_grads, i),
                                  mapping_covariant,
                                  mapping_internal,
                                  make_array_view(fe_data.transformed_shape_grads));
@@ -434,7 +434,7 @@ fill_fe_values
             }
             case mapping_covariant:
             {
-              mapping.transform (make_array_view(fe_data.shape_grads[i]),
+              mapping.transform (make_array_view(fe_data.shape_grads, i),
                                  mapping_covariant_gradient,
                                  mapping_internal,
                                  make_array_view(fe_data.transformed_shape_grads));
@@ -553,7 +553,7 @@ fill_fe_values
             case mapping_none:
             {
 
-              mapping.transform(make_array_view(fe_data.shape_grad_grads[i]),
+              mapping.transform(make_array_view(fe_data.shape_grad_grads, i),
                                 mapping_covariant_gradient,
                                 mapping_internal,
                                 make_array_view(fe_data.transformed_shape_hessians));
@@ -837,7 +837,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
-              mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points),
                                  mapping_type,
                                  mapping_internal,
                                  transformed_shape_values);
@@ -853,7 +853,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
-              mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points),
                                  mapping_piola,
                                  mapping_internal,
                                  transformed_shape_values);
@@ -868,7 +868,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
-              mapping.transform (make_array_view (fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform (make_array_view (fe_data.shape_values, i, offset, n_q_points),
                                  mapping_covariant,
                                  mapping_internal,
                                  transformed_shape_values);
@@ -894,7 +894,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<2,spacedim> > transformed_shape_grads
                 = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points);
-              mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points),
                                  mapping_covariant,
                                  mapping_internal,
                                  transformed_shape_grads);
@@ -908,7 +908,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<2,spacedim> > transformed_shape_grads
                 = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points);
-              mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points),
                                  mapping_covariant_gradient,
                                  mapping_internal,
                                  transformed_shape_grads);
@@ -1027,7 +1027,7 @@ fill_fe_face_values
             {
               const ArrayView<Tensor<3,spacedim> > transformed_shape_hessians
                 = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points);
-              mapping.transform(make_array_view (fe_data.shape_grad_grads[i], offset, n_q_points),
+              mapping.transform(make_array_view (fe_data.shape_grad_grads, i, offset, n_q_points),
                                 mapping_covariant_gradient,
                                 mapping_internal,
                                 transformed_shape_hessians);
@@ -1316,7 +1316,7 @@ fill_fe_subface_values
             {
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
-              mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points),
                                  mapping_type,
                                  mapping_internal,
                                  transformed_shape_values);
@@ -1334,7 +1334,7 @@ fill_fe_subface_values
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
 
-              mapping.transform(make_array_view(fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform(make_array_view(fe_data.shape_values, i, offset, n_q_points),
                                 mapping_piola,
                                 mapping_internal,
                                 transformed_shape_values);
@@ -1350,7 +1350,7 @@ fill_fe_subface_values
               const ArrayView<Tensor<1,spacedim> > transformed_shape_values
                 = make_array_view(fe_data.transformed_shape_values, offset, n_q_points);
 
-              mapping.transform (make_array_view (fe_data.shape_values[i], offset, n_q_points),
+              mapping.transform (make_array_view (fe_data.shape_values, i, offset, n_q_points),
                                  mapping_covariant,
                                  mapping_internal,
                                  transformed_shape_values);
@@ -1376,7 +1376,7 @@ fill_fe_subface_values
             {
             case mapping_none:
             {
-              mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points),
                                  mapping_covariant,
                                  mapping_internal,
                                  transformed_shape_grads);
@@ -1388,7 +1388,7 @@ fill_fe_subface_values
 
             case mapping_covariant:
             {
-              mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points),
+              mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points),
                                  mapping_covariant_gradient,
                                  mapping_internal,
                                  transformed_shape_grads);
@@ -1502,7 +1502,7 @@ fill_fe_subface_values
             {
               const ArrayView<Tensor<3,spacedim> > transformed_shape_hessians
                 = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points);
-              mapping.transform(make_array_view (fe_data.shape_grad_grads[i], offset, n_q_points),
+              mapping.transform(make_array_view (fe_data.shape_grad_grads, i, offset, n_q_points),
                                 mapping_covariant_gradient, mapping_internal,
                                 transformed_shape_hessians);
 

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.