Scale.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) 2017-2018 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::Function1Types::Scale
26 
27 Description
28  Function1 which scales a given 'value' function by a scalar 'scale'
29  function.
30 
31  This is particularly useful to ramp a time-varying value by one of the
32  monotonic ramp functions.
33 
34  Usage for a vector:
35  \verbatim
36  <entryName>
37  {
38  type scale;
39 
40  scale
41  {
42  type linearRamp;
43 
44  start 0;
45  duration 10;
46  }
47 
48  value
49  {
50  type sine;
51 
52  frequency 10;
53  amplitude 1;
54  scale (1 0.1 0);
55  level (10 1 0);
56  }
57  }
58  \endverbatim
59 
60  Where:
61  \table
62  Property | Description | Required
63  value | Function of type Function1<Type> | yes
64  scale | Scaling function of type Function1<scalar> | yes
65  \endtable
66 
67 SourceFiles
68  Scale.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef Scale_H
73 #define Scale_H
74 
75 #include "Function1.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 namespace Function1Types
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class Scale Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 template<class Type>
89 class Scale
90 :
91  public Function1<Type>
92 {
93  // Private data
94 
95  //- Scalar scaling function
96  autoPtr<Function1<scalar>> scale_;
97 
98  //- Value function
99  autoPtr<Function1<Type>> value_;
101 
102  // Private Member Functions
103 
104  //- Read the coefficients from the given dictionary
105  void read(const dictionary& coeffs);
106 
107  //- Disallow default bitwise assignment
108  void operator=(const Scale<Type>&);
109 
110 
111 public:
112 
113  // Runtime type information
114  TypeName("scale");
115 
116 
117  // Constructors
118 
119  //- Construct from entry name and dictionary
120  Scale
121  (
122  const word& entryName,
123  const dictionary& dict
124  );
125 
126  //- Copy constructor
127  Scale(const Scale<Type>& se);
128 
129 
130  //- Destructor
131  virtual ~Scale();
132 
133 
134  // Member Functions
135 
136  //- Return value for time t
137  virtual inline Type value(const scalar t) const;
138 
139  //- Write in dictionary format
140  virtual void writeData(Ostream& os) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Function1Types
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #include "ScaleI.H"
152 
153 #ifdef NoRepository
154  #include "Scale.C"
155 #endif
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
const word const dictionary & dict
Definition: Function1.H:90
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const word & entryName
Definition: Function1.H:90
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: Scale.C:70
virtual Type value(const scalar t) const
Return value for time t.
Definition: ScaleI.H:31
A class for handling words, derived from string.
Definition: word.H:59
virtual ~Scale()
Destructor.
Definition: Scale.C:63
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Scale(const word &entryName, const dictionary &dict)
Construct from entry name and dictionary.
Definition: Scale.C:40
Function1 which scales a given &#39;value&#39; function by a scalar &#39;scale&#39; function.
Definition: Scale.H:100
Namespace for OpenFOAM.