runTimeCondition.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) 2016-2020 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 "runTimeCondition.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace functionObjects
36 {
37 namespace runTimeControls
38 {
39  defineTypeNameAndDebug(runTimeCondition, 0);
40  defineRunTimeSelectionTable(runTimeCondition, dictionary);
41 }
42 }
43 }
44 
45 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
46 
49 {
50  dictionary& propertyDict = state_.propertyDict();
51 
52  if (!propertyDict.found(name_))
53  {
54  propertyDict.add(name_, dictionary());
55  }
56 
57  return propertyDict.subDict(name_);
58 }
59 
60 
61 const Foam::dictionary&
63 {
64  return conditionDict_;
65 }
66 
67 
70 {
71  return conditionDict_;
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
76 
78 (
79  const word& name,
80  const objectRegistry& obr,
81  const dictionary& dict,
82  stateFunctionObject& state
83 )
84 :
85  name_(name),
86  obr_(obr),
87  state_(state),
88  active_(dict.getOrDefault("active", true)),
89  conditionDict_(setConditionDict()),
90  groupID_(dict.getOrDefault("groupID", -1)),
91  log(dict.getOrDefault("log", true))
92 {}
93 
94 
95 // * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
96 
97 const Foam::word&
99 {
100  return name_;
101 }
102 
103 
105 {
106  return active_;
107 }
108 
109 
110 Foam::label
112 {
113  return groupID_;
114 }
115 
116 
117 // ************************************************************************* //
Computes the natural logarithm of an input volScalarField.
Definition: log.H:223
dictionary dict
defineRunTimeSelectionTable(runTimeCondition, dictionary)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:625
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:441
dictionary & setConditionDict()
Set the condition dictionary (create if necessary)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Definition: dictionaryI.H:104
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
defineTypeNameAndDebug(averageCondition, 0)
dictionary & propertyDict()
Return access to the property dictionary.
runTimeCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
Base class for function objects, adding functionality to read/write state information (data required ...
virtual bool active() const
Return the active flag.
virtual label groupID() const
Return the group index.
Registry of regIOobjects.
const dictionary & conditionDict() const
Return const access to the conditions dictionary.
Namespace for OpenFOAM.
virtual const word & name() const
Return the condition name.