setWriteIntervalFunctionObject.C
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-2021 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 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace functionObjects
34 {
35  defineTypeNameAndDebug(setWriteIntervalFunctionObject, 0);
36 
38  (
39  functionObject,
40  setWriteIntervalFunctionObject,
41  dictionary
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
51 (
52  const word& name,
53  const Time& runTime,
54  const dictionary& dict
55 )
56 :
57  functionObject(name),
58  time_(runTime)
59 {
60  read(dict);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
74 (
75  const dictionary& dict
76 )
77 {
78  writeIntervalPtr_ = Function1<scalar>::New("writeInterval", dict);
79 
80  return true;
81 }
82 
83 
85 {
86  const_cast<Time&>(time_).setWriteInterval
87  (
88  writeIntervalPtr_().value(time_.userTimeValue())
89  );
90 
91  return true;
92 }
93 
94 
96 {
97  return true;
98 }
99 
100 
101 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
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.
Macros for easy insertion into run-time selection tables.
setWriteIntervalFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
virtual bool read(const dictionary &)
Read and reset the writeInterval Function1.
A class for handling words, derived from string.
Definition: word.H:59
defineTypeNameAndDebug(Qdot, 0)
Namespace for OpenFOAM.
static autoPtr< Function1< Type > > New(const word &name, const dictionary &dict)
Selector.
Definition: Function1New.C:32