Loading...
Searching...
No Matches
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{
43 return time_.functionObjects().propsDict();
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)
68
69// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74}
75
80}
81
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& objectName,
132) const
133{
134 return stateDict().getObjectResultDict(objectName, dict);
135}
136
137
139(
140 const word& entryName
141) const
142{
143 return stateDict().objectResultType(name(), entryName);
144}
145
146
148(
149 const word& objectName,
150 const word& entryName
151) const
152{
153 return stateDict().objectResultType(objectName, entryName);
154}
155
156
159{
160 return stateDict().objectResultEntries(name());
161}
162
163
166(
167 const word& objectName
168) const
169{
170 return stateDict().objectResultEntries(objectName);
171}
172
173
175(
177) const
178{
179 return stateDict().writeResultEntries(name(), os);
180}
181
182
184(
185 const word& objectName,
187) const
188{
189 return stateDict().writeResultEntries(objectName, os);
190}
191
192
194(
195 Ostream& os
196) const
197{
198 return stateDict().writeAllResultEntries(os);
199}
200
201
202// ************************************************************************* //
IOdictionary propsDict(dictIO)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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
const word & name() const noexcept
Return the name of this functionObject.
Storage for function object properties, derived from IOdictionary. Provides functionality to read/wri...
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.
stateFunctionObject(const stateFunctionObject &)=delete
No copy construct.
void writeResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
bool getObjectResultDict(const word &objectName, dictionary &dict) const
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.
word resultType(const word &entryName) const
Retrieve the result type.
const Time & time_
Reference to the time database.
timeFunctionObject(const timeFunctionObject &)=delete
No copy construct.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
auto & name
List< word > wordList
List of word.
Definition fileName.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict