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-2019 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 protected:
60 
61  const scalarField& samples_;
62 
63 public:
64 
65  //- Runtime type information
66  TypeName("interpolationWeights");
67 
68 
69  // Declare run-time constructor selection table
70 
72  (
73  autoPtr,
75  word,
76  (
77  const scalarField& samples
78  ),
79  (samples)
80  );
81 
82 
83  // Constructors
84 
85  //- Construct from components
86  interpolationWeights(const scalarField& samples);
87 
88  //- Disallow default bitwise copy construction
90 
91 
92  // Selectors
93 
94  //- Return a reference to the selected interpolationWeights
96  (
97  const word& type,
98  const scalarField& samples
99  );
100 
101 
102  //- Destructor
103  virtual ~interpolationWeights();
104 
105 
106  // Member Functions
107 
108  //- Calculate weights and indices to calculate t from samples.
109  // Returns true if indices changed.
110  virtual bool valueWeights
111  (
112  const scalar t,
113  labelList& indices,
114  scalarField& weights
115  ) const = 0;
116 
117  //- Calculate weights and indices to calculate integrand of t1..t2
118  // from samples. Returns true if indices changed.
119  virtual bool integrationWeights
120  (
121  const scalar t1,
122  const scalar t2,
123  labelList& indices,
124  scalarField& weights
125  ) const = 0;
126 
127  //- Helper: weighted sum
128  template<class ListType1, class ListType2>
129  static typename outerProduct
130  <
131  typename ListType1::value_type,
132  typename ListType2::value_type
133  >::type
134  weightedSum(const ListType1& f1, const ListType2& f2);
135 
136 
137  // Member Operators
138 
139  //- Disallow default bitwise assignment
140  void operator=(const interpolationWeights&) = delete;
141 };
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #ifdef NoRepository
151 #endif
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
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.
interpolationWeights(const scalarField &samples)
Construct from components.
virtual ~interpolationWeights()
Destructor.
TypeName("interpolationWeights")
Runtime type information.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
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.
void operator=(const interpolationWeights &)=delete
Disallow default bitwise assignment.
Namespace for OpenFOAM.