]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Deprecate types_are_equal. 4819/head
authorDavid Wells <wellsd2@rpi.edu>
Sun, 13 Aug 2017 21:16:41 +0000 (17:16 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sun, 13 Aug 2017 21:27:58 +0000 (17:27 -0400)
C++11 provides std::is_same, which has the same functionality.

23 files changed:
include/deal.II/base/aligned_vector.h
include/deal.II/base/template_constraints.h
include/deal.II/lac/constraint_matrix.templates.h
include/deal.II/lac/full_matrix.templates.h
include/deal.II/lac/precondition.h
include/deal.II/lac/solver_cg.h
include/deal.II/lac/sparse_decomposition.templates.h
include/deal.II/lac/vector_operations_internal.h
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/shape_info.templates.h
source/fe/fe_q_base.cc
tests/lac/gmres_eigenvalues.cc
tests/lac/gmres_reorthogonalize_01.cc
tests/lac/gmres_reorthogonalize_03.cc
tests/lac/la_vector_add_and_dot.cc
tests/lac/vector_add_and_dot.cc
tests/matrix_free/get_functions_multife.cc
tests/matrix_free/get_functions_multife2.cc
tests/matrix_free/parallel_multigrid.cc
tests/matrix_free/parallel_multigrid_02.cc
tests/matrix_free/parallel_multigrid_adaptive_01.cc
tests/matrix_free/parallel_multigrid_adaptive_02.cc
tests/matrix_free/parallel_multigrid_adaptive_04.cc

index 29b0933023fdc7bccee654f54a217378f69f65b0..7b36302ff6ada1151d4b39c80f33c2740b7a7a10 100644 (file)
@@ -412,7 +412,7 @@ namespace internal
       // completely fill its memory and may lead to false positives in
       // e.g. valgrind
       if (std::is_trivial<T>::value == true &&
-          types_are_equal<T,long double>::value == false)
+          std::is_same<T,long double>::value == false)
         {
           const unsigned char zero [sizeof(T)] = {};
           // cast element to (void*) to silence compiler warning for virtual
index f98785b01497f3b94c935b80185d7a403c42e399..1ea804679844aca4661ec6cbc852df40b8567693 100644 (file)
@@ -283,7 +283,7 @@ namespace internal
  * @code
  *   template <typename T>
  *   void Vector<T>::some_operation () {
- *     if (types_are_equal<T,double>::value == true)
+ *     if (std::is_same<T,double>::value == true)
  *       call_some_blas_function_for_doubles;
  *     else
  *       do_it_by_hand;
@@ -292,24 +292,30 @@ namespace internal
  *
  * This construct is made possible through the existence of a partial
  * specialization of the class for template arguments that are equal.
+ *
+ * @deprecated Use the standard library type trait <code>std::is_same</code>
+ * instead of this class.
  */
 template <typename T, typename U>
 struct types_are_equal
 {
   static const bool value = false;
-};
+} DEAL_II_DEPRECATED;
 
 
 /**
  * Partial specialization of the general template for the case that both
  * template arguments are equal. See the documentation of the general template
  * for more information.
+ *
+ * @deprecated Use the standard library type trait <code>std::is_same</code>
+ * instead of this class.
  */
 template <typename T>
 struct types_are_equal<T,T>
 {
   static const bool value = true;
-};
+} DEAL_II_DEPRECATED;
 
 
 /**
index e7588f4318165284de654bfcb0d27c8c8c38d505..237a7728b5b19dfa278c45743ecbec7135381640 100644 (file)
@@ -2241,7 +2241,7 @@ ConstraintMatrix::distribute_local_to_global (
                             global_vector.size() == 0) ? false : true;
   typedef typename MatrixType::value_type number;
   const bool use_dealii_matrix =
-    types_are_equal<MatrixType,SparseMatrix<number> >::value;
+    std::is_same<MatrixType,SparseMatrix<number> >::value;
 
   AssertDimension (local_matrix.n(), local_dof_indices.size());
   AssertDimension (local_matrix.m(), local_dof_indices.size());
@@ -2344,7 +2344,7 @@ ConstraintMatrix::distribute_local_to_global (
   // add must be equal if we have a Trilinos or PETSc vector but do not have to
   // be if we have a deal.II native vector: one could further optimize this for
   // Vector, LinearAlgebra::distributed::vector, etc.
-  if (types_are_equal<typename VectorType::value_type, number>::value)
+  if (std::is_same<typename VectorType::value_type, number>::value)
     {
       global_vector.add(vector_indices,
                         *reinterpret_cast<std::vector<number> *>(&vector_values));
@@ -2382,7 +2382,7 @@ distribute_local_to_global (const FullMatrix<typename MatrixType::value_type>  &
                             global_vector.size() == 0) ? false : true;
   typedef typename MatrixType::value_type number;
   const bool use_dealii_matrix =
-    types_are_equal<MatrixType,BlockSparseMatrix<number> >::value;
+    std::is_same<MatrixType,BlockSparseMatrix<number> >::value;
 
   AssertDimension (local_matrix.n(), local_dof_indices.size());
   AssertDimension (local_matrix.m(), local_dof_indices.size());
index 2dd9ded9ae1d4e18dcd42db1f50b66cfea82d9b2..d225677f77bc63dec52903e18550c933557d71d1 100644 (file)
@@ -527,11 +527,11 @@ void FullMatrix<number>::mmult (FullMatrix<number2>       &dst,
   // works for us (it is usually not efficient to use BLAS for very small
   // matrices):
 #ifdef DEAL_II_WITH_LAPACK
-  if ((types_are_equal<number,double>::value
+  if ((std::is_same<number,double>::value
        ||
-       types_are_equal<number,float>::value)
+       std::is_same<number,float>::value)
       &&
-      types_are_equal<number,number2>::value)
+      std::is_same<number,number2>::value)
     if (this->n()*this->m()*src.n() > 300)
       {
         // In case we have the BLAS function gemm detected by CMake, we
@@ -597,11 +597,11 @@ void FullMatrix<number>::Tmmult (FullMatrix<number2>       &dst,
   // works for us (it is usually not efficient to use BLAS for very small
   // matrices):
 #ifdef DEAL_II_WITH_LAPACK
-  if ((types_are_equal<number,double>::value
+  if ((std::is_same<number,double>::value
        ||
-       types_are_equal<number,float>::value)
+       std::is_same<number,float>::value)
       &&
-      types_are_equal<number,number2>::value)
+      std::is_same<number,number2>::value)
     if (this->n()*this->m()*src.n() > 300)
       {
         // In case we have the BLAS function gemm detected by CMake, we
@@ -687,11 +687,11 @@ void FullMatrix<number>::mTmult (FullMatrix<number2>       &dst,
   // works for us (it is usually not efficient to use BLAS for very small
   // matrices):
 #ifdef DEAL_II_WITH_LAPACK
-  if ((types_are_equal<number,double>::value
+  if ((std::is_same<number,double>::value
        ||
-       types_are_equal<number,float>::value)
+       std::is_same<number,float>::value)
       &&
-      types_are_equal<number,number2>::value)
+      std::is_same<number,number2>::value)
     if (this->n()*this->m()*src.m() > 300)
       {
         // In case we have the BLAS function gemm detected by CMake, we
@@ -775,11 +775,11 @@ void FullMatrix<number>::TmTmult (FullMatrix<number2>       &dst,
   // works for us (it is usually not efficient to use BLAS for very small
   // matrices):
 #ifdef DEAL_II_WITH_LAPACK
-  if ((types_are_equal<number,double>::value
+  if ((std::is_same<number,double>::value
        ||
-       types_are_equal<number,float>::value)
+       std::is_same<number,float>::value)
       &&
-      types_are_equal<number,number2>::value)
+      std::is_same<number,number2>::value)
     if (this->n()*this->m()*src.m() > 300)
       {
         // In case we have the BLAS function gemm detected by CMake, we
@@ -1762,9 +1762,9 @@ FullMatrix<number>::gauss_jordan ()
   // efficient to use Lapack for very small
   // matrices):
 #ifdef DEAL_II_WITH_LAPACK
-  if (types_are_equal<number,double>::value
+  if (std::is_same<number,double>::value
       ||
-      types_are_equal<number,float>::value)
+      std::is_same<number,float>::value)
     if (this->n_cols() > 15)
       {
         // In case we have the LAPACK functions
index 1d1d50409157d7d8e8ed4ed50a384bb9714b8511..3e986e00db774955ed584d5fb3ce3ac8d8ec482b 100644 (file)
@@ -2124,10 +2124,10 @@ PreconditionChebyshev<MatrixType,VectorType,PreconditionerType>::estimate_eigenv
 
   // We do not need the third auxiliary vector in case we have a
   // DiagonalMatrix as preconditioner and use deal.II's own vectors
-  if (types_are_equal<PreconditionerType,DiagonalMatrix<VectorType> >::value == false ||
-      (types_are_equal<VectorType,dealii::Vector<typename VectorType::value_type> >::value == false
+  if (std::is_same<PreconditionerType,DiagonalMatrix<VectorType> >::value == false ||
+      (std::is_same<VectorType,dealii::Vector<typename VectorType::value_type> >::value == false
        &&
-       types_are_equal<VectorType,LinearAlgebra::distributed::Vector<typename VectorType::value_type> >::value == false
+       std::is_same<VectorType,LinearAlgebra::distributed::Vector<typename VectorType::value_type> >::value == false
       ))
     update3.reinit (src, true);
 
index 7ec47b44679a2e3d142e1947153d12736936ebd6..41e78aa68bda85c129653b0691ba025443e0fbc7 100644 (file)
@@ -402,7 +402,7 @@ SolverCG<VectorType>::solve (const MatrixType         &A,
           return;
         }
 
-      if (types_are_equal<PreconditionerType,PreconditionIdentity>::value == false)
+      if (std::is_same<PreconditionerType,PreconditionIdentity>::value == false)
         {
           precondition.vmult(h,g);
 
@@ -434,7 +434,7 @@ SolverCG<VectorType>::solve (const MatrixType         &A,
           if (conv != SolverControl::iterate)
             break;
 
-          if (types_are_equal<PreconditionerType,PreconditionIdentity>::value
+          if (std::is_same<PreconditionerType,PreconditionIdentity>::value
               == false)
             {
               precondition.vmult(h,g);
index 1adc70d93c6d6b5ff56b46950e58ada00712db26..8bd5f9db4431a07946c362bde1ef7f190d7590e6 100644 (file)
@@ -163,7 +163,7 @@ SparseLUDecomposition<number>::copy_from (const SparseMatrix<somenumber> &matrix
       const somenumber *input_ptr = matrix.val.get();
       number *this_ptr = this->val.get();
       const number *const end_ptr = this_ptr + this->n_nonzero_elements();
-      if (types_are_equal<somenumber, number>::value == true)
+      if (std::is_same<somenumber, number>::value == true)
         std::memcpy (this_ptr, input_ptr, this->n_nonzero_elements()*sizeof(number));
       else
         for ( ; this_ptr != end_ptr; ++input_ptr, ++this_ptr)
index 35fc9762bf95d57ea4c5bed3319572ff396edfcf..e24c203041c268cf4cf25155954dd2657f91dd82 100644 (file)
@@ -228,7 +228,7 @@ namespace internal
 
       void operator() (const size_type begin, const size_type end) const
       {
-        if (types_are_equal<Number,OtherNumber>::value)
+        if (std::is_same<Number,OtherNumber>::value)
           std::memcpy(dst+begin, src+begin, (end-begin)*sizeof(Number));
         else
           {
@@ -689,7 +689,7 @@ namespace internal
     template <typename Number, typename Number2>
     struct Dot
     {
-      static const bool vectorizes = types_are_equal<Number,Number2>::value &&
+      static const bool vectorizes = std::is_same<Number,Number2>::value &&
                                      (VectorizedArray<Number>::n_array_elements > 1);
 
       Dot(const Number *X, const Number2 *Y)
index 42b2d59eec723781c363f2ba006b594ad536c9e6..a9d29029fd10b3ca325a10f876c25cd3d40f36b3 100644 (file)
@@ -3083,7 +3083,7 @@ FEEvaluationBase<dim,n_components_,Number>
                 for (unsigned int comp=0; comp<n_components; ++comp)
                   operation.process_dof_gather(dof_indices+ind,
                                                *src[comp], values_dofs[comp][j],
-                                               std::integral_constant<bool, types_are_equal<typename VectorType::value_type,Number>::value>());
+                                               std::integral_constant<bool, std::is_same<typename VectorType::value_type,Number>::value>());
             }
         }
 
@@ -3226,7 +3226,7 @@ FEEvaluationBase<dim,n_components_,Number>
                 for (unsigned int j=0; j<dofs_per_cell; ++j, ind += VectorizedArray<Number>::n_array_elements)
                   operation.process_dof_gather(dof_indices+ind,
                                                *src[0], values_dofs[comp][j],
-                                               std::integral_constant<bool, types_are_equal<typename VectorType::value_type,Number>::value>());
+                                               std::integral_constant<bool, std::is_same<typename VectorType::value_type,Number>::value>());
             }
         }
 
index 9bc6bea4fe55fcf23fa6f5c6fe3087128eee2508..c0036232737a01618c965d5ebbc35d9032425d6f 100644 (file)
@@ -378,7 +378,7 @@ namespace internal
         return false;
 
       const double zero_tol =
-        types_are_equal<Number,double>::value==true?1e-12:1e-7;
+        std::is_same<Number,double>::value==true?1e-12:1e-7;
       // symmetry for values
       const unsigned int n_dofs_1d = fe_degree + 1;
       for (unsigned int i=0; i<(n_dofs_1d+1)/2; ++i)
@@ -480,7 +480,7 @@ namespace internal
         return false;
 
       const double zero_tol =
-        types_are_equal<Number,double>::value==true?1e-12:1e-7;
+        std::is_same<Number,double>::value==true?1e-12:1e-7;
       // check: identity operation for shape values
       const unsigned int n_points_1d = fe_degree+1;
       for (unsigned int i=0; i<n_points_1d; ++i)
index ad3cc46af1b1794f3b125699158a417d454b7f24..ba09eb8798946cb52af354aeeaec659d4db2a3dc 100644 (file)
@@ -132,7 +132,7 @@ struct FE_Q_Base<PolynomialType,xdim,xspacedim>::Implementation
     const unsigned int dim = 2;
 
     unsigned int q_deg = fe.degree;
-    if (types_are_equal<PolynomialType, TensorProductPolynomialsBubbles<dim> >::value)
+    if (std::is_same<PolynomialType, TensorProductPolynomialsBubbles<dim> >::value)
       q_deg = fe.degree-1;
 
     // restricted to each face, the traces of the shape functions is an
@@ -239,7 +239,7 @@ struct FE_Q_Base<PolynomialType,xdim,xspacedim>::Implementation
     const unsigned int dim = 3;
 
     unsigned int q_deg = fe.degree;
-    if (types_are_equal<PolynomialType,TensorProductPolynomialsBubbles<dim> >::value)
+    if (std::is_same<PolynomialType,TensorProductPolynomialsBubbles<dim> >::value)
       q_deg = fe.degree-1;
 
     // For a detailed documentation of the interpolation see the
@@ -422,7 +422,7 @@ FE_Q_Base<PolynomialType,dim,spacedim>::FE_Q_Base
   :
   FE_Poly<PolynomialType,dim,spacedim>(poly_space, fe_data, restriction_is_additive_flags,
                                        std::vector<ComponentMask>(1, std::vector<bool>(1,true))),
-  q_degree (types_are_equal<PolynomialType, TensorProductPolynomialsBubbles<dim> >::value
+  q_degree (std::is_same<PolynomialType, TensorProductPolynomialsBubbles<dim> >::value
             ?this->degree-1
             :this->degree)
 {}
index 46436c188d1c1cfccdae1fbf6acabbe76eed40fc..d1afe5ee915124ad0a7f476a0daa08d99b0401d1 100644 (file)
@@ -67,7 +67,7 @@ void test (unsigned int variant)
       }
   else
     Assert(false, ExcMessage("Invalid variant"));
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     Assert(variant < 4, ExcMessage("Invalid_variant"));
 
   deallog.push(Utilities::int_to_string(variant,1));
index 5699d0b2d24702c38e02e155ee3721c099117302..9f6bf861983af34c507647bc994c589356e25c0f 100644 (file)
@@ -60,7 +60,7 @@ void test (unsigned int variant)
       matrix(i,i) = 1e30*(i+1)*(i+1)*(i+1)*(i+1);
   else
     Assert(false, ExcMessage("Invalid variant"));
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     Assert(variant < 4, ExcMessage("Invalid_variant"));
 
   deallog.push(Utilities::int_to_string(variant,1));
index 5a9d81e5e15463a0765ea1c2a39f2fe9bac06730..523f0a6604e3f7d26c6d678c841c2cd0af089b4d 100644 (file)
@@ -59,7 +59,7 @@ void test (unsigned int variant)
       matrix(i,i) = 1e30*(i+1)*(i+1)*(i+1)*(i+1);
   else
     Assert(false, ExcMessage("Invalid variant"));
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     Assert(variant < 4, ExcMessage("Invalid_variant"));
 
   deallog.push(Utilities::int_to_string(variant,1));
index 92f58f37af1029b5d4dfa3ce58d75da438cb1ac3..e727d6258c3f1f7f78fa88fdc4ac1eec036fc2fb 100644 (file)
@@ -43,7 +43,7 @@ void check ()
       v1.add(factor, v2);
       const number prod = v1 * v3;
       const number prod_check = check.add_and_dot(factor, v2, v3);
-      if (test == 0 && types_are_equal<number,double>::value)
+      if (test == 0 && std::is_same<number,double>::value)
         {
           deallog << "Vector add reference:   ";
           for (unsigned int i=0; i<size; ++i)
index c339799ea81946e33c6e2391cb0200de178faacb..bfe935c089f75c0639d6639b69a2c5c5ff627292 100644 (file)
@@ -41,7 +41,7 @@ void check ()
       v1.add(factor, v2);
       const number prod = v1 * v3;
       const number prod_check = check.add_and_dot(factor, v2, v3);
-      if (test == 0 && types_are_equal<number,double>::value)
+      if (test == 0 && std::is_same<number,double>::value)
         {
           deallog << "Vector add reference:   ";
           v1.print(deallog);
index 291c2390e9840951e673b6b5158d66abfed60371..c9df24a3b8fc9ee6f0953f299615e577ba55bd5f 100644 (file)
@@ -146,7 +146,7 @@ public:
     // for floats for the relative error size
     for (unsigned int i=0; i<2; ++i)
       {
-        if (types_are_equal<Number,double>::value == true)
+        if (std::is_same<Number,double>::value == true)
           {
             deallog << "Error function values FE " << i << ": "
                     << errors[i*3+0]/total[i*3+0] << std::endl;
@@ -164,7 +164,7 @@ public:
             const double output2 = total[i*3+2] == 0 ? 0. : errors[i*3+2] / total[i*3+2];
             deallog << "Error function Laplacians FE " << i << ": " << output2 << std::endl;
           }
-        else if (types_are_equal<Number,float>::value == true)
+        else if (std::is_same<Number,float>::value == true)
           {
             deallog << "Error function values FE " << i << ": "
                     << errors[i*3+0]/total[i*3+0] << std::endl;
index 32eb2a3f87c71f9bb1e4aa6edcaf2533b80dfe31..81a42292e35e3511fb2150d6dbffaaf472cf3f2d 100644 (file)
@@ -185,7 +185,7 @@ public:
     // for floats for the relative error size
     for (unsigned int i=0; i<3; ++i)
       {
-        if (types_are_equal<Number,double>::value == true)
+        if (std::is_same<Number,double>::value == true)
           {
             deallog << "Error function values FE " << i << ": "
                     << errors[i*3+0]/total[i*3+0] << std::endl;
@@ -203,7 +203,7 @@ public:
             const double output2 = total[i*3+2] == 0 ? 0. : errors[i*3+2] / total[i*3+2];
             deallog << "Error function Laplacians FE " << i << ": " << output2 << std::endl;
           }
-        else if (types_are_equal<Number,float>::value == true)
+        else if (std::is_same<Number,float>::value == true)
           {
             deallog << "Error function values FE " << i << ": "
                     << errors[i*3+0]/total[i*3+0] << std::endl;
index d256d4efb1e0e6d7007d0e5e67b46299c9d10095..d01c5e6e8c64aca63342ff8b04436b371278b933 100644 (file)
@@ -305,7 +305,7 @@ public:
 template <int dim, int fe_degree, int n_q_points_1d, typename number>
 void do_test (const DoFHandler<dim>  &dof)
 {
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     {
       deallog.push("float");
     }
@@ -383,7 +383,7 @@ void do_test (const DoFHandler<dim>  &dof)
     solver.solve(fine_matrix, sol, in, preconditioner);
   }
 
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     deallog.pop();
 }
 
index ed61d84c8d34a28ca21d2bc2674d6360c940d132..84db5993b565c601456244e9b05163a86d35aa44 100644 (file)
@@ -76,7 +76,7 @@ using namespace dealii::MatrixFreeOperators;
 template <int dim, int fe_degree, int n_q_points_1d, typename number>
 void do_test (const DoFHandler<dim>  &dof)
 {
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     {
       deallog.push("float");
     }
@@ -199,7 +199,7 @@ void do_test (const DoFHandler<dim>  &dof)
     solver.solve(fine_matrix, sol, in, preconditioner);
   }
 
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     deallog.pop();
 
   fine_matrix.clear();
index 0b1c9bd12d6cae23ae72adc3e03a83a8301c252a..bfd6eb2d4ff1f376ee0f35e3d46dbb347625e778 100644 (file)
@@ -432,7 +432,7 @@ public:
 template <int dim, int fe_degree, int n_q_points_1d, typename number>
 void do_test (const DoFHandler<dim>  &dof)
 {
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     {
       deallog.push("float");
     }
@@ -536,7 +536,7 @@ void do_test (const DoFHandler<dim>  &dof)
     solver.solve(fine_matrix, sol, in, preconditioner);
   }
 
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     deallog.pop();
 }
 
index d5a7acbbadc5b16c8f29df6e9919af014eedaa3d..f59a08018754c82198d879269dfb567347553650 100644 (file)
@@ -113,7 +113,7 @@ public:
 template <int dim, int fe_degree, int n_q_points_1d, typename number>
 void do_test (const DoFHandler<dim>  &dof)
 {
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     {
       deallog.push("float");
     }
@@ -259,7 +259,7 @@ void do_test (const DoFHandler<dim>  &dof)
     solver.solve(fine_matrix, sol, in, preconditioner);
   }
 
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     deallog.pop();
 
   fine_matrix.clear();
index 41886c1a2b4313241a51d29f486164bce209cccd..155dca380512877b61bd7e1670762160ce49e322 100644 (file)
@@ -113,7 +113,7 @@ public:
 template <int dim, int fe_degree, int n_q_points_1d, typename number>
 void do_test (const DoFHandler<dim>  &dof)
 {
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     {
       deallog.push("float");
     }
@@ -259,7 +259,7 @@ void do_test (const DoFHandler<dim>  &dof)
     solver.solve(fine_matrix, sol, in, preconditioner);
   }
 
-  if (types_are_equal<number,float>::value == true)
+  if (std::is_same<number,float>::value == true)
     deallog.pop();
 
   fine_matrix.clear();

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.