]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid memory allocation. 1400/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 20 Aug 2015 17:46:16 +0000 (12:46 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 20 Aug 2015 17:46:16 +0000 (12:46 -0500)
Rather take the penalty of looking a piece of data up at
most 2^dim times. Surely that's cheaper than the memory
allocation.

source/dofs/dof_accessor_get.cc

index 818c66bfe1dcb0ea20ae2adeff1e1a73887b22ac..ac4bcec477a0297b9db2993543db4d18eca93b33 100644 (file)
@@ -137,12 +137,7 @@ get_interpolated_dof_values (const InputVector &values,
       // there are even weird finite elements (for example the Raviart-Thomas
       // element) which have shape functions that are additive (interior ones)
       // and others that are overwriting (face degrees of freedom that need to
-      // be continuous across the face). to avoid checking this over and over
-      // again, we do this once now and cache the results
-      std::vector<bool> restriction_is_additive (dofs_per_cell);
-      for (unsigned int i=0; i<dofs_per_cell; ++i)
-        restriction_is_additive[i] = fe.restriction_is_additive(i);
-
+      // be continuous across the face).
       for (unsigned int child=0; child<this->n_children(); ++child)
         {
           // get the values from the present child, if necessary by
@@ -157,7 +152,7 @@ get_interpolated_dof_values (const InputVector &values,
 
           // and add up or set them in the output vector
           for (unsigned int i=0; i<dofs_per_cell; ++i)
-            if (restriction_is_additive[i])
+            if (fe.restriction_is_additive(i))
               interpolated_values(i) += tmp2(i);
             else if (tmp2(i) != number())
               interpolated_values(i) = tmp2(i);

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.