From 28d527195a157f17d31ab220509eb69cded07124 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 12 Apr 2011 20:27:37 +0000 Subject: [PATCH] New operator* between SymmetricTensor and Tensor. git-svn-id: https://svn.dealii.org/trunk@23580 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 ++++- deal.II/examples/step-46/step-46.cc | 4 +-- .../include/deal.II/base/symmetric_tensor.h | 29 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index c8af879b66..76bef4543a 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -85,12 +85,17 @@ should be fixed now.

Specific improvements

    +
  1. New: There is now an operator* for the multiplication of a SymmetricTensor@<2,dim@> +and a Tensor@<1,dim@>. +
    +(Wolfgang Bangerth, 2011/04/12) +
  2. Fixed: Added some instantiations to make KellyErrorEstimator and SolutionTransfer work in codimension one. Fixed some dim in spacedim.
    (Luca Heltai, 2011/04/11) -
  3. Fixed: Added some instantiations to make anisotropic refinement work +
  4. Fixed: Added some instantiations to make anisotropic refinement work in codimension one.
    (Luca Heltai, 2011/03/31) diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index 024fe21337..0915fbbb28 100644 --- a/deal.II/examples/step-46/step-46.cc +++ b/deal.II/examples/step-46/step-46.cc @@ -480,8 +480,8 @@ void FluidStructureProblem::assemble_system () for (unsigned int i=0; i &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 contract function, but returns the result as + * a return value, rather than writing it into the reference given as + * the first argument to the contract function. + * + * Note that for the Tensor 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 +Tensor<1,dim> +operator * (const SymmetricTensor<2,dim> &src1, + const Tensor<1,dim> &src2) +{ + Tensor<1,dim> dest; + for (unsigned int i=0; i