]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use value semantics for parameters with trivial small types 9518/head
authorReza Rastak <rastak@stanford.edu>
Wed, 12 Feb 2020 08:45:22 +0000 (00:45 -0800)
committerReza Rastak <rastak@stanford.edu>
Wed, 12 Feb 2020 09:24:19 +0000 (01:24 -0800)
include/deal.II/base/parsed_convergence_table.h
include/deal.II/differentiation/ad/ad_helpers.h
include/deal.II/differentiation/sd/symengine_number_types.h
include/deal.II/differentiation/sd/symengine_tensor_operations.h
include/deal.II/fe/fe_interface_values.h
include/deal.II/meshworker/copy_data.h
source/base/parsed_convergence_table.cc
source/differentiation/sd/symengine_number_types.cc
source/particles/particle_handler.cc

index f25ce91f7f0fbe260a6e6d71bcf4df10f03448e3..76659f449ad9fbc2f7168718cf6952a541450e9e 100644 (file)
@@ -245,13 +245,13 @@ public:
   ParsedConvergenceTable(
     const std::vector<std::string> &                    component_names,
     const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms,
-    const double &                                      exponent,
+    const double                                        exponent,
     const std::set<std::string> &                       extra_columns,
     const std::string &                                 rate_key,
     const std::string &                                 rate_mode,
     const std::string &                                 error_file_name,
-    const unsigned int &                                precision,
-    const bool &                                        compute_error);
+    const unsigned int                                  precision,
+    const bool                                          compute_error);
 
   /**
    * Attach all the parameters in this class to entries of the parameter
@@ -362,7 +362,7 @@ public:
   void
   add_extra_column(const std::string &            column_name,
                    const std::function<double()> &custom_function,
-                   const bool &                   compute_rate = true);
+                   const bool                     compute_rate = true);
 
   /**
    * Difference between two solutions in the same vector space.
index e9c9261a748f62c9d59221e857b8c647d288b864..f8c6ec810eaaa565578e9c8b5ba133bf5e6068a5 100644 (file)
@@ -2438,9 +2438,9 @@ namespace Differentiation
        */
       template <typename TensorType, typename NumberType>
       inline void
-      set_tensor_entry(TensorType &        t,
-                       const unsigned int &unrolled_index,
-                       const NumberType &  value)
+      set_tensor_entry(TensorType &       t,
+                       const unsigned int unrolled_index,
+                       const NumberType & value)
       {
         // Where possible, set values using TableIndices
         AssertIndexRange(unrolled_index, t.n_independent_components);
@@ -2454,7 +2454,7 @@ namespace Differentiation
        */
       template <int dim, typename NumberType>
       inline void set_tensor_entry(Tensor<0, dim, NumberType> &t,
-                                   const unsigned int &        unrolled_index,
+                                   const unsigned int          unrolled_index,
                                    const NumberType &          value)
       {
         AssertIndexRange(unrolled_index, 1);
@@ -2470,9 +2470,9 @@ namespace Differentiation
        */
       template <typename NumberType>
       inline void
-      set_tensor_entry(NumberType &        t,
-                       const unsigned int &unrolled_index,
-                       const NumberType &  value)
+      set_tensor_entry(NumberType &       t,
+                       const unsigned int unrolled_index,
+                       const NumberType & value)
       {
         AssertIndexRange(unrolled_index, 1);
         (void)unrolled_index;
@@ -2487,9 +2487,9 @@ namespace Differentiation
        */
       template <int dim, typename NumberType>
       inline void set_tensor_entry(SymmetricTensor<4, dim, NumberType> &t,
-                                   const unsigned int &unrolled_index_row,
-                                   const unsigned int &unrolled_index_col,
-                                   const NumberType &  value)
+                                   const unsigned int unrolled_index_row,
+                                   const unsigned int unrolled_index_col,
+                                   const NumberType & value)
       {
         // Fourth order symmetric tensors require a specialized interface
         // to extract values.
@@ -2517,7 +2517,7 @@ namespace Differentiation
                 template <int, int, typename> class TensorType>
       inline NumberType
       get_tensor_entry(const TensorType<rank, dim, NumberType> &t,
-                       const unsigned int &                     unrolled_index)
+                       const unsigned int                       unrolled_index)
       {
         // Where possible, get values using TableIndices
         AssertIndexRange(unrolled_index, t.n_independent_components);
@@ -2535,7 +2535,7 @@ namespace Differentiation
                 template <int, int, typename> class TensorType>
       inline NumberType
       get_tensor_entry(const TensorType<0, dim, NumberType> &t,
-                       const unsigned int &                  unrolled_index)
+                       const unsigned int                    unrolled_index)
       {
         AssertIndexRange(unrolled_index, 1);
         (void)unrolled_index;
@@ -2550,7 +2550,7 @@ namespace Differentiation
        */
       template <typename NumberType>
       inline const NumberType &
-      get_tensor_entry(const NumberType &t, const unsigned int &unrolled_index)
+      get_tensor_entry(const NumberType &t, const unsigned int unrolled_index)
       {
         AssertIndexRange(unrolled_index, 1);
         (void)unrolled_index;
@@ -2568,7 +2568,7 @@ namespace Differentiation
                 template <int, int, typename> class TensorType>
       inline NumberType &
       get_tensor_entry(TensorType<rank, dim, NumberType> &t,
-                       const unsigned int &               unrolled_index)
+                       const unsigned int                 unrolled_index)
       {
         // Where possible, get values using TableIndices
         AssertIndexRange(unrolled_index, t.n_independent_components);
@@ -2585,7 +2585,7 @@ namespace Differentiation
                 typename NumberType,
                 template <int, int, typename> class TensorType>
       NumberType &get_tensor_entry(TensorType<0, dim, NumberType> &t,
-                                   const unsigned int &            index)
+                                   const unsigned int              index)
       {
         AssertIndexRange(index, 1);
         (void)index;
@@ -2600,7 +2600,7 @@ namespace Differentiation
        */
       template <typename NumberType>
       inline NumberType &
-      get_tensor_entry(NumberType &t, const unsigned int &index)
+      get_tensor_entry(NumberType &t, const unsigned int index)
       {
         AssertIndexRange(index, 1);
         (void)index;
index 7ba464c2592b6c02c50bcdd13adf3872db794090..fc3578a3e153b692251c50dcf0354ead965a9229 100644 (file)
@@ -194,7 +194,7 @@ namespace Differentiation
        * potential ambiguities related to implicit conversions in either user
        * code or math functions that are loaded into the standard namespace.
        */
-      explicit Expression(const bool &value);
+      explicit Expression(const bool value);
 
       /**
        * Constructor for arithmetic number types.
index faa80c3c3c7418cfd63256e4c3d9d8bd955276f5..348aba7f91790e45f7dd64b6896eed8de26a3550 100644 (file)
@@ -777,8 +777,8 @@ namespace Differentiation
     {
       template <int dim>
       TableIndices<4>
-      make_rank_4_tensor_indices(const unsigned int &idx_i,
-                                 const unsigned int &idx_j)
+      make_rank_4_tensor_indices(const unsigned int idx_i,
+                                 const unsigned int idx_j)
       {
         const TableIndices<2> indices_i(
           SymmetricTensor<2, dim>::unrolled_to_component_indices(idx_i));
index f7171a9ef9bceb761ad379a5d34132de19283aba..5231b202b0f90d9649803205345992358c30faeb 100644 (file)
@@ -113,11 +113,11 @@ public:
   template <class CellIteratorType>
   void
   reinit(const CellIteratorType &                         cell,
-         const unsigned int &                             face_no,
-         const unsigned int &                             sub_face_no,
+         const unsigned int                               face_no,
+         const unsigned int                               sub_face_no,
          const typename identity<CellIteratorType>::type &cell_neighbor,
-         const unsigned int &                             face_no_neighbor,
-         const unsigned int &                             sub_face_no_neighbor);
+         const unsigned int                               face_no_neighbor,
+         const unsigned int                               sub_face_no_neighbor);
 
   /**
    * Re-initialize this object to be used on an interface given by a single face
@@ -132,7 +132,7 @@ public:
    */
   template <class CellIteratorType>
   void
-  reinit(const CellIteratorType &cell, const unsigned int &face_no);
+  reinit(const CellIteratorType &cell, const unsigned int face_no);
 
   /**
    * Return a reference to the FEFaceValues or FESubfaceValues object
@@ -508,11 +508,11 @@ template <class CellIteratorType>
 void
 FEInterfaceValues<dim, spacedim>::reinit(
   const CellIteratorType &                         cell,
-  const unsigned int &                             face_no,
-  const unsigned int &                             sub_face_no,
+  const unsigned int                               face_no,
+  const unsigned int                               sub_face_no,
   const typename identity<CellIteratorType>::type &cell_neighbor,
-  const unsigned int &                             face_no_neighbor,
-  const unsigned int &                             sub_face_no_neighbor)
+  const unsigned int                               face_no_neighbor,
+  const unsigned int                               sub_face_no_neighbor)
 {
   if (sub_face_no == numbers::invalid_unsigned_int)
     {
@@ -587,7 +587,7 @@ template <int dim, int spacedim>
 template <class CellIteratorType>
 void
 FEInterfaceValues<dim, spacedim>::reinit(const CellIteratorType &cell,
-                                         const unsigned int &    face_no)
+                                         const unsigned int      face_no)
 {
   internal_fe_face_values.reinit(cell, face_no);
   fe_face_values          = &internal_fe_face_values;
index d3c1549e3f1785650dafeb249a1ddb8c482fa9fc..866034034da35d03356fb64f541bf33a4aff8297 100644 (file)
@@ -82,7 +82,7 @@ namespace MeshWorker
      * all set to numbers::invalid_dof_index.
      */
     void
-    operator=(const double &number);
+    operator=(const double number);
 
     /**
      * An array of local matrices.
@@ -140,8 +140,7 @@ namespace MeshWorker
 
   template <int n_matrices, int n_vectors, int n_dof_indices>
   void
-  CopyData<n_matrices, n_vectors, n_dof_indices>::
-  operator=(const double &number)
+  CopyData<n_matrices, n_vectors, n_dof_indices>::operator=(const double number)
   {
     Assert(number == 0.0,
            ExcMessage("You should only call this method with "
index cfcf8bca635dfa128b74d455c1ec653d3f798181..67481e13b233a92184210175ea3fc6ca7f5da20e 100644 (file)
@@ -78,13 +78,13 @@ ParsedConvergenceTable::ParsedConvergenceTable(
 ParsedConvergenceTable::ParsedConvergenceTable(
   const std::vector<std::string> &                    component_names,
   const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms,
-  const double &                                      exponent,
+  const double                                        exponent,
   const std::set<std::string> &                       extra_columns,
   const std::string &                                 rate_key,
   const std::string &                                 rate_mode,
   const std::string &                                 error_file_name,
-  const unsigned int &                                precision,
-  const bool &                                        compute_error)
+  const unsigned int                                  precision,
+  const bool                                          compute_error)
   : component_names(component_names)
   , unique_component_names(get_unique_component_names(component_names))
   , unique_component_masks(get_unique_component_masks(component_names))
@@ -262,7 +262,7 @@ void
 ParsedConvergenceTable::add_extra_column(
   const std::string &            column_name,
   const std::function<double()> &custom_function,
-  const bool &                   compute_rate)
+  const bool                     compute_rate)
 {
   extra_column_functions[column_name] = {custom_function, compute_rate};
 }
index 7851d8fbae089dc619316f533ee1fccf246242af..f4ff2f12066d84100ab166302c08d6de8f86172c 100644 (file)
@@ -50,7 +50,7 @@ namespace Differentiation
     {}
 
 
-    Expression::Expression(const bool &value)
+    Expression::Expression(const bool value)
       : expression(SE::boolean(value))
     {}
 
index 10cc945d00da9073c42e59619949a0b73bc21671..f470a83534eaa7ec212ee8d564fdad7ded2f9f5c 100644 (file)
@@ -525,9 +525,9 @@ namespace Particles
              i_particle < local_positions[i_cell].size();
              ++i_particle)
           {
-            const unsigned int &local_id_on_calling_process =
+            const unsigned int local_id_on_calling_process =
               original_indices_of_local_particles[i_cell][i_particle];
-            const unsigned int &calling_process =
+            const unsigned int calling_process =
               calling_process_indices[i_cell][i_particle];
 
             if (original_process_to_local_particle_indices.find(
@@ -600,9 +600,9 @@ namespace Particles
              i_particle < local_positions[i_cell].size();
              ++i_particle)
           {
-            const unsigned int &local_id_on_calling_process =
+            const unsigned int local_id_on_calling_process =
               original_indices_of_local_particles[i_cell][i_particle];
-            const unsigned int &calling_process =
+            const unsigned int calling_process =
               calling_process_indices[i_cell][i_particle];
 
             const unsigned int particle_id =

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.