implicitFunction.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) 2019 OpenCFD Ltd.
9  Copyright (C) 2019-2020 DLR
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  Foam::implicitFunction
29 
30 Description
31  Base class for implicit functions
32 
33  Original code supplied by Henning Scheufler, DLR (2019)
34 
35 SourceFiles
36  implicitFunction.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef implicitFunction_H
41 #define implicitFunction_H
42 
43 #include "autoPtr.H"
44 #include "dictionary.H"
45 #include "vector.H"
46 #include "runTimeSelectionTables.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class implicitFunction Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class implicitFunction
58 {
59 public:
60 
61  //- Runtime type information
62  TypeName("implicitFunction");
63 
64  //- Declare run-time constructor selection table
66  (
67  autoPtr,
69  dict,
70  (
71  const dictionary& dict
72  ),
73  (dict)
74  );
75 
76 
77  // Constructors
78 
79  //- Default construct
80  implicitFunction() = default;
81 
82 
83  //- Return a reference to the selected implicitFunction
85  (
86  const word& implicitFunctionType,
87  const dictionary& dict
88  );
89 
90 
91  //- Destructor
92  virtual ~implicitFunction() = default;
93 
94 
95  // Member Functions
96 
97  virtual scalar value(const vector& p) const
98  {
99  return GREAT;
100  }
101 
102  virtual vector grad(const vector& p) const
103  {
104  return vector::max;
105  }
106 
107  virtual scalar distanceToSurfaces(const vector& p) const
108  {
109  return GREAT;
110  }
111 };
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
implicitFunction()=default
Default construct.
declareRunTimeSelectionTable(autoPtr, implicitFunction, dict,(const dictionary &dict),(dict))
Declare run-time constructor selection table.
virtual scalar value(const vector &p) const
virtual scalar distanceToSurfaces(const vector &p) const
virtual ~implicitFunction()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("implicitFunction")
Runtime type information.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual vector grad(const vector &p) const
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
volScalarField & p
Base class for implicit functions.
static autoPtr< implicitFunction > New(const word &implicitFunctionType, const dictionary &dict)
Return a reference to the selected implicitFunction.
Namespace for OpenFOAM.