]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace hp::FECollection copies by constant references
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 21 Aug 2017 16:59:35 +0000 (18:59 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 22 Aug 2017 12:04:50 +0000 (14:04 +0200)
include/deal.II/numerics/fe_field_function.templates.h
include/deal.II/numerics/vector_tools.templates.h
source/dofs/dof_renumbering.cc
source/dofs/dof_tools.cc
source/dofs/dof_tools_sparsity.cc
source/numerics/data_out_stack.cc
source/numerics/derivative_approximation.cc
source/numerics/error_estimator_1d.cc

index 2df9a95fe849e3305ba3f28a8fd109c47a887ab4..2ccc406a6926f569b99b9d5d9f03e2d59100f0ea 100644 (file)
@@ -260,7 +260,7 @@ namespace Functions
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
     hp::MappingCollection<dim> mapping_collection (mapping);
-    hp::FECollection<dim> fe_collection (dh->get_fe_collection());
+    const hp::FECollection<dim> &fe_collection = dh->get_fe_collection();
     hp::QCollection<dim> quadrature_collection;
     // Create quadrature collection
     for (unsigned int i=0; i<ncells; ++i)
@@ -321,7 +321,7 @@ namespace Functions
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
     hp::MappingCollection<dim> mapping_collection (mapping);
-    hp::FECollection<dim> fe_collection (dh->get_fe_collection());
+    const hp::FECollection<dim> &fe_collection = dh->get_fe_collection();
     hp::QCollection<dim> quadrature_collection;
     // Create quadrature collection
     for (unsigned int i=0; i<ncells; ++i)
@@ -386,7 +386,7 @@ namespace Functions
 
     unsigned int ncells = compute_point_locations(points, cells, qpoints, maps);
     hp::MappingCollection<dim> mapping_collection (mapping);
-    hp::FECollection<dim> fe_collection (dh->get_fe_collection());
+    const hp::FECollection<dim> &fe_collection = dh->get_fe_collection();
     hp::QCollection<dim> quadrature_collection;
     // Create quadrature collection
     for (unsigned int i=0; i<ncells; ++i)
index 5321fb380e184e17111c52e3622b45e55c089b69..c61ccd11cdcf045d8e9df91a1c87ca361bcfee75 100644 (file)
@@ -107,7 +107,7 @@ namespace VectorTools
     Assert (component_mask.n_selected_components(dof.get_finite_element(0).n_components()) > 0,
             ComponentMask::ExcNoComponentSelected());
 
-    const hp::FECollection<dim,spacedim> fe (dof.get_fe_collection());
+    const hp::FECollection<dim,spacedim> &fe = dof.get_fe_collection();
     const unsigned int          n_components = fe.n_components();
     const bool                  fe_is_system = (n_components != 1);
 
@@ -403,8 +403,7 @@ namespace VectorTools
                 ExcDimensionMismatch(dof.get_finite_element(0).n_components(), iter->second->n_components) );
       }
 
-    const hp::FECollection<dim, spacedim>
-    fe(dof.get_fe_collection());
+    const hp::FECollection<dim, spacedim> &fe = dof.get_fe_collection();
     const unsigned int n_components =  fe.n_components();
     const bool         fe_is_system = (n_components != 1);
 
@@ -2349,7 +2348,7 @@ namespace VectorTools
           // before we start with the loop over all cells create an hp::FEValues
           // object that holds the interpolation points of all finite elements
           // that may ever be in use
-          dealii::hp::FECollection<dim,spacedim> finite_elements (dof.get_fe_collection());
+          const dealii::hp::FECollection<dim,spacedim> &finite_elements = dof.get_fe_collection();
           dealii::hp::QCollection<dim-1>  q_collection;
           for (unsigned int f=0; f<finite_elements.size(); ++f)
             {
@@ -5928,7 +5927,7 @@ namespace VectorTools
 
     // create FE and mapping collections for all elements in use by this
     // DoFHandler
-    hp::FECollection<dim,spacedim>      fe_collection (dof_handler.get_fe_collection());
+    const hp::FECollection<dim,spacedim> &fe_collection = dof_handler.get_fe_collection();
     hp::MappingCollection<dim,spacedim> mapping_collection;
     for (unsigned int i=0; i<fe_collection.size(); ++i)
       mapping_collection.push_back (mapping);
@@ -6514,7 +6513,7 @@ namespace VectorTools
                                              no_normal_flux_constraints,
                                              mapping);
 
-    hp::FECollection<dim,spacedim>      fe_collection (dof_handler.get_fe_collection());
+    const hp::FECollection<dim,spacedim> &fe_collection = dof_handler.get_fe_collection();
     hp::MappingCollection<dim,spacedim> mapping_collection;
     for (unsigned int i=0; i<fe_collection.size(); ++i)
       mapping_collection.push_back (mapping);
@@ -7133,7 +7132,7 @@ namespace VectorTools
           break;
         }
 
-      dealii::hp::FECollection<dim,spacedim> fe_collection (dof.get_fe_collection());
+      const dealii::hp::FECollection<dim,spacedim> &fe_collection = dof.get_fe_collection();
       IDScratchData<dim,spacedim, Number> data(mapping, fe_collection, q, update_flags);
 
       // loop over all cells
index 34f2dc083e120fcc5750a77a55fa7a5c780f697f..ec65062d447bf1fcc100ceb26ab9009545ed1f1c 100644 (file)
@@ -1524,7 +1524,7 @@ namespace DoFRenumbering
         std::vector<std::pair<Point<DoFHandlerType::space_dimension>,unsigned int> > support_point_list
         (n_dofs);
 
-        const hp::FECollection<DoFHandlerType::dimension> fe_collection (dof.get_fe_collection());
+        const hp::FECollection<DoFHandlerType::dimension> &fe_collection = dof.get_fe_collection();
         Assert (fe_collection[0].has_support_points(),
                 typename FiniteElement<DoFHandlerType::dimension>::ExcFEHasNoSupportPoints());
         hp::QCollection<DoFHandlerType::dimension> quadrature_collection;
index 4fbbdfe0dea6d94f07d20d3aade08637aff5da04..9e3cb7e34a667506be94f88655a851a73d274753 100644 (file)
@@ -178,8 +178,8 @@ namespace DoFTools
                                const ComponentMask        &component_mask,
                                std::vector<unsigned char> &dofs_by_component)
     {
-      const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
-      fe_collection (dof.get_fe_collection());
+      const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> &
+      fe_collection = dof.get_fe_collection();
       Assert (fe_collection.n_components() < 256, ExcNotImplemented());
       Assert (dofs_by_component.size() == dof.n_locally_owned_dofs(),
               ExcDimensionMismatch(dofs_by_component.size(),
@@ -233,8 +233,8 @@ namespace DoFTools
     get_block_association (const DoFHandlerType       &dof,
                            std::vector<unsigned char> &dofs_by_block)
     {
-      const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
-      fe_collection (dof.get_fe_collection());
+      const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> &
+      fe_collection = dof.get_fe_collection();
       Assert (fe_collection.n_components() < 256, ExcNotImplemented());
       Assert (dofs_by_block.size() == dof.n_locally_owned_dofs(),
               ExcDimensionMismatch(dofs_by_block.size(),
@@ -1193,8 +1193,8 @@ namespace DoFTools
     //
     // TODO: We might be able to extend this also for elements which do not
     // have the same constant modes, but that is messy...
-    const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
-    fe_collection (dof_handler.get_fe_collection());
+    const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> &
+    fe_collection = dof_handler.get_fe_collection();
     std::vector<Table<2,bool> > element_constant_modes;
     std::vector<std::vector<std::pair<unsigned int, unsigned int> > >
     constant_mode_to_component_translation(n_components);
@@ -1824,8 +1824,8 @@ namespace DoFTools
   {
     std::vector<unsigned int>  target_block = target_block_;
 
-    const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension>
-    fe_collection (dof_handler.get_fe_collection());
+    const dealii::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> &
+    fe_collection = dof_handler.get_fe_collection();
     Assert (fe_collection.size() < 256, ExcNotImplemented());
 
     for (unsigned int this_fe=0; this_fe<fe_collection.size(); ++this_fe)
@@ -1989,7 +1989,7 @@ namespace DoFTools
         const unsigned int dim = DoFHandlerType::dimension;
         const unsigned int spacedim = DoFHandlerType::space_dimension;
 
-        hp::FECollection<dim, spacedim> fe_collection(dof_handler.get_fe_collection());
+        const hp::FECollection<dim, spacedim> &fe_collection = dof_handler.get_fe_collection();
         hp::QCollection<dim> q_coll_dummy;
 
         for (unsigned int fe_index = 0; fe_index < fe_collection.size(); ++fe_index)
index 9c8cd8cf49e23843d6847db892b24e654d9d5516..028b2fa00643ed802926f5a951e236acdf6e4a0c 100644 (file)
@@ -143,7 +143,7 @@ namespace DoFTools
                   "associated DoF handler objects, asking for any subdomain other "
                   "than the locally owned one does not make sense."));
 
-    const hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> fe_collection (dof.get_fe_collection());
+    const hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> &fe_collection = dof.get_fe_collection();
 
     const std::vector<Table<2,Coupling> > dof_mask //(fe_collection.size())
       = dof_couplings_from_component_couplings (fe_collection,
index ae53e75c7da6ebf0b31429723aa43a9b863f643c..98da916dcbf5cbad037db5262bad37906c44715d 100644 (file)
@@ -279,7 +279,7 @@ void DataOutStack<dim,spacedim,DoFHandlerType>::build_patches (const unsigned in
   // collection of which we do a
   // shallow copy instead
   const hp::QCollection<dim>       q_collection (patch_points);
-  const hp::FECollection<dim>      fe_collection(dof_handler->get_fe_collection());
+  const hp::FECollection<dim>     &fe_collection = dof_handler->get_fe_collection();
 
   hp::FEValues<dim> x_fe_patch_values (fe_collection, q_collection,
                                        update_values);
index c77d601186083414bfb515c25ffe350b90cce3e6..db082e7667aa14f489a4ebe7596f8b4631c0078b 100644 (file)
@@ -778,7 +778,7 @@ namespace DerivativeApproximation
       // collection of which we do a
       // shallow copy instead
       const hp::QCollection<dim>       q_collection (midpoint_rule);
-      const hp::FECollection<dim>      fe_collection(dof_handler.get_fe_collection());
+      const hp::FECollection<dim>     &fe_collection = dof_handler.get_fe_collection();
       const hp::MappingCollection<dim> mapping_collection (mapping);
 
       hp::FEValues<dim> x_fe_midpoint_value (mapping_collection, fe_collection,
index 230c2979e342a5e72cfa2b9f9df81cdf3a2b989c..308215f221a25edbe53b0a2bb9c49882afbb0d71 100644 (file)
@@ -324,7 +324,7 @@ estimate (const Mapping<1,spacedim>                  &mapping,
   const QGauss<0> face_quadrature(1);
   const hp::QCollection<0> q_face_collection(face_quadrature);
 
-  const hp::FECollection<1,spacedim> fe (dof_handler.get_fe_collection());
+  const hp::FECollection<1,spacedim> &fe = dof_handler.get_fe_collection();
 
   hp::MappingCollection<1,spacedim> mapping_collection;
   mapping_collection.push_back (mapping);

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.