TimeFunction1.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::TimeFunction1
29
30Description
31 Light wrapper around Function1 to provide a mechanism to update time-based
32 entries.
33
34SourceFiles
35 TimeFunction1.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef TimeFunction1_H
40#define TimeFunction1_H
41
42#include "Function1.H"
43#include "Time.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50// Forward Declarations
51template<class Type> class TimeFunction1;
52
53template<class Type>
55
56/*---------------------------------------------------------------------------*\
57 Class TimeFunction1 Declaration
58\*---------------------------------------------------------------------------*/
59
60template<class Type>
61class TimeFunction1
62{
63protected:
64
65 // Protected Data
66
67 //- Reference to the time database
68 const Time& time_;
69
70 //- Name of the data entry
71 const word name_;
72
73 //- The underlying Function1
75
76
77public:
78
79 // Constructor
80
81 //- Construct from entry name and dictionary
83 (
84 const Time& runTime,
85 const word& name,
86 const dictionary& dict
87 );
88
89 //- Construct from entry name
91 (
92 const Time& runTime,
93 const word& entryName
94 );
95
96 //- Copy construct
98
99
100 //- Destructor
101 virtual ~TimeFunction1() = default;
102
103
104 // Member Functions
105
106 // Access
107
108 //- Reset entry by re-reading from dictionary
109 void reset(const dictionary& dict);
110
111 //- Return the name of the entry
112 const word& name() const;
113
114
115 // Evaluation
116
117 //- Return value as a function of (scalar) independent variable
118 virtual Type value(const scalar x) const;
119
120 //- Integrate between two (scalar) values
121 virtual Type integrate(const scalar x1, const scalar x2) const;
122
123
124
125 // I/O
126
127 //- Ostream Operator
128 friend Ostream& operator<< <Type>
129 (
130 Ostream& os,
131 const TimeFunction1<Type>& de
132 );
133
134 //- Write in dictionary format
135 virtual void writeData(Ostream& os) const;
136};
137
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141} // End namespace Foam
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145#ifdef NoRepository
146 #include "TimeFunction1.C"
147#endif
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151#endif
152
153// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Light wrapper around Function1 to provide a mechanism to update time-based entries.
Definition: TimeFunction1.H:61
void reset(const dictionary &dict)
Reset entry by re-reading from dictionary.
Definition: TimeFunction1.C:83
const Time & time_
Reference to the time database.
Definition: TimeFunction1.H:67
virtual void writeData(Ostream &os) const
Write in dictionary format.
virtual ~TimeFunction1()=default
Destructor.
autoPtr< Function1< Type > > entry_
The underlying Function1.
Definition: TimeFunction1.H:73
virtual Type value(const scalar x) const
Return value as a function of (scalar) independent variable.
Definition: TimeFunction1.C:98
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
const word & name() const
Return the name of the entry.
Definition: TimeFunction1.C:91
const word name_
Name of the data entry.
Definition: TimeFunction1.H:70
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
dictionary dict