From 8ecaa09067ed15eebedbcec884835edf8225d7ca Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 21 Aug 2017 18:59:35 +0200 Subject: [PATCH] Replace hp::FECollection copies by constant references --- .../numerics/fe_field_function.templates.h | 6 +++--- .../deal.II/numerics/vector_tools.templates.h | 13 ++++++------- source/dofs/dof_renumbering.cc | 2 +- source/dofs/dof_tools.cc | 18 +++++++++--------- source/dofs/dof_tools_sparsity.cc | 2 +- source/numerics/data_out_stack.cc | 2 +- source/numerics/derivative_approximation.cc | 2 +- source/numerics/error_estimator_1d.cc | 2 +- 8 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 2df9a95fe8..2ccc406a69 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -260,7 +260,7 @@ namespace Functions unsigned int ncells = compute_point_locations(points, cells, qpoints, maps); hp::MappingCollection mapping_collection (mapping); - hp::FECollection fe_collection (dh->get_fe_collection()); + const hp::FECollection &fe_collection = dh->get_fe_collection(); hp::QCollection quadrature_collection; // Create quadrature collection for (unsigned int i=0; i mapping_collection (mapping); - hp::FECollection fe_collection (dh->get_fe_collection()); + const hp::FECollection &fe_collection = dh->get_fe_collection(); hp::QCollection quadrature_collection; // Create quadrature collection for (unsigned int i=0; i mapping_collection (mapping); - hp::FECollection fe_collection (dh->get_fe_collection()); + const hp::FECollection &fe_collection = dh->get_fe_collection(); hp::QCollection quadrature_collection; // Create quadrature collection for (unsigned int i=0; i 0, ComponentMask::ExcNoComponentSelected()); - const hp::FECollection fe (dof.get_fe_collection()); + const hp::FECollection &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 - fe(dof.get_fe_collection()); + const hp::FECollection &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 finite_elements (dof.get_fe_collection()); + const dealii::hp::FECollection &finite_elements = dof.get_fe_collection(); dealii::hp::QCollection q_collection; for (unsigned int f=0; f fe_collection (dof_handler.get_fe_collection()); + const hp::FECollection &fe_collection = dof_handler.get_fe_collection(); hp::MappingCollection mapping_collection; for (unsigned int i=0; i fe_collection (dof_handler.get_fe_collection()); + const hp::FECollection &fe_collection = dof_handler.get_fe_collection(); hp::MappingCollection mapping_collection; for (unsigned int i=0; i fe_collection (dof.get_fe_collection()); + const dealii::hp::FECollection &fe_collection = dof.get_fe_collection(); IDScratchData data(mapping, fe_collection, q, update_flags); // loop over all cells diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index 34f2dc083e..ec65062d44 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -1524,7 +1524,7 @@ namespace DoFRenumbering std::vector,unsigned int> > support_point_list (n_dofs); - const hp::FECollection fe_collection (dof.get_fe_collection()); + const hp::FECollection &fe_collection = dof.get_fe_collection(); Assert (fe_collection[0].has_support_points(), typename FiniteElement::ExcFEHasNoSupportPoints()); hp::QCollection quadrature_collection; diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 4fbbdfe0de..9e3cb7e34a 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -178,8 +178,8 @@ namespace DoFTools const ComponentMask &component_mask, std::vector &dofs_by_component) { - const dealii::hp::FECollection - fe_collection (dof.get_fe_collection()); + const dealii::hp::FECollection & + 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 &dofs_by_block) { - const dealii::hp::FECollection - fe_collection (dof.get_fe_collection()); + const dealii::hp::FECollection & + 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 - fe_collection (dof_handler.get_fe_collection()); + const dealii::hp::FECollection & + fe_collection = dof_handler.get_fe_collection(); std::vector > element_constant_modes; std::vector > > constant_mode_to_component_translation(n_components); @@ -1824,8 +1824,8 @@ namespace DoFTools { std::vector target_block = target_block_; - const dealii::hp::FECollection - fe_collection (dof_handler.get_fe_collection()); + const dealii::hp::FECollection & + fe_collection = dof_handler.get_fe_collection(); Assert (fe_collection.size() < 256, ExcNotImplemented()); for (unsigned int this_fe=0; this_fe fe_collection(dof_handler.get_fe_collection()); + const hp::FECollection &fe_collection = dof_handler.get_fe_collection(); hp::QCollection q_coll_dummy; for (unsigned int fe_index = 0; fe_index < fe_collection.size(); ++fe_index) diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 9c8cd8cf49..028b2fa006 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -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 fe_collection (dof.get_fe_collection()); + const hp::FECollection &fe_collection = dof.get_fe_collection(); const std::vector > dof_mask //(fe_collection.size()) = dof_couplings_from_component_couplings (fe_collection, diff --git a/source/numerics/data_out_stack.cc b/source/numerics/data_out_stack.cc index ae53e75c7d..98da916dcb 100644 --- a/source/numerics/data_out_stack.cc +++ b/source/numerics/data_out_stack.cc @@ -279,7 +279,7 @@ void DataOutStack::build_patches (const unsigned in // collection of which we do a // shallow copy instead const hp::QCollection q_collection (patch_points); - const hp::FECollection fe_collection(dof_handler->get_fe_collection()); + const hp::FECollection &fe_collection = dof_handler->get_fe_collection(); hp::FEValues x_fe_patch_values (fe_collection, q_collection, update_values); diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index c77d601186..db082e7667 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -778,7 +778,7 @@ namespace DerivativeApproximation // collection of which we do a // shallow copy instead const hp::QCollection q_collection (midpoint_rule); - const hp::FECollection fe_collection(dof_handler.get_fe_collection()); + const hp::FECollection &fe_collection = dof_handler.get_fe_collection(); const hp::MappingCollection mapping_collection (mapping); hp::FEValues x_fe_midpoint_value (mapping_collection, fe_collection, diff --git a/source/numerics/error_estimator_1d.cc b/source/numerics/error_estimator_1d.cc index 230c2979e3..308215f221 100644 --- a/source/numerics/error_estimator_1d.cc +++ b/source/numerics/error_estimator_1d.cc @@ -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); -- 2.39.5