From: Matthias Maier Date: Tue, 15 Sep 2015 03:02:50 +0000 (-0500) Subject: tensor.h: Deprecate rank 1 variants of determinant X-Git-Tag: v8.4.0-rc2~413^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=820364325e105b2558d5983eacccdb052f3e0687;p=dealii.git tensor.h: Deprecate rank 1 variants of determinant We do not implemenent a hyper determinant, or any other generalization of a determinant. Thus, deprecate this special case. --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 71ee4d13dc..33f52683c7 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -2048,36 +2048,6 @@ scalar_product (const Tensor<2,dim,Number> &t1, } -/** - * Compute the determinant of a tensor of arbitrary rank and dimension one. - * Since this is a number, the return value is, of course, the number itself. - * - * @relates Tensor - * @author Wolfgang Bangerth, 1998 - */ -template -inline -Number determinant (const Tensor &t) -{ - return determinant(t[0]); -} - - -/** - * Compute the determinant of a tensor of rank one and dimension one. Since - * this is a number, the return value is, of course, the number itself. - * - * @relates Tensor - * @author Wolfgang Bangerth, 1998 - */ -template -inline -Number determinant (const Tensor<1,1,Number> &t) -{ - return t[0]; -} - - //@} /** * @name Special operations on tensors of rank 1 @@ -2140,19 +2110,11 @@ cross_product (const Tensor<1,dim,Number> &src1, } +//@} /** - * Compute the determinant of a tensor of rank two and dimension one. Since - * this is a number, the return value is, of course, the number itself. - * - * @relates Tensor - * @author Wolfgang Bangerth, 1998 + * @name Special operations on tensors of rank 2 */ -template -inline -Number determinant (const Tensor<2,1,Number> &t) -{ - return t[0][0]; -} +//@{ /** @@ -2197,8 +2159,7 @@ Number determinant (const Tensor<2,3,Number> &t) /** - * Compute the determinant of a tensor or rank 2, here for all dimensions for - * which no explicit specialization is available above. + * Compute the determinant of a tensor or rank 2. * * @relates Tensor * @author Wolfgang Bangerth, 2009 @@ -2207,14 +2168,8 @@ template inline Number determinant (const Tensor<2,dim,Number> &t) { - // compute the determinant using the - // Laplace expansion of the - // determinant. this may not be the most - // efficient algorithm, but it does for - // small n. - // - // for some algorithmic simplicity, we use - // the expansion along the last row + // Compute the determinant using the Laplace expansion of the + // determinant. We expand along the last row. Number det = 0; for (unsigned int k=0; k &t) return std::pow (-1., static_cast(dim)) * det; } +#ifndef DOXYGEN +// Ground above recursion +template +inline +Number determinant (const Tensor<2,1,Number> &t) +{ + return t[0][0]; +} +#endif + + /** * Compute and return the trace of a tensor of rank 2, i.e. the sum of its @@ -2465,3 +2431,4 @@ DEAL_II_NAMESPACE_CLOSE #include #endif + diff --git a/include/deal.II/base/tensor_deprecated.h b/include/deal.II/base/tensor_deprecated.h index b6dfeb343a..f8eab6f503 100644 --- a/include/deal.II/base/tensor_deprecated.h +++ b/include/deal.II/base/tensor_deprecated.h @@ -23,7 +23,6 @@ DEAL_II_NAMESPACE_OPEN -//@} /** * @name Deprecated Tensor operations */ @@ -75,8 +74,26 @@ void outer_product (Tensor<1,dim,Number> &dst, const Tensor<1,dim,Number> src1, const Number src2) DEAL_II_DEPRECATED; +/** + * @deprecated Do not use this function, evaluate the value manually. + * @relates Tensor + */ +template +inline +Number determinant (const Tensor &t) DEAL_II_DEPRECATED; + + +/** + * @deprecated Do not use this function, evaluate the value manually. + * @relates Tensor + */ +template +inline +Number determinant (const Tensor<1,1,Number> &t) DEAL_II_DEPRECATED; + //@} + #ifndef DOXYGEN template @@ -115,6 +132,20 @@ void outer_product (Tensor<1,dim,Number> &dst, dst[i] = src1[i] * src2; } +template +inline +Number determinant (const Tensor &t) +{ + return determinant(t[0]); +} + +template +inline +Number determinant (const Tensor<1,1,Number> &t) +{ + return t[0]; +} + #endif /* DOXYGEN */ DEAL_II_NAMESPACE_CLOSE