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 // ************************************************************************* //
Foam::functionObjects::runTimeControls::defineTypeNameAndDebug
defineTypeNameAndDebug(averageCondition, 0)
Foam::functionObjects::runTimeControls::runTimeCondition::name
virtual const word & name() const
Return the condition name.
Definition: runTimeCondition.C:98
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::dictionary::found
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
Foam::functionObjects::stateFunctionObject
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: stateFunctionObject.H:69
Foam::functionObjects::runTimeControls::runTimeCondition::state_
stateFunctionObject & state_
State.
Definition: runTimeCondition.H:75
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::functionObjects::runTimeControls::runTimeCondition::conditionDict
const dictionary & conditionDict() const
Return const access to the conditions dictionary.
Definition: runTimeCondition.C:62
Foam::functionObjects::runTimeControls::defineRunTimeSelectionTable
defineRunTimeSelectionTable(runTimeCondition, dictionary)
runTimeCondition.H
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
Foam::functionObjects::runTimeControls::runTimeCondition::setConditionDict
dictionary & setConditionDict()
Set the condition dictionary (create if necessary)
Definition: runTimeCondition.C:48
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::runTimeControls::runTimeCondition::runTimeCondition
runTimeCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
Definition: runTimeCondition.C:78
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:262
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::dictionary::add
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:640
Foam::functionObjects::runTimeControls::runTimeCondition::groupID
virtual label groupID() const
Return the group index.
Definition: runTimeCondition.C:111
Foam::functionObjects::runTimeControls::runTimeCondition::name_
word name_
Condition name.
Definition: runTimeCondition.H:69
Foam::functionObjects::runTimeControls::runTimeCondition::active
virtual bool active() const
Return the active flag.
Definition: runTimeCondition.C:104