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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "CloudSubModelBase.H"
29 #include "cloud.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 :
36  subModelBase(owner.outputProperties()),
37  owner_(owner)
38 {}
39 
40 
41 template<class CloudType>
43 (
44  CloudType& owner,
45  const dictionary& dict,
46  const word& baseName,
47  const word& modelType,
48  const word& dictExt
49 )
50 :
52  (
53  owner.outputProperties(),
54  dict,
55  baseName,
56  modelType,
57  dictExt
58  ),
59  owner_(owner)
60 {}
61 
62 
63 template<class CloudType>
65 (
66  const word& modelName,
67  CloudType& owner,
68  const dictionary& dict,
69  const word& baseName,
70  const word& modelType
71 )
72 :
74  (
75  modelName,
76  owner.outputProperties(),
77  dict,
78  baseName,
79  modelType
80  ),
81  owner_(owner)
82 {}
83 
84 
85 template<class CloudType>
87 (
89 )
90 :
91  subModelBase(smb),
92  owner_(smb.owner_)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97 
98 template<class CloudType>
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
105 template<class CloudType>
107 {
108  return owner_;
109 }
110 
111 
112 template<class CloudType>
114 {
115  return owner_;
116 }
117 
118 
119 template<class CloudType>
121 {
122  return
123  active()
124  && owner_.solution().transient()
125  && owner_.db().time().writeTime();
126 }
127 
128 
129 template<class CloudType>
131 {
132  if (modelName_ != word::null)
133  {
134  return cloud::prefix/owner_.name()/modelName_;
135  }
136 
137  return cloud::prefix/owner_.name()/baseName_;
138 }
139 
140 
141 template<class CloudType>
143 {
144  os.writeEntry("owner", owner_.name());
145 
147 }
148 
149 
150 // ************************************************************************* //
Foam::subModelBase
Base class for generic sub-models requiring to be read from dictionary. Provides a mechanism to read ...
Definition: subModelBase.H:54
Foam::cloud::prefix
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:87
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::CloudSubModelBase::CloudSubModelBase
CloudSubModelBase(CloudType &owner)
Construct null from owner cloud.
Definition: CloudSubModelBase.C:34
cloud.H
Foam::CloudSubModelBase
Base class for cloud sub-models.
Definition: CloudSubModelBase.H:51
Foam::CloudSubModelBase::~CloudSubModelBase
virtual ~CloudSubModelBase()
Destructor.
Definition: CloudSubModelBase.C:99
Foam::CloudSubModelBase::owner_
CloudType & owner_
Reference to the cloud.
Definition: CloudSubModelBase.H:60
Foam::subModelBase::write
virtual void write(Ostream &os) const
Write.
Definition: subModelBase.C:212
CloudSubModelBase.H
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
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::CloudSubModelBase::write
virtual void write(Ostream &os) const
Write.
Definition: CloudSubModelBase.C:142
Foam::CloudSubModelBase::localPath
virtual fileName localPath() const
Output directory.
Definition: CloudSubModelBase.C:130
Foam::word::null
static const word null
An empty word.
Definition: word.H:80
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::CloudSubModelBase::writeTime
virtual bool writeTime() const
Flag to indicate when to write a property.
Definition: CloudSubModelBase.C:120