]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add outer_product function.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 1 Jun 2005 00:21:08 +0000 (00:21 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 1 Jun 2005 00:21:08 +0000 (00:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@10798 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 4a1f3eb20a0b6874649d8dc3c9e75500017e4565..d2dc48d252c2f1912daa45781e7705b73f5bb7b2 100644 (file)
@@ -2125,6 +2125,34 @@ identity_tensor ()
 
 
 
+/**
+ * Return the tensor of rank 4 that is the outer product of the two tensors
+ * given as arguments, i.e. the result <tt>T=t1 \otimes t2</tt> satisfies
+ * <tt>T phi = t1 (t2 : phi)</tt> for all symmetric tensors <tt>phi</tt>.
+ * 
+ * @relates SymmetricTensor
+ * @author Wolfgang Bangerth, 2005
+ */
+template <int dim>
+inline
+SymmetricTensor<4,dim>
+outer_product (const SymmetricTensor<2,dim> &t1,
+               const SymmetricTensor<2,dim> &t2) 
+{
+  SymmetricTensor<4,dim> tmp;
+
+                                   // fill only the elements really needed
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      for (unsigned int k=0; k<dim; ++k)
+        for (unsigned int l=k; l<dim; ++l)
+          tmp[i][j][k][l] = t1[i][j] * t2[k][l];
+
+  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.