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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "runTimeCondition.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(runTimeCondition, 0);
33  defineRunTimeSelectionTable(runTimeCondition, dictionary);
34 }
35 
36 
37 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
38 
40 {
41  dictionary& propertyDict = state_.propertyDict();
42 
43  if (!propertyDict.found(name_))
44  {
45  propertyDict.add(name_, dictionary());
46  }
47 
48  return propertyDict.subDict(name_);
49 }
50 
51 
53 {
54  return conditionDict_;
55 }
56 
57 
59 {
60  return conditionDict_;
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 (
68  const word& name,
69  const objectRegistry& obr,
70  const dictionary& dict,
71  functionObjectState& state
72 )
73 :
74  name_(name),
75  obr_(obr),
76  state_(state),
77  active_(dict.lookupOrDefault<bool>("active", true)),
78  conditionDict_(setConditionDict()),
79  log_(dict.lookupOrDefault("log", true)),
80  groupID_(dict.lookupOrDefault("groupID", -1))
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
91 
93 {
94  return name_;
95 }
96 
97 
99 {
100  return active_;
101 }
102 
103 
105 {
106  return groupID_;
107 }
108 
109 
110 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::functionObjectState
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: functionObjectState.H:54
Foam::runTimeCondition::setConditionDict
dictionary & setConditionDict()
Set the condition dictionary (create if necessary)
Definition: runTimeCondition.C:39
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::runTimeCondition::name_
word name_
Condition name.
Definition: runTimeCondition.H:62
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Definition: dictionaryTemplates.C:33
Foam::runTimeCondition::conditionDict
const dictionary & conditionDict() const
Return const access to the conditions dictionary.
Definition: runTimeCondition.C:52
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
runTimeCondition.H
Foam::runTimeCondition::name
virtual const word & name() const
Return the condition name.
Definition: runTimeCondition.C:92
Foam::runTimeCondition::runTimeCondition
runTimeCondition(const word &name, const objectRegistry &obr, const dictionary &dict, functionObjectState &state)
Constructor.
Definition: runTimeCondition.C:67
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::runTimeCondition::state_
functionObjectState & state_
State.
Definition: runTimeCondition.H:68
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::runTimeCondition::~runTimeCondition
virtual ~runTimeCondition()
Destructor.
Definition: runTimeCondition.C:86
Foam::runTimeCondition::active
virtual bool active() const
Return the active flag.
Definition: runTimeCondition.C:98
Foam::functionObjectState::propertyDict
dictionary & propertyDict()
Return access to the property dictionary.
Definition: functionObjectState.C:76
Foam::dictionary::subDict
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:631
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::runTimeCondition::groupID
virtual label groupID() const
Return the group index.
Definition: runTimeCondition.C:104