setWriteIntervalFunctionObject.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-2023 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::functionObjects::setWriteIntervalFunctionObject
26 
27 Description
28  Updates the writeInterval as a Function1 of time.
29 
30  If the case is running with userTime specified in controlDict then the write
31  interval values returned by the Function1 are assumed to be in user-time
32  rather than real-time.
33 
34  Examples of function object specification:
35  \verbatim
36  setWriteInterval
37  {
38  type setWriteInterval;
39 
40  libs ("libutilityFunctionObjects.so");
41 
42  writeInterval table
43  (
44  (0 0.005)
45  (0.1 0.005)
46  (0.1001 0.01)
47  (0.2 0.01)
48  (0.2001 0.02)
49  );
50  }
51  \endverbatim
52  will cause results to be written every 0.005s between 0 and 0.1s, every
53  0.01s between 0.1 and 0.2s and every 0.02s thereafter.
54 
55 SourceFiles
56  setWriteIntervalFunctionObject.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef functionObjects_setWriteIntervalFunctionObject_H
61 #define functionObjects_setWriteIntervalFunctionObject_H
62 
63 #include "functionObject.H"
64 #include "Function1.H"
65 #include "Time.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionObjects
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class setWriteIntervalFunctionObject Declaration
76 \*---------------------------------------------------------------------------*/
77 
79 :
80  public functionObject
81 {
82  // Private Data
83 
84  //- Time step function/table
85  autoPtr<Function1<scalar>> writeIntervalPtr_;
86 
87 
88 public:
89 
90  //- Runtime type information
91  TypeName("setWriteInterval");
92 
93 
94  // Constructors
95 
96  //- Construct from components
98  (
99  const word& name,
100  const Time& runTime,
101  const dictionary& dict
102  );
103 
104  //- Disallow default bitwise copy construction
106  (
108  ) = delete;
109 
110 
111  // Destructor
113 
114 
115  // Member Functions
116 
117  //- Read and reset the writeInterval Function1
118  virtual bool read(const dictionary&);
119 
120  //- Return the list of fields required
121  virtual wordList fields() const
122  {
123  return wordList::null();
124  }
125 
126  //- Reset the writeInterval from the Function1 of time
127  virtual bool execute();
128 
129  //- Do nothing
130  virtual bool write();
131 
132 
133  // Member Operators
134 
135  //- Disallow default bitwise assignment
136  void operator=(const setWriteIntervalFunctionObject&) = delete;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace functionObjects
143 } // End namespace Foam
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
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:160
Abstract base-class for Time/database functionObjects.
const word & name() const
Return the name of this functionObject.
Updates the writeInterval as a Function1 of time.
virtual wordList fields() const
Return the list of fields required.
void operator=(const setWriteIntervalFunctionObject &)=delete
Disallow default bitwise assignment.
setWriteIntervalFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
TypeName("setWriteInterval")
Runtime type information.
virtual bool execute()
Reset the writeInterval from the Function1 of time.
virtual bool read(const dictionary &)
Read and reset the writeInterval Function1.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict