reverseRamp.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) 2019-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::Function1s::reverseRamp
26 
27 Description
28  A wrapper class to reverse any ramp function such that the result starts
29  from 1 decreasing to 0 from \c start over the \c duration and remaining at 0
30  thereafter.
31 
32 Usage
33  For scaling a vector:
34  \verbatim
35  <name>
36  {
37  scale
38  {
39  type reverseRamp;
40 
41  ramp linearRamp;
42 
43  start 0;
44  duration 10;
45  }
46 
47  value
48  {
49  type sine;
50 
51  frequency 10;
52  amplitude 1;
53  scale (1 0.1 0);
54  level (10 1 0);
55  }
56  }
57  \endverbatim
58 
59 See also
60  Foam::Function1s::Ramp
61 
62 SourceFiles
63  reverseRamp.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef reverseRamp_H
68 #define reverseRamp_H
69 
70 #include "Ramp.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 namespace Function1s
77 {
78 
79 /*---------------------------------------------------------------------------*\
80  Class reverseRamp Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 class reverseRamp
84 :
85  public Ramp<reverseRamp>
86 {
87  // Private Data
88 
89  //- Standard ramp function to reverse
91 
92 
93 public:
94 
95  // Runtime type information
96  TypeName("reverseRamp");
97 
98 
99  // Constructors
100 
101  //- Construct from name and dictionary
103  (
104  const word& name,
105  const unitConversions& units,
106  const dictionary& dict
107  );
108 
109  //- Copy constructor
110  reverseRamp(const reverseRamp& rr);
111 
112 
113  //- Destructor
114  virtual ~reverseRamp();
115 
116 
117  // Member Functions
118 
119  //- Return value for time t
120  virtual inline scalar value(const scalar t) const;
121 
122  //- Return the integral between times t1 and t2
123  virtual inline scalar integral
124  (
125  const scalar t1,
126  const scalar t2
127  ) const;
128 
129  //- Write data to dictionary stream
130  virtual void write(Ostream& os, const unitConversions& units) const;
131 
132 
133  // Member Operators
134 
135  //- Disallow default bitwise assignment
136  void operator=(const reverseRamp&) = delete;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Function1s
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #include "reverseRampI.H"
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
const word & name() const
Return the name of the entry.
Definition: Function1.C:78
Ramp function base class for the set of scalar functions starting from 0 and increasing monotonically...
Definition: Ramp.H:119
A wrapper class to reverse any ramp function such that the result starts from 1 decreasing to 0 from ...
Definition: reverseRamp.H:85
virtual scalar value(const scalar t) const
Return value for time t.
Definition: reverseRampI.H:31
virtual scalar integral(const scalar t1, const scalar t2) const
Return the integral between times t1 and t2.
Definition: reverseRampI.H:40
void operator=(const reverseRamp &)=delete
Disallow default bitwise assignment.
virtual void write(Ostream &os, const unitConversions &units) const
Write data to dictionary stream.
Definition: reverseRamp.C:72
reverseRamp(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
Definition: reverseRamp.C:42
virtual ~reverseRamp()
Destructor.
Definition: reverseRamp.C:65
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