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 -------------------------------------------------------------------------------
11 License
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 
34 const 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 )
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& 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 (
176  Ostream& os
177 ) const
178 {
179  return stateDict().writeResultEntries(name(), os);
180 }
181 
182 
184 (
185  const word& objectName,
186  Ostream& os
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 // ************************************************************************* //
wordList objectResultEntries() const
Retrieve the result entries.
dictionary dict
word objectResultType(const word &objectName, const word &entryName) const
Return the type of result.
void writeAllResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Storage for function object properties, derived from IOdictionary. Provides functionality to read/wri...
bool getDict(const word &entryName, dictionary &dict) const
Set dictionary, return true if set.
engineTime & runTime
functionObjects::properties & propsDict()
Write access to the properties dictionary ("functionObjectProperties") registered on Time...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
const functionObjects::properties & stateDict() const
Return a const reference to the state dictionary.
void writeResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
bool setTrigger(const label triggeri)
Set new trigger index.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
stateFunctionObject(const stateFunctionObject &)=delete
No copy construct.
const functionObjectList & functionObjects() const noexcept
Return the list of function objects.
Definition: Time.H:722
A class for handling words, derived from Foam::string.
Definition: word.H:63
word resultType(const word &entryName) const
Retrieve the result type.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
label getTrigger() const
Get the current trigger index.
OBJstream os(runTime.globalPath()/outputName)
dictionary & propertyDict()
Return access to the property dictionary.
bool getObjectDict(const word &objectName, const word &entryName, dictionary &dict) const
Set dictionary from named object, return true if set.
void clearTrigger()
Remove the trigger index from the properties.
bool getObjectResultDict(const word &objectName, dictionary &dict) const
bool foundProperty(const word &entryName) const
Return true if the property exists.
Virtual base class for function objects with a reference to Time.
const Time & time_
Reference to the time database.