From: Denis Davydov Date: Wed, 4 Feb 2015 14:20:03 +0000 (+0100) Subject: allow contraction of tensors of different base type X-Git-Tag: v8.3.0-rc1~391^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F631%2Fhead;p=dealii.git allow contraction of tensors of different base type --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index cabc4643fe..c0a24c9099 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -761,12 +761,13 @@ std::ostream &operator << (std::ostream &out, const Tensor &p) * @relates Tensor * @author Guido Kanschat, 2000 */ -template +template inline -Number contract (const Tensor<1,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) +typename ProductType::type +contract (const Tensor<1,dim,Number> &src1, + const Tensor<1,dim,OtherNumber> &src2) { - Number res = 0.; + typename ProductType::type res = typename ProductType::type(); for (unsigned int i=0; i &src1, * @relates Tensor * @author Wolfgang Bangerth, 2005 */ -template +template inline -Number +typename ProductType::type operator * (const Tensor<1,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<1,dim,OtherNumber> &src2) { return contract(src1, src2); }