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 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  Examples of function object specification:
31  \verbatim
32  setWriteInterval
33  {
34  type setWriteInterval;
35  libs ("libutilityFunctionObjects.so");
36 
37  writeInterval table
38  (
39  (0 0.005)
40  (0.1 0.005)
41  (0.1001 0.01)
42  (0.2 0.01)
43  (0.2001 0.02)
44  );
45  }
46  \endverbatim
47  will cause results to be written every 0.005s between 0 and 0.1s, every
48  0.01s between 0.1 and 0.2s and every 0.02s thereafter.
49 
50 SourceFiles
51  setWriteIntervalFunctionObject.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef functionObjects_setWriteIntervalFunctionObject_H
56 #define functionObjects_setWriteIntervalFunctionObject_H
57 
58 #include "functionObject.H"
59 #include "Function1.H"
60 #include "Time.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 namespace functionObjects
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class setWriteIntervalFunctionObject Declaration
71 \*---------------------------------------------------------------------------*/
72 
74 :
75  public functionObject
76 {
77  // Private Data
78 
79  //- Reference to the time database
80  const Time& time_;
81 
82  //- Time step function/table
83  autoPtr<Function1<scalar>> writeIntervalPtr_;
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("setWriteInterval");
90 
91 
92  // Constructors
93 
94  //- Construct from components
96  (
97  const word& name,
98  const Time& runTime,
99  const dictionary& dict
100  );
101 
102  //- Disallow default bitwise copy construction
104  (
106  ) = delete;
107 
108 
109  // Destructor
111 
112 
113  // Member Functions
114 
115  //- Read and reset the writeInterval Function1
116  virtual bool read(const dictionary&);
117 
118  //- Reset the writeInterval from the Function1 of time
119  virtual bool execute();
120 
121  //- Do nothing
122  virtual bool write();
123 
124 
125  // Member Operators
126 
127  //- Disallow default bitwise assignment
128  void operator=(const setWriteIntervalFunctionObject&) = delete;
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace functionObjects
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
engineTime & runTime
TypeName("setWriteInterval")
Runtime type information.
Abstract base-class for Time/database functionObjects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
virtual bool execute()
Reset the writeInterval from the Function1 of time.
setWriteIntervalFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
virtual bool read(const dictionary &)
Read and reset the writeInterval Function1.
void operator=(const setWriteIntervalFunctionObject &)=delete
Disallow default bitwise assignment.
Updates the writeInterval as a Function1 of time.
A class for handling words, derived from string.
Definition: word.H:59
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Namespace for OpenFOAM.