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-2020 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 protected:
59 
60  // Protected Member Data
61 
62  //- Cached samples
63  const scalarField& samples_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("interpolationWeights");
70 
71 
72  // Declare run-time constructor selection table
73 
75  (
76  autoPtr,
78  word,
79  (
80  const scalarField& samples
81  ),
82  (samples)
83  );
84 
85 
86  // Constructors
87 
88  //- Construct from components
90 
91  //- Disallow default bitwise copy construction
93 
94 
95  // Selectors
96 
97  //- Return a reference to the selected interpolationWeights
99  (
100  const word& type,
101  const scalarField& samples
102  );
103 
104 
105  //- Destructor
106  virtual ~interpolationWeights();
107 
108 
109  // Member Functions
110 
111  //- Calculate weights and indices to calculate t from samples.
112  // Returns true if indices changed.
113  virtual bool valueWeights
114  (
115  const scalar t,
116  labelList& indices,
117  scalarField& weights
118  ) const = 0;
119 
120  //- Calculate weights and indices to calculate integrand of t1..t2
121  // from samples. Returns true if indices changed.
122  virtual bool integrationWeights
123  (
124  const scalar t1,
125  const scalar t2,
126  labelList& indices,
127  scalarField& weights
128  ) const = 0;
129 
130  //- Weighted sum helper method
131  template<class ListType1, class ListType2>
132  static typename outerProduct
133  <
134  typename ListType1::value_type,
135  typename ListType2::value_type
137  weightedSum(const ListType1& f1, const ListType2& f2);
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const interpolationWeights&) = delete;
144 };
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #ifdef NoRepository
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base class for interpolating in 1D.
declareRunTimeSelectionTable(autoPtr, interpolationWeights, word,(const scalarField &samples),(samples))
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.
TypeName("interpolationWeights")
Runtime type information.
static outerProduct< typename ListType1::value_type, typename ListType2::value_type >::type weightedSum(const ListType1 &f1, const ListType2 &f2)
Weighted sum helper method.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate t from samples.
void operator=(const interpolationWeights &)=delete
Disallow default bitwise assignment.
virtual ~interpolationWeights()
Destructor.
static autoPtr< interpolationWeights > New(const word &type, const scalarField &samples)
Return a reference to the selected interpolationWeights.
interpolationWeights(const scalarField &samples)
Construct from components.
const scalarField & samples_
Cached samples.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Macros to ease declaration of run-time selection tables.
scalarField samples(nIntervals, 0)