CloudSubModelBase.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) 2011-2016 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 "CloudSubModelBase.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class CloudType>
32 :
33  subModelBase(owner.outputProperties()),
34  owner_(owner)
35 {}
36 
37 
38 template<class CloudType>
40 (
41  CloudType& owner,
42  const dictionary& dict,
43  const word& baseName,
44  const word& modelType,
45  const word& dictExt
46 )
47 :
49  (
50  owner.outputProperties(),
51  dict,
52  baseName,
53  modelType,
54  dictExt
55  ),
56  owner_(owner)
57 {}
58 
59 
60 template<class CloudType>
62 (
63  const word& modelName,
64  CloudType& owner,
65  const dictionary& dict,
66  const word& baseName,
67  const word& modelType
68 )
69 :
71  (
72  modelName,
73  owner.outputProperties(),
74  dict,
75  baseName,
76  modelType
77  ),
78  owner_(owner)
79 {}
80 
81 
82 template<class CloudType>
84 (
86 )
87 :
88  subModelBase(smb),
89  owner_(smb.owner_)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
95 template<class CloudType>
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class CloudType>
104 {
105  return owner_;
106 }
107 
108 
109 template<class CloudType>
111 {
112  return owner_;
113 }
114 
115 
116 template<class CloudType>
118 {
119  return
120  active()
121  && owner_.solution().transient()
122  && owner_.db().time().writeTime();
123 }
124 
125 
126 template<class CloudType>
128 {
129  os.writeKeyword("owner") << owner_.name() << token::END_STATEMENT
130  << nl;
131 
133 }
134 
135 
136 // ************************************************************************* //
const Time & time() const
Return time.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:221
subModelBase(dictionary &properties)
Construct null.
Definition: subModelBase.C:38
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
CloudSubModelBase(CloudType &owner)
Construct null from owner cloud.
virtual ~CloudSubModelBase()
Destructor.
Base class for cloud sub-models.
bool writeTime() const
Return true if this is a write time.
Definition: TimeStateI.H:65
const word & modelType() const
Return const access to the sub-model type.
Definition: subModelBase.C:122
virtual void write(Ostream &os) const
Write.
virtual bool writeTime() const
Flag to indicate when to write a property.
virtual void write(Ostream &os) const
Write.
Definition: subModelBase.C:170
A class for handling words, derived from string.
Definition: word.H:59
CloudType & owner_
Reference to the cloud.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
Base class for generic sub-models requiring to be read from dictionary. Provides a mechanism to read ...
Definition: subModelBase.H:51
const CloudType & owner() const
Return const access to the owner cloud.
virtual bool active() const
Return the model &#39;active&#39; status - default active = true.
Definition: subModelBase.C:154
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
const word & name() const
Return name.
Definition: IOobject.H:260
const word & baseName() const
Return const access to the base name of the sub-model.
Definition: subModelBase.C:116