From: Wolfgang Bangerth Date: Tue, 29 Mar 2005 22:20:12 +0000 (+0000) Subject: Add double contraction operator* for tensors of rank 4 and 2. X-Git-Tag: v8.0.0~14239 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27f03f316b1ba0f6e92d665c1e7c4dc8afc67151;p=dealii.git Add double contraction operator* for tensors of rank 4 and 2. git-svn-id: https://svn.dealii.org/trunk@10308 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/symmetric_tensor.h b/deal.II/base/include/base/symmetric_tensor.h index 7726877858..4fc1e7c9c7 100644 --- a/deal.II/base/include/base/symmetric_tensor.h +++ b/deal.II/base/include/base/symmetric_tensor.h @@ -1651,5 +1651,155 @@ operator / (const SymmetricTensor &t, } +/** + * Double contraction between a rank-4 and a rank-2 symmetric tensor, + * resulting in a symmetric tensor of rank 2. This operation is the + * symmetric tensor analogon of a matrix-vector multiplication. + * + * @related SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +SymmetricTensor<2,1> +operator * (const SymmetricTensor<4,1> &t, + const SymmetricTensor<2,1> &s) +{ + const unsigned int dim = 1; + SymmetricTensor<2,dim> tmp; + tmp[0][0] = t[0][0][0][0] * s[0][0]; + return tmp; +} + + + +/** + * Double contraction between a rank-4 and a rank-2 symmetric tensor, + * resulting in a symmetric tensor of rank 2. This operation is the + * symmetric tensor analogon of a matrix-vector multiplication. + * + * @related SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +SymmetricTensor<2,1> +operator * (const SymmetricTensor<2,1> &s, + const SymmetricTensor<4,1> &t) +{ + const unsigned int dim = 1; + SymmetricTensor<2,dim> tmp; + tmp[0][0] = t[0][0][0][0] * s[0][0]; + return tmp; +} + + + +/** + * Double contraction between a rank-4 and a rank-2 symmetric tensor, + * resulting in a symmetric tensor of rank 2. This operation is the + * symmetric tensor analogon of a matrix-vector multiplication. + * + * @related SymmetricTensor + * @author Wolfgang Bangerth, 2005 + */ +SymmetricTensor<2,2> +operator * (const SymmetricTensor<4,2> &t, + const SymmetricTensor<2,2> &s) +{ + const unsigned int dim = 2; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<2,2> &s, + const SymmetricTensor<4,2> &t) +{ + const unsigned int dim = 2; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<4,3> &t, + const SymmetricTensor<2,3> &s) +{ + const unsigned int dim = 3; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<2,3> &s, + const SymmetricTensor<4,3> &t) +{ + const unsigned int dim = 3; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i