Loading...
Searching...
No Matches
timeActivatedFileUpdate.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2017-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::functionObjects::timeActivatedFileUpdate
29
30Group
31 grpUtilitiesFunctionObjects
32
33Description
34 Performs a file copy/replacement once a specified time has been reached.
35
36Usage
37 Minimal example by using \c system/controlDict.functions:
38 \verbatim
39 fileUpdateFO
40 {
41 // Mandatory entries
42 type timeActivatedFileUpdate;
43 libs (utilityFunctionObjects);
44
45 fileToUpdate <fileName>; // "<system>/fvSolution";
46 timeVsFile <Tuple2<scalar, fileName>>;
47 timeVsFile
48 (
49 (-1 "<system>/fvSolution.0")
50 (0.10 "<system>/fvSolution.10")
51 (0.20 "<system>/fvSolution.20")
52 (0.35 "<system>/fvSolution.35")
53 );
54
55 // Inherited entries
56 ...
57 }
58 \endverbatim
59
60 where the entries mean:
61 \table
62 Property | Description | Type | Reqd | Deflt
63 type | Type name: timeActivatedFileUpdate | word | yes | -
64 libs | Library name: utilityFunctionObjects | word | yes | -
65 fileToUpdate | Name of the file to update | fileName | yes | -
66 timeVsFile | List of times vs files | scalar, fileName | yes | -
67 \endtable
68
69 The inherited entries are elaborated in:
70 - \link timeFunctionObject.H \endlink
71
72SourceFiles
73 timeActivatedFileUpdate.C
74
75\*---------------------------------------------------------------------------*/
76
77#ifndef Foam_functionObjects_timeActivatedFileUpdate_H
78#define Foam_functionObjects_timeActivatedFileUpdate_H
79
80#include "timeFunctionObject.H"
81#include "Tuple2.H"
82
83// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84
85namespace Foam
86{
87
88// Forward Declarations
89class Time;
90
91namespace functionObjects
92{
93
94/*---------------------------------------------------------------------------*\
95 Class timeActivatedFileUpdate Declaration
96\*---------------------------------------------------------------------------*/
97
99:
100 public functionObjects::timeFunctionObject
101{
102 // Private Member Data
103
104 //- Name of file to update
105 fileName fileToUpdate_;
106
107 //- List of times vs filenames
108 List<Tuple2<scalar, fileName>> timeVsFile_;
109
110 //- Index of last file copied
111 label lastIndex_;
112
113 //- Has anything been copied?
114 bool modified_;
115
116
117 // Private Member Functions
118
119 //- Update file
120 void updateFile();
121
122 //- No copy construct
123 timeActivatedFileUpdate(const timeActivatedFileUpdate&) = delete;
124
125 //- No copy assignment
126 void operator=(const timeActivatedFileUpdate&) = delete;
127
128
129public:
130
131 //- Runtime type information
132 TypeName("timeActivatedFileUpdate");
133
134
135 // Constructors
136
137 //- Construct from name, Time and dictionary
138 timeActivatedFileUpdate
139 (
140 const word& name,
141 const Time& runTime,
142 const dictionary& dict
143 );
144
145
146 //- Destructor
147 virtual ~timeActivatedFileUpdate() = default;
148
149
150 // Member Functions
151
152 //- Read the function-object dictionary
153 virtual bool read(const dictionary&);
154
155 //- Execute the function-object operations
156 virtual bool execute();
157
158 //- Write the function-object results (no-op)
159 virtual bool write();
160
161 //- Did any file get changed during execution?
162 virtual bool filesModified() const;
163};
164
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168} // End namespace functionObjects
169} // End namespace Foam
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173#endif
174
175// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
const word & name() const noexcept
Return the name of this functionObject.
Performs a file copy/replacement once a specified time has been reached.
virtual bool filesModified() const
Did any file get changed during execution?
virtual ~timeActivatedFileUpdate()=default
Destructor.
TypeName("timeActivatedFileUpdate")
Runtime type information.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results (no-op).
virtual bool read(const dictionary &)
Read the function-object dictionary.
Virtual base class for function objects with a reference to Time.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68