]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New operator* between SymmetricTensor and Tensor.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Apr 2011 20:27:37 +0000 (20:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Apr 2011 20:27:37 +0000 (20:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@23580 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/examples/step-46/step-46.cc
deal.II/include/deal.II/base/symmetric_tensor.h

index c8af879b66d2ff3b67ca80579b96b56567c61356..76bef4543aed698fdb31f13379e1ffeedc606b7b 100644 (file)
@@ -85,12 +85,17 @@ should be fixed now.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> New: There is now an operator* for the multiplication of a <code>SymmetricTensor@<2,dim@></code>
+and a <code>Tensor@<1,dim@></code>.
+<br>
+(Wolfgang Bangerth, 2011/04/12)
+
 <li> Fixed: Added some instantiations to make KellyErrorEstimator and SolutionTransfer
 work in  codimension one. Fixed some dim in spacedim.
 <br>
 (Luca Heltai, 2011/04/11)
 
-<li> Fixed: Added some instantiations to make anisotropic refinement work 
+<li> Fixed: Added some instantiations to make anisotropic refinement work
 in codimension one.
 <br>
 (Luca Heltai, 2011/03/31)
index 024fe2133725a2fd38615e5a4d83139cb35485cd..0915fbbb28f4792201fa5af0a82ec893c2cfaa49 100644 (file)
@@ -480,8 +480,8 @@ void FluidStructureProblem<dim>::assemble_system ()
                      for (unsigned int i=0; i<stokes_dofs_per_cell; ++i)
                        for (unsigned int j=0; j<elasticity_dofs_per_cell; ++j)
                          local_matrix(i,j) += (2 * viscosity *
-                                               contract(stokes_phi_grads_u[i],
-                                                        normal_vector) *
+                                               (stokes_phi_grads_u[i] *
+                                                normal_vector) *
                                                elasticity_phi[j] *
                                                stokes_fe_face_values.JxW(q));
                    }
index 87cdbc047e8ad6f0ad86cfa125958eb944f34c69..51038c2db4ff65f7ef373b3facc6a3afa65d59e3 100644 (file)
@@ -2974,6 +2974,35 @@ double_contract (SymmetricTensor<2,3> &tmp,
 
 
 
+/**
+ * Multiplication operator performing a contraction of the last index
+ * of the first argument and the first index of the second
+ * argument. This function therefore does the same as the
+ * corresponding <tt>contract</tt> function, but returns the result as
+ * a return value, rather than writing it into the reference given as
+ * the first argument to the <tt>contract</tt> function.
+ *
+ * Note that for the <tt>Tensor</tt> class, the multiplication
+ * operator only performs a contraction over a single pair of
+ * indices. This is in contrast to the multiplication operator for
+ * symmetric tensors, which does the double contraction.
+ *
+ * @relates SymmetricTensor
+ * @author Wolfgang Bangerth, 2005
+ */
+template <int dim>
+Tensor<1,dim>
+operator * (const SymmetricTensor<2,dim> &src1,
+            const Tensor<1,dim> &src2)
+{
+  Tensor<1,dim> dest;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      dest[i] += src1[i][j] * src2[j];
+  return dest;
+}
+
+
 /**
  * Output operator for symmetric tensors of rank 2. Print the elements
  * consecutively, with a space in between, two spaces between rank 1

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.