Scale2.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) 2020-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::Scale
26 
27 Description
28  Function2 which scales a given 'value' function by a 'scale' scalar function
29  and scales the 'x' and 'y' arguments of the 'value' and 'scale' functions
30  by the optional 'xScale' and 'yScale' scalar functions.
31 
32 See also
33  Foam::Function2s::ramp
34  Foam::Function2s::reverseRamp
35 
36 SourceFiles
37  Scale.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Scale2_H
42 #define Scale2_H
43 
44 #include "Function2.H"
45 #include "Function1.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace Function2s
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class Scale Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Type>
59 class Scale
60 :
61  public FieldFunction2<Type, Scale<Type>>
62 {
63  // Private Data
64 
65  //- Scalar scaling function
66  const autoPtr<Function2<scalar>> scale_;
67 
68  //- Argument scaling function
69  const autoPtr<Function1<scalar>> xScale_;
70 
71  //- Argument scaling function
72  const autoPtr<Function1<scalar>> yScale_;
73 
74  //- Value function
75  const autoPtr<Function2<Type>> value_;
76 
77 
78 public:
79 
80  // Runtime type information
81  TypeName("scale");
82 
83 
84  // Constructors
85 
86  //- Construct from name and dictionary
87  Scale
88  (
89  const word& name,
90  const unitConversions& units,
91  const dictionary& dict
92  );
93 
94  //- Copy constructor
95  Scale(const Scale<Type>& se);
96 
97 
98  //- Destructor
99  virtual ~Scale();
100 
101 
102  // Member Functions
103 
104  //- Return value
105  virtual inline Type value(const scalar x, const scalar y) const;
106 
107  //- Write data to dictionary stream
108  virtual void write(Ostream& os, const unitConversions& units) const;
109 
110 
111  // Member Operators
112 
113  //- Disallow default bitwise assignment
114  void operator=(const Scale<Type>&) = delete;
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Function2s
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #include "Scale2I.H"
126 
127 #ifdef NoRepository
128  #include "Scale2.C"
129 #endif
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
scalar y
const word & name() const
Return the name of the entry.
Definition: Function2.C:78
Function2 which scales a given 'value' function by a 'scale' scalar function and scales the 'x' and '...
Definition: Scale2.H:61
Scale(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
Definition: Scale2.C:32
virtual void write(Ostream &os, const unitConversions &units) const
Write data to dictionary stream.
Definition: Scale2.C:84
void operator=(const Scale< Type > &)=delete
Disallow default bitwise assignment.
virtual Type value(const scalar x, const scalar y) const
Return value.
Definition: Scale2I.H:32
virtual ~Scale()
Destructor.
Definition: Scale2.C:76
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