From d839cbd639e598d634e269750870f8b437643ebf Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 20 Aug 2008 12:41:11 +0000 Subject: [PATCH] New function scalar_product. git-svn-id: https://svn.dealii.org/trunk@16605 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/tensor.h | 27 ++++++++++++++++++++++++++- deal.II/doc/news/changes.h | 11 ++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/deal.II/base/include/base/tensor.h b/deal.II/base/include/base/tensor.h index a1b8ed62c7..59c192e4b3 100644 --- a/deal.II/base/include/base/tensor.h +++ b/deal.II/base/include/base/tensor.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -1294,6 +1294,31 @@ cross_product (Tensor<1,dim> &dst, +/** + * Compute the scalar product $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two + * tensors $a,b$ of rank 2. We don't use operator* for this + * operation since the product between two tensors is usually assumed to be + * the contraction over the last index of the first tensor and the first index + * of the second tensor, for example $(a\cdot b)_{ij}=\sum_k a_{ik}b_{kj}$. + * + * @relates Tensor + * @author Wolfgang Bangerth, 2008 + */ +template +inline +double +scalar_product (const Tensor<2,dim> &t1, + const Tensor<2,dim> &t2) +{ + double s = 0; + for (unsigned int i=0; ibase
    +
  1. +

    + New: There is a new function scalar_product(const Tensor<2,dim> &, + const Tensor<2,dim> &) that computes the scalar product + $a:b=\sum_{i,j} a_{ij}b_{ij}$ between two tensors of rank 2. +
    + (WB 2008/08/15) +

    +
  2. New: If the compiler allows to do \#include @, then - the flag DEAL_II_COMPILER_SUPPORTS_MPI is now set in + the preprocessor flag DEAL_II_COMPILER_SUPPORTS_MPI is now set in base/include/base/config.h. This also fixes a problem in base/include/base/utilities.h if a compiler capable of including mpi.h was used but not PETSc. -- 2.39.5