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-2021 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  bool increaseOnly
93 )
94 {
95  return stateDict().setTrigger(triggeri, increaseOnly);
96 }
97 
98 
100 (
101  const word& entryName
102 ) const
103 {
104  return stateDict().foundObjectProperty(name(), entryName);
105 }
106 
107 
109 (
110  const word& entryName,
112 ) const
113 {
114  return stateDict().getObjectDict(name(), entryName, dict);
115 }
116 
117 
119 (
120  const word& objectName,
121  const word& entryName,
123 ) const
124 {
125  return stateDict().getObjectDict(objectName, entryName, dict);
126 }
127 
128 
130 (
131  const word& entryName
132 ) const
133 {
134  return stateDict().objectResultType(name(), entryName);
135 }
136 
137 
139 (
140  const word& objectName,
141  const word& entryName
142 ) const
143 {
144  return stateDict().objectResultType(objectName, entryName);
145 }
146 
147 
150 {
151  return stateDict().objectResultEntries(name());
152 }
153 
154 
157 (
158  const word& objectName
159 ) const
160 {
161  return stateDict().objectResultEntries(objectName);
162 }
163 
164 
166 (
167  Ostream& os
168 ) const
169 {
170  return stateDict().writeResultEntries(name(), os);
171 }
172 
173 
175 (
176  const word& objectName,
177  Ostream& os
178 ) const
179 {
180  return stateDict().writeResultEntries(objectName, os);
181 }
182 
183 
185 (
186  Ostream& os
187 ) const
188 {
189  return stateDict().writeAllResultEntries(os);
190 }
191 
192 
193 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::functionObjects::stateFunctionObject::propertyDict
dictionary & propertyDict()
Return access to the property dictionary.
Definition: stateFunctionObject.C:71
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::timeFunctionObject::time_
const Time & time_
Reference to the time database.
Definition: timeFunctionObject.H:65
Foam::functionObjects::timeFunctionObject
Virtual base class for function objects with a reference to Time.
Definition: timeFunctionObject.H:56
Foam::Time::functionObjects
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:499
Foam::functionObjects::stateFunctionObject::resultType
word resultType(const word &entryName) const
Retrieve the result type.
Definition: stateFunctionObject.C:130
Foam::functionObjects::stateFunctionObject::stateFunctionObject
stateFunctionObject(const stateFunctionObject &)=delete
No copy construct.
Foam::functionObjects::stateFunctionObject::getTrigger
label getTrigger() const
Get the current trigger index.
Definition: stateFunctionObject.C:83
Foam::functionObjects::stateFunctionObject::getObjectDict
bool getObjectDict(const word &objectName, const word &entryName, dictionary &dict) const
Set dictionary from named object, return true if set.
Definition: stateFunctionObject.C:119
Foam::functionObjects::stateFunctionObject::writeAllResultEntries
void writeAllResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
Definition: stateFunctionObject.C:185
Foam::functionObjects::stateFunctionObject::objectResultEntries
wordList objectResultEntries() const
Retrieve the result entries.
Definition: stateFunctionObject.C:149
Foam::functionObjects::stateFunctionObject::clearTrigger
void clearTrigger()
Remove the trigger index from the properties.
Definition: stateFunctionObject.C:77
Foam::functionObjects::stateFunctionObject::foundProperty
bool foundProperty(const word &entryName) const
Return true if the property exists.
Definition: stateFunctionObject.C:100
Foam::functionObjects::stateFunctionObject::setTrigger
bool setTrigger(const label triggeri, bool increaseOnly=true)
Set the trigger index. Normally only if greater than current.
Definition: stateFunctionObject.C:90
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjectList::propsDict
functionObjects::properties & propsDict()
Definition: functionObjectList.C:525
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::functionObjects::stateFunctionObject::getDict
bool getDict(const word &entryName, dictionary &dict) const
Set dictionary, return true if set.
Definition: stateFunctionObject.C:109
Foam::functionObjects::stateFunctionObject::objectResultType
word objectResultType(const word &objectName, const word &entryName) const
Return the type of result.
Definition: stateFunctionObject.C:139
Time.H
Foam::functionObjects::properties
Storage for function object properties, derived from IOdictionary. Provides functionality to read/wri...
Definition: functionObjectProperties.H:62
Foam::List< word >
stateFunctionObject.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::functionObjects::stateFunctionObject::stateDict
const functionObjects::properties & stateDict() const
Return a const reference to the state dictionary.
Definition: stateFunctionObject.C:41
Foam::functionObjects::stateFunctionObject::writeResultEntries
void writeResultEntries(Ostream &os) const
Write the results entries for all objects to stream.
Definition: stateFunctionObject.C:166
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56