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-------------------------------------------------------------------------------
10License
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
33template<class CloudType>
35:
36 subModelBase(owner.outputProperties()),
37 owner_(owner)
38{}
39
40
41template<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
63template<class CloudType>
65(
66 const word& modelName,
67 CloudType& owner,
69 const word& baseName,
70 const word& modelType
72:
74 (
75 modelName,
76 owner.outputProperties(),
77 dict,
78 baseName,
79 modelType
80 ),
81 owner_(owner)
82{}
83
84
85template<class CloudType>
87(
89)
90:
92 owner_(smb.owner_)
93{}
94
96// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97
98template<class CloudType>
100{}
101
102
103// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104
105template<class CloudType>
107{
108 return owner_;
110
111
112template<class CloudType>
114{
115 return owner_;
116}
117
119template<class CloudType>
121{
122 return
123 active()
124 && owner_.solution().transient()
125 && owner_.db().time().writeTime();
126}
127
128
129template<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
141template<class CloudType>
143{
144 os.writeEntry("owner", owner_.name());
145
147}
148
149
150// ************************************************************************* //
Base class for cloud sub-models.
virtual fileName localPath() const
Output directory.
const CloudType & owner() const
Return const access to the owner cloud.
virtual ~CloudSubModelBase()
Destructor.
virtual bool writeTime() const
Flag to indicate when to write a property.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:87
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
virtual bool write()
Write the output fields.
Base class for generic sub-models requiring to be read from dictionary. Provides a mechanism to read ...
Definition: subModelBase.H:55
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
dictionary dict