From 7f19415ab1c8dfe1be0e69fade22e2a13b5b635e Mon Sep 17 00:00:00 2001 From: Lukas Korous Date: Tue, 15 Sep 2015 17:28:25 +0200 Subject: [PATCH] Fix for MSVC: Tensor<1, dim, Number>::real_type -> numbers::NumberTraits::real_type - if left as is, MSVC 2013 Pro issues (although it should not) an error 'incompatible declaration <-> definition'. --- include/deal.II/base/point.h | 8 ++++---- include/deal.II/base/tensor.h | 21 ++++++--------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/include/deal.II/base/point.h b/include/deal.II/base/point.h index 177011c85a..eb12b13754 100644 --- a/include/deal.II/base/point.h +++ b/include/deal.II/base/point.h @@ -218,14 +218,14 @@ public: * Tensor::norm_square() which returns the square of the * Frobenius norm. */ - typename Tensor<1, dim, Number>::real_type square () const; + typename numbers::NumberTraits::real_type square () const; /** * Return the Euclidean distance of this point to the point * p, i.e. the l_2 norm of the difference between the * vectors representing the two points. */ - typename Tensor<1, dim, Number>::real_type distance (const Point &p) const; + typename numbers::NumberTraits::real_type distance (const Point &p) const; /** * @} @@ -428,7 +428,7 @@ Point::operator * (const Tensor<1,dim,Number> &p) const template inline -typename Tensor<1, dim, Number>::real_type +typename numbers::NumberTraits::real_type Point::square () const { return this->norm_square(); @@ -438,7 +438,7 @@ Point::square () const template inline -typename Tensor<1, dim, Number>::real_type +typename numbers::NumberTraits::real_type Point::distance (const Point &p) const { Number sum = Number(); diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 1f75f7a7da..27201bd327 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -351,16 +351,6 @@ public: static const unsigned int n_independent_components = Tensor::n_independent_components *dim; - /** - * Declare a type that holds real-valued numbers with the same precision - * as the template argument to this class. For std::complex, this - * corresponds to type number, and it is equal to Number for all other - * cases. See also the respective field in Vector. - * - * This typedef is used to represent the return type of norms. - */ - typedef typename numbers::NumberTraits::real_type real_type; - /** * Type of objects encapsulated by this container and returned by * operator[](). This is a tensor of lower rank for a general tensor, and @@ -515,13 +505,14 @@ public: * tensors, this equals the usual l2 norm of the * vector. */ - real_type norm () const; + + typename numbers::NumberTraits::real_type norm() const; /** * Return the square of the Frobenius-norm of a tensor, i.e. the sum of * the absolute squares of all entries. */ - real_type norm_square () const; + typename numbers::NumberTraits::real_type norm_square() const; /** * Fill a vector with all tensor elements. @@ -1065,7 +1056,7 @@ Tensor::operator - () const template inline -typename Tensor::real_type +typename numbers::NumberTraits::real_type Tensor::norm () const { return std::sqrt (norm_square()); @@ -1074,10 +1065,10 @@ Tensor::norm () const template inline -typename Tensor::real_type +typename numbers::NumberTraits::real_type Tensor::norm_square () const { - real_type s = real_type(); + typename numbers::NumberTraits::real_type s = typename numbers::NumberTraits::real_type(); for (unsigned int i=0; i