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