interpolationWeights.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::interpolationWeights
26 
27 Description
28  Abstract base class for interpolating in 1D
29 
30 SourceFiles
31  interpolationWeights.C
32  interpolationWeightsTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef interpolationWeights_H
37 #define interpolationWeights_H
38 
39 #include "scalarField.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "pointField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class fvMesh;
50 class objectRegistry;
51 
52 /*---------------------------------------------------------------------------*\
53  Class interpolationWeights Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58 
59 private:
60 
61  // Private Member Functions
62 
63  //- Disallow default bitwise copy construct
65 
66  //- Disallow default bitwise assignment
67  void operator=(const interpolationWeights&);
68 
69 protected:
70 
71  const scalarField& samples_;
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("interpolationWeights");
77 
78 
79  // Declare run-time constructor selection table
80 
82  (
83  autoPtr,
85  word,
86  (
87  const scalarField& samples
88  ),
89  (samples)
90  );
91 
92 
93  // Constructors
94 
95  //- Construct from components
96  interpolationWeights(const scalarField& samples);
97 
98 
99  // Selectors
100 
101  //- Return a reference to the selected interpolationWeights
103  (
104  const word& type,
105  const scalarField& samples
106  );
107 
108 
109  //- Destructor
110  virtual ~interpolationWeights();
111 
112 
113  // Member Functions
114 
115  //- Calculate weights and indices to calculate t from samples.
116  // Returns true if indices changed.
117  virtual bool valueWeights
118  (
119  const scalar t,
120  labelList& indices,
121  scalarField& weights
122  ) const = 0;
123 
124  //- Calculate weights and indices to calculate integrand of t1..t2
125  // from samples. Returns true if indices changed.
126  virtual bool integrationWeights
127  (
128  const scalar t1,
129  const scalar t2,
130  labelList& indices,
131  scalarField& weights
132  ) const = 0;
133 
134  //- Helper: weighted sum
135  template<class ListType1, class ListType2>
136  static typename outerProduct
137  <
138  typename ListType1::value_type,
139  typename ListType2::value_type
140  >::type
141  weightedSum(const ListType1& f1, const ListType2& f2);
142 
143 };
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
static autoPtr< interpolationWeights > New(const word &type, const scalarField &samples)
Return a reference to the selected interpolationWeights.
declareRunTimeSelectionTable(autoPtr, interpolationWeights, word,(const scalarField &samples),(samples))
Abstract base class for interpolating in 1D.
scalar f1
Definition: createFields.H:28
static outerProduct< typename ListType1::value_type, typename ListType2::value_type >::type weightedSum(const ListType1 &f1, const ListType2 &f2)
Helper: weighted sum.
scalarField samples(nIntervals, 0)
A class for handling words, derived from string.
Definition: word.H:59
virtual bool integrationWeights(const scalar t1, const scalar t2, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate integrand of t1..t2.
virtual ~interpolationWeights()
Destructor.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
TypeName("interpolationWeights")
Runtime type information.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate t from samples.
Namespace for OpenFOAM.