]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide the ability to say NumberTraits<T>::is_complex.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 5 Nov 2007 04:05:53 +0000 (04:05 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 5 Nov 2007 04:05:53 +0000 (04:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@15446 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/numbers.h
deal.II/base/source/config.cc

index 89751ec45516766dde4836f766123cd52812985e..a4f5d647a3ba123f3c62db749114214c172693da 100644 (file)
@@ -169,6 +169,16 @@ namespace numbers
   template <typename number>
   struct NumberTraits
   {
+                                      /**
+                                       * A flag that specifies whether the
+                                       * template type given to this class is
+                                       * complex or real. Since the general
+                                       * template is selected for non-complex
+                                       * types, the answer is
+                                       * <code>false</code>.
+                                       */
+      static const bool is_complex = false;
+      
                                       /**
                                        * For this data type, typedef the
                                        * corresponding real type. Since the
@@ -223,6 +233,17 @@ namespace numbers
   template <typename number>
   struct NumberTraits<std::complex<number> >
   {
+                                      /**
+                                       * A flag that specifies whether the
+                                       * template type given to this class is
+                                       * complex or real. Since this
+                                       * specialization of the general
+                                       * template is selected for complex
+                                       * types, the answer is
+                                       * <code>true</code>.
+                                       */
+      static const bool is_complex = true;
+      
                                       /**
                                        * For this data type, typedef the
                                        * corresponding real type. Since this
index 890eca248ed721bc04251f081c529c5210db2022..9628f7f42d3d13d3b7eb10a679b5a3ad6859bce8 100644 (file)
@@ -66,6 +66,22 @@ namespace numbers
              && 
              is_finite (x.imag()) );
   }
+
+
+  template <typename number>
+  const bool NumberTraits<number>::is_complex;
+
+  template <typename number>
+  const bool NumberTraits<std::complex<number> >::is_complex;
+
+// explicit instantiations
+  template struct NumberTraits<double>;
+  template struct NumberTraits<float>;
+  template struct NumberTraits<long double>;
+    
+  template struct NumberTraits<std::complex<double> >;
+  template struct NumberTraits<std::complex<float> >;
+  template struct NumberTraits<std::complex<long double> >;
 }
 
 DEAL_II_NAMESPACE_CLOSE

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.