Shift.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::Function1s::Shift
26 
27 Description
28  Function1 which shifts a given 'value' function along the x-axis
29 
30 Usage
31  Example:
32  \verbatim
33  <name>
34  {
35  type shift;
36 
37  start 10 [CAD];
38 
39  value
40  {
41  type table;
42  file "constant/timeVsFlowRate.foam";
43  units ([ms] [m^3/s]);
44  }
45  }
46  \endverbatim
47 
48  Where:
49  \vartable
50  Symbol | Description | Data type | Default
51  start | Start x coordinate | scalar |
52  value | Function to shift | Function1<Type> |
53  \endvartable
54 
55 SourceFiles
56  Shift.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef Shift_H
61 #define Shift_H
62 
63 #include "Function1.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace Function1s
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class Shift Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type>
77 class Shift
78 :
79  public FieldFunction1<Type, Shift<Type>>
80 {
81  // Private Data
82 
83  //- Argument offset
84  const scalar start_;
85 
86  //- Value function
87  const autoPtr<Function1<Type>> value_;
88 
89 
90 public:
91 
92  // Runtime type information
93  TypeName("shift");
94 
95 
96  // Constructors
97 
98  //- Construct from name and dictionary
99  Shift
100  (
101  const word& name,
102  const unitConversions& units,
103  const dictionary& dict
104  );
105 
106  //- Copy constructor
107  Shift(const Shift<Type>& se);
108 
109 
110  //- Destructor
111  virtual ~Shift();
112 
113 
114  // Member Functions
115 
116  //- Return value
117  virtual inline Type value(const scalar x) const;
118 
119  //- Integrate between two values
120  virtual inline Type integral(const scalar x1, const scalar x2) const;
121 
122  //- Write data to dictionary stream
123  virtual void write(Ostream& os, const unitConversions& units) const;
124 
125 
126  // Member Operators
127 
128  //- Disallow default bitwise assignment
129  void operator=(const Shift<Type>&) = delete;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Function1s
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #include "ShiftI.H"
141 
142 #ifdef NoRepository
143  #include "Shift.C"
144 #endif
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
const word & name() const
Return the name of the entry.
Definition: Function1.C:78
Function1 which shifts a given 'value' function along the x-axis.
Definition: Shift.H:97
Shift(const word &name, const unitConversions &units, const dictionary &dict)
Construct from name and dictionary.
Definition: Shift.C:32
virtual ~Shift()
Destructor.
Definition: Shift.C:56
virtual Type integral(const scalar x1, const scalar x2) const
Integrate between two values.
Definition: ShiftI.H:39
virtual void write(Ostream &os, const unitConversions &units) const
Write data to dictionary stream.
Definition: Shift.C:64
void operator=(const Shift< Type > &)=delete
Disallow default bitwise assignment.
virtual Type value(const scalar x) const
Return value.
Definition: ShiftI.H:31
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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