CloudFunctionObjectList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 
27 #include "entry.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class CloudType>
33 (
34  CloudType& owner
35 )
36 :
38  owner_(owner),
39  dict_(dictionary::null)
40 {}
41 
42 
43 template<class CloudType>
45 (
46  CloudType& owner,
47  const dictionary& dict,
48  const bool readFields
49 )
50 :
52  owner_(owner),
53  dict_(dict)
54 {
55  if (readFields)
56  {
57  wordList modelNames(dict.toc());
58 
59  Info<< "Constructing cloud functions" << endl;
60 
61  if (modelNames.size() > 0)
62  {
63  this->setSize(modelNames.size());
64 
65  forAll(modelNames, i)
66  {
67  const word& modelName = modelNames[i];
68 
69  const dictionary& modelDict(dict.subDict(modelName));
70 
71  // read the type of the function object
72  const word objectType(modelDict.lookup("type"));
73 
74  this->set
75  (
76  i,
78  (
79  modelDict,
80  owner,
81  objectType,
82  modelName
83  )
84  );
85  }
86  }
87  else
88  {
89  Info<< " none" << endl;
90  }
91  }
92 }
93 
94 
95 template<class CloudType>
97 (
98  const CloudFunctionObjectList& cfol
99 )
100 :
102  owner_(cfol.owner_),
103  dict_(cfol.dict_)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
108 
109 template<class CloudType>
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
116 template<class CloudType>
118 {
119  forAll(*this, i)
120  {
121  this->operator[](i).preEvolve();
122  }
123 }
124 
125 
126 template<class CloudType>
128 {
129  forAll(*this, i)
130  {
131  this->operator[](i).postEvolve();
132  }
133 }
134 
135 
136 template<class CloudType>
138 (
139  typename CloudType::parcelType& p,
140  const scalar dt,
141  const point& position0,
142  bool& keepParticle
143 )
144 {
145  forAll(*this, i)
146  {
147  if (!keepParticle)
148  {
149  return;
150  }
151 
152  this->operator[](i).postMove(p, dt, position0, keepParticle);
153  }
154 }
155 
156 
157 template<class CloudType>
159 (
160  const typename CloudType::parcelType& p,
161  const polyPatch& pp,
162  bool& keepParticle
163 )
164 {
165  forAll(*this, i)
166  {
167  if (!keepParticle)
168  {
169  return;
170  }
171 
172  this->operator[](i).postPatch(p, pp, keepParticle);
173  }
174 }
175 
176 
177 template<class CloudType>
179 (
180  const typename CloudType::parcelType& p,
181  bool& keepParticle
182 )
183 {
184  forAll(*this, i)
185  {
186  if (!keepParticle)
187  {
188  return;
189  }
190 
191  this->operator[](i).postFace(p, keepParticle);
192  }
193 }
194 
195 
196 // ************************************************************************* //
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
const dictionary dict_
Dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
virtual void postEvolve()
Post-evolve hook.
virtual ~CloudFunctionObjectList()
Destructor.
wordList toc() const
Return the table of contents.
Definition: dictionary.C:1095
CloudFunctionObjectList(CloudType &owner)
Null constructor.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:982
points setSize(newPointi)
virtual void postFace(const typename CloudType::parcelType &p, bool &keepParticle)
Post-face hook.
virtual void preEvolve()
Pre-evolve hook.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Definition: word.H:59
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
messageStream Info
List of cloud function objects.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
const CloudType & owner_
Reference to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75