]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix two problems that made this not compile.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 17:01:48 +0000 (17:01 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 17:01:48 +0000 (17:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@10769 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/symmetric_tensor.h

index 60fc732ed18adead6687b5bb7938e85de0f5a5b9..97fd8c4ec84bf6040e8c9b00418c9f64e6c4cab4 100644 (file)
@@ -21,6 +21,7 @@
 template <int rank, int dim> class SymmetricTensor;
 
 template <int dim> SymmetricTensor<2,dim> unit_symmetric_tensor ();
+template <int dim> SymmetricTensor<4,dim> deviator_tensor ();
 
 namespace internal
 {
@@ -878,6 +879,9 @@ class SymmetricTensor
     
     template <int dim2>
     friend SymmetricTensor<2,dim2> unit_symmetric_tensor ();
+
+    template <int dim2>
+    friend SymmetricTensor<4,dim2> deviator_tensor ();
 };
 
 
@@ -2033,6 +2037,31 @@ unit_symmetric_tensor<3> ()
 
 
 
+
+/**
+ * Return a unit symmetric tensor of rank 2 and dimension 2.
+ * 
+ * @relates SymmetricTensor
+ * @author Wolfgang Bangerth, 2005
+ */
+template <int dim>
+inline
+SymmetricTensor<4,dim>
+deviator_tensor () 
+{
+  SymmetricTensor<4,dim> tmp;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      tmp.data[i][j] = (i==j ? 1 : 0) - 1./dim;
+  for (unsigned int i=dim;
+       i<internal::SymmetricTensorAccessors::StorageType<4,dim>::n_rank2_components; ++i)
+    tmp.data[i][i] = 1;
+  
+  return tmp;
+}
+
+
+
 /**
  * Return the symmetrized version of the full rank-2 tensor,
  * i.e. (t+transpose(t))/2, as a symmetric rank-2 tensor.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.