All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Function12.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) 2024 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::Function2s::Function12
26 
27 Description
28  Function2 which returns a Function1 using just one of the arguments given
29  to the function2. The function1 is specified as value1 or value2, depending
30  on which argument it is to be evaluated with.
31 
32  Example for a scalar:
33  \verbatim
34  <name>
35  {
36  type function1;
37  value1 constant 10; // <-- The value1 function is evaluated with
38  // the first argument
39  }
40  \endverbatim
41 
42  Example for a vector:
43  \verbatim
44  <name>
45  {
46  type function1;
47  value2 table // <-- The value2 function is evaluated with
48  ( // the second argument
49  (0.00 (0 0 0))
50  (0.35 (0 0 1))
51  (0.71 (0 0 0))
52  );
53  }
54  \endverbatim
55 
56 SourceFiles
57  Function12.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef Function12_H
62 #define Function12_H
63 
64 #include "Function1.H"
65 #include "Function2.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace Function2s
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class Function12 Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 template<class Type>
79 class Function12
80 :
81  public FieldFunction2<Type, Function12<Type>>
82 {
83  // Private Data
84 
85  //- The index of the argument to use. 0 or 1, hence a bool.
86  bool index_;
87 
88  //- Function
90 
91 
92 public:
93 
94  // Runtime type information
95  TypeName("function1");
96 
97 
98  // Constructors
99 
100  //- Construct from name and dictionary
101  Function12
102  (
103  const word& name,
104  const unitConversions& units,
105  const dictionary& dict
106  );
107 
108  //- Copy constructor
109  Function12(const Function12<Type>& se);
110 
111 
112  //- Destructor
113  virtual ~Function12();
114 
115 
116  // Member Functions
117 
118  //- Return value
119  virtual inline Type value(const scalar x, const scalar y) const;
120 
121  //- Write data to dictionary stream
122  virtual void write(Ostream& os, const unitConversions& units) const;
123 
124 
125  // Member Operators
126 
127  //- Disallow default bitwise assignment
128  void operator=(const Function12<Type>&) = delete;
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Function2s
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #include "Function12I.H"
140 
141 #ifdef NoRepository
142  #include "Function12.C"
143 #endif
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
scalar y
const word & name() const
Return the name of the entry.
Definition: Function2.C:78
Function2 which returns a Function1 using just one of the arguments given to the function2....
Definition: Function12.H:81
Function12(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
Definition: Function12.C:32
void operator=(const Function12< Type > &)=delete
Disallow default bitwise assignment.
virtual ~Function12()
Destructor.
Definition: Function12.C:85
virtual void write(Ostream &os, const unitConversions &units) const
Write data to dictionary stream.
Definition: Function12.C:93
virtual Type value(const scalar x, const scalar y) const
Return value.
Definition: Function12I.H:33
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
const HashTable< unitConversion > & units()
Get the table of unit conversions.
dictionary dict