interpolationWeightsTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "interpolationWeights.H"
30 #include "products.H"
31 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
34 template<class ListType1, class ListType2>
35 typename Foam::outerProduct
36 <
37  typename ListType1::value_type,
38  typename ListType2::value_type
39 >::type
41 (
42  const ListType1& f1,
43  const ListType2& f2
44 )
45 {
46  typedef typename outerProduct
47  <
48  typename ListType1::value_type,
49  typename ListType2::value_type
50  >::type returnType;
51 
52  const label len = f1.size();
53  if (len)
54  {
55  returnType SumProd = f1[0]*f2[0];
56  for (label i = 1; i < len; ++i)
57  {
58  SumProd += f1[i]*f2[i];
59  }
60  return SumProd;
61  }
62 
63  return Zero;
64 }
65 
66 
67 // ************************************************************************* //
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::interpolationWeights::weightedSum
static outerProduct< typename ListType1::value_type, typename ListType2::value_type >::type weightedSum(const ListType1 &f1, const ListType2 &f2)
Helper: weighted sum.
interpolationWeights.H
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
products.H
Traits classes for inner and outer products of primitives.
Foam::outerProduct
Definition: products.H:106