stateFunctionObject.C
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) 2015 OpenFOAM Foundation
9 Copyright (C) 2015-2022 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
27\*---------------------------------------------------------------------------*/
28
29#include "stateFunctionObject.H"
30#include "Time.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34const Foam::word Foam::functionObjects::stateFunctionObject::resultsName_ =
35 "results";
36
37
38// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
39
42{
44}
45
46
49{
50 return const_cast<functionObjects::properties&>
51 (
52 time_.functionObjects().propsDict()
53 );
54}
55
56
57// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58
60(
61 const word& name,
62 const Time& runTime
63)
64:
66{}
67
68
69// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
70
72{
73 return stateDict().getObjectDict(name());
74}
75
76
78{
79 return stateDict().clearTrigger();
80}
81
82
84{
85 return stateDict().getTrigger();
86}
87
88
90(
91 const label triggeri
92)
93{
94 return stateDict().setTrigger(triggeri);
95}
96
97
99(
100 const word& entryName
101) const
102{
103 return stateDict().foundObjectProperty(name(), entryName);
104}
105
106
108(
109 const word& entryName,
111) const
112{
113 return stateDict().getObjectDict(name(), entryName, dict);
114}
115
116
118(
119 const word& objectName,
120 const word& entryName,
122) const
123{
124 return stateDict().getObjectDict(objectName, entryName, dict);
125}
126
127
129(
130 const word& entryName
131) const
132{
133 return stateDict().objectResultType(name(), entryName);
134}
135
136
138(
139 const word& objectName,
140 const word& entryName
141) const
142{
143 return stateDict().objectResultType(objectName, entryName);
144}
145
146
149{
150 return stateDict().objectResultEntries(name());
151}
152
153
156(
157 const word& objectName
158) const
159{
160 return stateDict().objectResultEntries(objectName);
161}
162
163
165(
166 Ostream& os
167) const
168{
169 return stateDict().writeResultEntries(name(), os);
170}
171
172
174(
175 const word& objectName,
176 Ostream& os
177) const
178{
179 return stateDict().writeResultEntries(objectName, os);
180}
181
182
184(
185 Ostream& os
186) const
187{
188 return stateDict().writeAllResultEntries(os);
189}
190
191
192// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:504
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & resultType() const noexcept
The result type-name.
functionObjects::properties & propsDict()
Storage for function object properties, derived from IOdictionary. Provides functionality to read/wri...
Base class for function objects, adding functionality to read/write state information (data required ...
bool getObjectDict(const word &objectName, const word &entryName, dictionary &dict) const
Set dictionary from named object, return true if set.
bool getDict(const word &entryName, dictionary &dict) const
Set dictionary, return true if set.
bool setTrigger(const label triggeri)
Set new trigger index.
word objectResultType(const word &objectName, const word &entryName) const
Return the type of result.
bool foundProperty(const word &entryName) const
Return true if the property exists.
void writeAllResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
void writeResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
void clearTrigger()
Remove the trigger index from the properties.
const functionObjects::properties & stateDict() const
Return a const reference to the state dictionary.
label getTrigger() const
Get the current trigger index.
dictionary & propertyDict()
Return access to the property dictionary.
wordList objectResultEntries() const
Retrieve the result entries.
Virtual base class for function objects with a reference to Time.
const Time & time_
Reference to the time database.
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
dictionary dict