]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use const& instead of const where applicable 5081/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 14 Sep 2017 13:34:30 +0000 (15:34 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 14 Sep 2017 13:42:44 +0000 (15:42 +0200)
12 files changed:
include/deal.II/base/data_out_base.h
include/deal.II/fe/mapping_fe_field.h
include/deal.II/grid/filtered_iterator.h
include/deal.II/lac/read_write_vector.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/numerics/dof_output_operator.h
include/deal.II/numerics/dof_output_operator.templates.h
include/deal.II/numerics/error_estimator.templates.h
source/base/convergence_table.cc
source/base/data_out_base.cc
source/fe/mapping_fe_field.cc
source/opencascade/utilities.cc

index 0aa48c01bad56adbf62815203574517e1d984463..be9c8e584e1cf5a74412570fe287199d0a754c87 100644 (file)
@@ -2988,7 +2988,7 @@ public:
    * cases where <code>solution_filename == mesh_filename</code>, and
    * <code>dim==spacedim</code>.
    */
-  XDMFEntry(const std::string filename,
+  XDMFEntry(const std::string &filename,
             const double time,
             const unsigned int nodes,
             const unsigned int cells,
@@ -2998,8 +2998,8 @@ public:
    * Simplified constructor that calls the complete constructor for
    * cases where <code>dim==spacedim</code>.
    */
-  XDMFEntry(const std::string mesh_filename,
-            const std::string solution_filename,
+  XDMFEntry(const std::string &mesh_filename,
+            const std::string &solution_filename,
             const double time,
             const unsigned int nodes,
             const unsigned int cells,
@@ -3008,8 +3008,8 @@ public:
   /**
    * Constructor that sets all members to provided parameters.
    */
-  XDMFEntry(const std::string mesh_filename,
-            const std::string solution_filename,
+  XDMFEntry(const std::string &mesh_filename,
+            const std::string &solution_filename,
             const double time,
             const unsigned int nodes,
             const unsigned int cells,
index 48b0f34e8c4d614c1a0c12ecef4e6a85e8c371bb..43993b4f2b15fb87753d699c3886f94cde184a19 100644 (file)
@@ -111,7 +111,7 @@ public:
    */
   MappingFEField (const DoFHandlerType &euler_dof_handler,
                   const VectorType     &euler_vector,
-                  const ComponentMask   mask = ComponentMask());
+                  const ComponentMask   &mask = ComponentMask());
 
   /**
    * Copy constructor.
@@ -253,7 +253,7 @@ public:
      * Constructor.
      */
     InternalData(const FiniteElement<dim,spacedim> &fe,
-                 const ComponentMask mask);
+                 const ComponentMask &mask);
 
     /**
      * Shape function at quadrature point. Shape functions are in tensor
index af9d13b9f514f3cda8c2156a7625d88eaa101b32..a7ac28c0f206f9318c62c899488cbdf933519b41 100644 (file)
@@ -234,7 +234,7 @@ namespace IteratorFilters
      * have to be evaluated to true and state if the iterator must be locally
      * owned.
      */
-    MaterialIdEqualTo (const std::set<types::material_id> material_ids,
+    MaterialIdEqualTo (const std::set<types::material_id> &material_ids,
                        const bool only_locally_owned = false);
 
     /**
@@ -280,7 +280,7 @@ namespace IteratorFilters
      * shall have to be evaluated to true and state if the iterator must be
      * locally owned.
      */
-    ActiveFEIndexEqualTo (const std::set<unsigned int> active_fe_indices,
+    ActiveFEIndexEqualTo (const std::set<unsigned int> &active_fe_indices,
                           const bool only_locally_owned = false);
 
     /**
@@ -1301,7 +1301,7 @@ namespace IteratorFilters
 
 
   inline
-  MaterialIdEqualTo::MaterialIdEqualTo (const std::set<types::material_id> material_ids,
+  MaterialIdEqualTo::MaterialIdEqualTo (const std::set<types::material_id> &material_ids,
                                         const bool only_locally_owned)
     :
     material_ids (material_ids),
@@ -1339,7 +1339,7 @@ namespace IteratorFilters
 
 
   inline
-  ActiveFEIndexEqualTo::ActiveFEIndexEqualTo (const std::set<unsigned int> active_fe_indices,
+  ActiveFEIndexEqualTo::ActiveFEIndexEqualTo (const std::set<unsigned int> &active_fe_indices,
                                               const bool only_locally_owned)
     :
     active_fe_indices (active_fe_indices),
index 8a89f0229a4062e8cdcbe8fb34f7afdc7ddaa007..60feffc99b31df0be77939007e254fbc2ced9d28 100644 (file)
@@ -283,7 +283,7 @@ namespace LinearAlgebra
      */
     void import(const distributed::Vector<Number> &vec,
                 VectorOperation::values operation,
-                std::shared_ptr<const CommunicationPatternBase> communication_pattern =
+                const std::shared_ptr<const CommunicationPatternBase> &communication_pattern =
                   std::shared_ptr<const CommunicationPatternBase> ());
 
 #ifdef DEAL_II_WITH_PETSC
@@ -297,7 +297,7 @@ namespace LinearAlgebra
      */
     void import(const PETScWrappers::MPI::Vector &petsc_vec,
                 VectorOperation::values operation,
-                std::shared_ptr<const CommunicationPatternBase> communication_pattern =
+                const std::shared_ptr<const CommunicationPatternBase> &communication_pattern =
                   std::shared_ptr<const CommunicationPatternBase> ());
 #endif
 
@@ -564,7 +564,7 @@ namespace LinearAlgebra
                 const IndexSet                                 &locally_owned_elements,
                 VectorOperation::values                         operation,
                 const MPI_Comm                                 &mpi_comm,
-                std::shared_ptr<const CommunicationPatternBase> communication_pattern);
+                const std::shared_ptr<const CommunicationPatternBase> &communication_pattern);
 #endif
 
     /**
index 6d61802ef109e964c41b6cbea4dbd6417c7ef19d..80037c4139eb7ca3a03afb681fa9c01967a2ac0c 100644 (file)
@@ -232,7 +232,7 @@ namespace LinearAlgebra
   void
   ReadWriteVector<Number>::import(const distributed::Vector<Number> &vec,
                                   VectorOperation::values operation,
-                                  std::shared_ptr<const CommunicationPatternBase> communication_pattern)
+                                  const std::shared_ptr<const CommunicationPatternBase> &communication_pattern)
   {
     // If no communication pattern is given, create one. Otherwise, use the
     // given one.
@@ -301,7 +301,7 @@ namespace LinearAlgebra
   void
   ReadWriteVector<Number>::import(const PETScWrappers::MPI::Vector &petsc_vec,
                                   VectorOperation::values /*operation*/,
-                                  std::shared_ptr<const CommunicationPatternBase> /*communication_pattern*/)
+                                  const std::shared_ptr<const CommunicationPatternBase> & /*communication_pattern*/)
   {
     //TODO: this works only if no communication is needed.
     Assert(petsc_vec.locally_owned_elements() == stored_elements,
@@ -330,7 +330,7 @@ namespace LinearAlgebra
                                   const IndexSet                  &source_elements,
                                   VectorOperation::values          operation,
                                   const MPI_Comm                  &mpi_comm,
-                                  std::shared_ptr<const CommunicationPatternBase> communication_pattern)
+                                  const std::shared_ptr<const CommunicationPatternBase> &communication_pattern)
   {
     std::shared_ptr<const EpetraWrappers::CommunicationPattern> epetra_comm_pattern;
 
index dd9b757bdfa8b25ec1bed8a03f4de36cf678b3c9..497bfe93ac48d9cc87059b958e9470829a24270a 100644 (file)
@@ -47,7 +47,7 @@ namespace Algorithms
      * last step command. Numbers with less digits are filled with
      * zeros from the left.
      */
-    DoFOutputOperator (const std::string filename_base = std::string("output"),
+    DoFOutputOperator (const std::string &filename_base = std::string("output"),
                        const unsigned int digits = 3);
 
     void parse_parameters(ParameterHandler &param);
index 61e013c29b0b90775c320cf1232814e70bbc7c28..d76630c2ec4539a4883c40257107b82ffbd47497 100644 (file)
@@ -25,7 +25,7 @@ namespace Algorithms
 {
   template <typename VectorType, int dim, int spacedim>
   DoFOutputOperator<VectorType, dim, spacedim>::DoFOutputOperator (
-    const std::string filename_base,
+    const std::string &filename_base,
     const unsigned int digits)
     :
     filename_base(filename_base),
index 8ccab4a00ccabb10b57d37ad4106178c6e3bd763..b0e8d7021353767cd3a69acfe9b948b461056216 100644 (file)
@@ -185,7 +185,7 @@ namespace internal
                     const types::subdomain_id subdomain_id,
                     const types::material_id material_id,
                     const typename FunctionMap<spacedim>::type *neumann_bc,
-                    const ComponentMask                component_mask,
+                    const ComponentMask                &component_mask,
                     const Function<spacedim>                   *coefficients);
 
       /**
@@ -209,7 +209,7 @@ namespace internal
      const types::subdomain_id                           subdomain_id,
      const types::material_id                            material_id,
      const typename FunctionMap<spacedim>::type         *neumann_bc,
-     const ComponentMask                                 component_mask,
+     const ComponentMask                                 &component_mask,
      const Function<spacedim>                           *coefficients)
       :
       finite_element (fe),
index dec8ebc996e17acd6951bbe1e78b0677d6721897..b106525cfe778fe08d51d7ea6cf47ec533afbf0d 100644 (file)
@@ -105,7 +105,7 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column
   columns[rate_key].flag = 1;
   set_precision(rate_key, 2);
 
-  std::string superkey = data_column_key;
+  const std::string &superkey = data_column_key;
   if (!supercolumns.count(superkey))
     {
       add_column_to_supercolumn(data_column_key, superkey);
@@ -193,7 +193,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key,
   set_precision(rate_key, 2);
 
   // set the superkey equal to the key
-  std::string superkey=data_column_key;
+  const std::string &superkey=data_column_key;
   // and set the tex caption of the supercolumn to the tex caption of the
   // data_column.
   if (!supercolumns.count(superkey))
index 3ec7dbf731cf275f16864a80ddd18a2cc4d6361e..39f462ebf418ce2396d241a4b4bec717d75dbf55 100644 (file)
@@ -7652,7 +7652,7 @@ XDMFEntry::XDMFEntry()
 
 
 
-XDMFEntry::XDMFEntry(const std::string filename,
+XDMFEntry::XDMFEntry(const std::string &filename,
                      const double time,
                      const unsigned int nodes,
                      const unsigned int cells,
@@ -7669,8 +7669,8 @@ XDMFEntry::XDMFEntry(const std::string filename,
 
 
 
-XDMFEntry::XDMFEntry(const std::string mesh_filename,
-                     const std::string solution_filename,
+XDMFEntry::XDMFEntry(const std::string &mesh_filename,
+                     const std::string &solution_filename,
                      const double time,
                      const unsigned int nodes,
                      const unsigned int cells,
@@ -7687,8 +7687,8 @@ XDMFEntry::XDMFEntry(const std::string mesh_filename,
 
 
 
-XDMFEntry::XDMFEntry(const std::string mesh_filename,
-                     const std::string solution_filename,
+XDMFEntry::XDMFEntry(const std::string &mesh_filename,
+                     const std::string &solution_filename,
                      const double time,
                      const unsigned int nodes,
                      const unsigned int cells,
index decdef0fe6481dd61a6e6d74a7052125adc74911..1f2e35e624a6fcdcdf628ad96e3cd0e8e9f6247c 100644 (file)
@@ -58,7 +58,7 @@ DEAL_II_NAMESPACE_OPEN
 template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
 MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData::InternalData
 (const FiniteElement<dim,spacedim> &fe,
- const ComponentMask                mask)
+ const ComponentMask                &mask)
   :
   n_shape_functions (fe.dofs_per_cell),
   mask (mask),
@@ -204,7 +204,7 @@ template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
 MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::MappingFEField
 (const DoFHandlerType            &euler_dof_handler,
  const VectorType    &euler_vector,
- const ComponentMask  mask)
+ const ComponentMask  &mask)
   :
   euler_vector(&euler_vector),
   fe(&euler_dof_handler.get_fe()),
index 4ced09c483782cc1b4efdce7d8933622b97a1f04..113ac6ee07f1448a86c3885ed31694316c2f2cf8 100644 (file)
@@ -328,7 +328,7 @@ namespace OpenCASCADE
                          const double tolerance)
   {
     TopoDS_Edge out_shape;
-    TopoDS_Shape edges = in_shape;
+    const TopoDS_Shape &edges = in_shape;
     std::vector<Handle_Geom_BoundedCurve> intersections;
     TopLoc_Location L;
     Standard_Real First;

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.