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  Copyright (C) 2022 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 "CloudSubModelBase.H"
30 #include "cloud.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class CloudType>
36 :
37  subModelBase(owner.outputProperties()),
38  owner_(owner)
39 {
40  this->log = owner_.solution().log();
41 }
42 
43 
44 template<class CloudType>
46 (
47  CloudType& owner,
48  const dictionary& dict,
49  const word& baseName,
50  const word& modelType,
51  const word& dictExt
52 )
53 :
55  (
56  owner.outputProperties(),
57  dict,
58  baseName,
59  modelType,
60  dictExt
61  ),
62  owner_(owner)
63 {
64  this->log = owner_.solution().log();
65 }
66 
67 
68 template<class CloudType>
70 (
71  const word& modelName,
72  CloudType& owner,
73  const dictionary& dict,
74  const word& baseName,
75  const word& modelType
76 )
77 :
79  (
80  modelName,
81  owner.outputProperties(),
82  dict,
83  baseName,
84  modelType
85  ),
86  owner_(owner)
87 {
88  this->log = owner_.solution().log();
89 }
90 
91 
92 template<class CloudType>
94 (
96 )
97 :
98  subModelBase(smb),
99  owner_(smb.owner_)
100 {
101  this->log = owner_.solution().log();
102 }
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
107 template<class CloudType>
109 {
110  return owner_;
111 }
112 
113 
114 template<class CloudType>
116 {
117  return owner_;
118 }
119 
120 
121 template<class CloudType>
123 {
124  return
125  active()
126  && owner_.solution().transient()
127  && owner_.db().time().writeTime();
128 }
129 
130 
131 template<class CloudType>
133 {
134  if (!modelName_.empty())
135  {
136  return cloud::prefix/owner_.name()/modelName_;
137  }
138 
139  return cloud::prefix/owner_.name()/baseName_;
140 }
141 
142 
143 template<class CloudType>
145 {
146  this->log = owner_.solution().log();
147 }
148 
149 
150 template<class CloudType>
152 {
153  os.writeEntry("owner", owner_.name());
154 
156 }
157 
158 
159 // ************************************************************************* //
virtual void info()
Write to info.
dictionary dict
A class for handling file names.
Definition: fileName.H:72
dimensionedScalar log(const dimensionedScalar &ds)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
CloudSubModelBase(CloudType &owner)
Construct null from owner cloud.
Base class for cloud sub-models.
virtual void write(Ostream &os) const
Write to os.
virtual bool writeTime() const
Flag to indicate when to write a property.
const CloudType & owner() const
Return const access to the owner cloud.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual fileName localPath() const
Output directory.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:192
OBJstream os(runTime.globalPath()/outputName)
Base class for generic sub-models requiring to be read from dictionary. Provides a mechanism to read ...
Definition: subModelBase.H:50
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67