topOInterpolationFunction.H
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) 2020-2023 PCOpt/NTUA
9  Copyright (C) 2020-2023 FOSS GP
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 Class
28  topOInterpolationFunction
29 
30 Description
31  Abstract base class for interpolation functions used in topology
32  optimisation
33 
34 SourceFiles
35  topOInterpolationFunction.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef topOInterpolationFunction_H
40 #define topOInterpolationFunction_H
41 
42 #include "fvMesh.H"
43 #include "Function1.H"
44 
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class topOInterpolationFunction Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57 
58 protected:
59 
60  // Protected data
61 
62  const fvMesh& mesh_;
63 
65 
66 
67 private:
68 
69  // Private Member Functions
70 
71  //- No copy construct
73 
74  //- No copy assignment
75  void operator=(const topOInterpolationFunction&);
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("topOInterpolationFunction");
82 
83 
84  // Declare run-time constructor selection table
85 
87  (
88  autoPtr,
90  dictionary,
91  (
92  const fvMesh& mesh,
93  const dictionary& dict
94  ),
95  (mesh, dict)
96  );
97 
98 
99  // Constructors
100 
101  //- Construct from components
103  (
104  const fvMesh& mesh,
105  const dictionary& dict
106  );
107 
108 
109  // Selectors
110 
111  //- Return an autoPtr to the selected interpolation type
113  (
114  const fvMesh& mesh,
115  const dictionary& dict
116  );
117 
118 
119  //- Destructor
120  virtual ~topOInterpolationFunction() = default;
121 
122 
123  // Member Functions
124 
125  //- Interpolate argument to result
126  virtual void interpolate
127  (
128  const scalarField& arg,
129  scalarField& res
130  ) const = 0;
131 
132  //- Return of function with respect to the argument field
133  virtual tmp<scalarField> derivative(const scalarField& arg) const = 0;
134 
135  //- Set the parameter determining length scale
136  // Warning if the selected interpolation function has no such param
137  virtual void setLengthScaleParam(const scalar lengthScale);
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
TypeName("topOInterpolationFunction")
Runtime type information.
virtual ~topOInterpolationFunction()=default
Destructor.
dynamicFvMesh & mesh
virtual tmp< scalarField > derivative(const scalarField &arg) const =0
Return of function with respect to the argument field.
virtual void setLengthScaleParam(const scalar lengthScale)
Set the parameter determining length scale.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void interpolate(const scalarField &arg, scalarField &res) const =0
Interpolate argument to result.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
declareRunTimeSelectionTable(autoPtr, topOInterpolationFunction, dictionary,(const fvMesh &mesh, const dictionary &dict),(mesh, dict))
Namespace for OpenFOAM.
static autoPtr< topOInterpolationFunction > New(const fvMesh &mesh, const dictionary &dict)
Return an autoPtr to the selected interpolation type.