From: wolf Date: Thu, 2 Jun 2005 15:26:46 +0000 (+0000) Subject: Implement contraction between rank-4 tensors. Minor clean-ups. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6eb3e5b42e55d93f08eb4f2978ceec2c829cdd91;p=dealii-svn.git Implement contraction between rank-4 tensors. Minor clean-ups. git-svn-id: https://svn.dealii.org/trunk@10819 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 1c6c68b317..bd5cf25cf2 100644 --- a/deal.II/base/include/base/symmetric_tensor.h +++ b/deal.II/base/include/base/symmetric_tensor.h @@ -857,10 +857,25 @@ class SymmetricTensor private: + /** + * A structure that describes + * properties of the base tensor. + */ + typedef + internal::SymmetricTensorAccessors::StorageType + base_tensor_descriptor; + /** - * Data storage for a symmetric tensor. + * Data storage type for a + * symmetric tensor. */ - typename internal::SymmetricTensorAccessors::StorageType::base_tensor_type data; + typedef typename base_tensor_descriptor::base_tensor_type base_tensor_type; + + /** + * The place where we store the + * data of the tensor. + */ + base_tensor_type data; /** * Make all other symmetric tensors friends. @@ -1300,6 +1315,60 @@ operator * (const SymmetricTensor<4,3> &s) const + +template <> +inline +internal::SymmetricTensorAccessors::double_contraction_result<4,4,1>::type +SymmetricTensor<4,1>:: +operator * (const SymmetricTensor<4,1> &s) const +{ + const unsigned int dim = 1; + SymmetricTensor<4,dim> tmp; + tmp.data[0][0] = data[0][0] * s.data[0][0]; + return tmp; +} + + + +template <> +inline +internal::SymmetricTensorAccessors::double_contraction_result<4,4,2>::type +SymmetricTensor<4,2>:: +operator * (const SymmetricTensor<4,2> &s) const +{ + const unsigned int dim = 2; + SymmetricTensor<4,dim> tmp; + for (unsigned int i=0; i +inline +internal::SymmetricTensorAccessors::double_contraction_result<4,4,3>::type +SymmetricTensor<4,3>:: +operator * (const SymmetricTensor<4,3> &s) const +{ + const unsigned int dim = 3; + SymmetricTensor<4,dim> tmp; + for (unsigned int i=0; i inline double & @@ -2079,8 +2148,7 @@ deviator_tensor () // off-diagonal elements twice, so simply // copying requires a weight of 1/2 for (unsigned int i=dim; - i - ::n_rank2_components; + i::base_tensor_descriptor::n_rank2_components; ++i) tmp.data[i][i] = 0.5; @@ -2120,8 +2188,7 @@ identity_tensor () // off-diagonal elements twice, so simply // copying requires a weight of 1/2 for (unsigned int i=dim; - i - ::n_rank2_components; + i::base_tensor_descriptor::n_rank2_components; ++i) tmp.data[i][i] = 0.5;