]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid memory reallocation
authorMatthias Maier <tamiko@43-1.org>
Thu, 31 Aug 2017 22:19:50 +0000 (17:19 -0500)
committerMatthias Maier <tamiko@43-1.org>
Fri, 1 Sep 2017 18:01:52 +0000 (13:01 -0500)
source/fe/fe_system.cc

index ac85dbb881765e950bc7e10579114a8d0d5d8cdd..5412942c81139cf1a4cda8c29d6e8aef4343f95e 100644 (file)
@@ -2261,6 +2261,9 @@ convert_generalized_support_point_values_to_dof_values (const std::vector<Vector
                   this->get_generalized_support_points().size());
   AssertDimension(dof_values.size(), this->dofs_per_cell);
 
+  std::vector<double> base_dof_values;
+  std::vector<Vector<double> > base_point_values;
+
   // loop over all base elements (respecting multiplicity) and let them do
   // the work on their share of the input argument
 
@@ -2277,8 +2280,8 @@ convert_generalized_support_point_values_to_dof_values (const std::vector<Vector
         base_element.get_generalized_support_points().size();
       const unsigned int n_base_components = base_element.n_components();
 
-      std::vector<double> base_dof_values(n_base_dofs);
-      std::vector<Vector<double> > base_point_values(n_base_points);
+      base_dof_values.resize(n_base_dofs);
+      base_point_values.resize(n_base_points);
 
       for (unsigned int m = 0; m < multiplicity;
            ++m, current_vector_component += n_base_components)

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.