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-2022 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  this->operator[](i).postMove(p, dt, position0, keepParticle);
148  }
149 }
150 
151 
152 template<class CloudType>
154 (
155  const typename CloudType::parcelType& p,
156  const polyPatch& pp
157 )
158 {
159  forAll(*this, i)
160  {
161  this->operator[](i).postPatch(p, pp);
162  }
163 }
164 
165 
166 template<class CloudType>
168 (
169  const typename CloudType::parcelType& p
170 )
171 {
172  forAll(*this, i)
173  {
174  this->operator[](i).preFace(p);
175  }
176 }
177 
178 
179 template<class CloudType>
181 (
182  const typename CloudType::parcelType& p
183 )
184 {
185  forAll(*this, i)
186  {
187  this->operator[](i).postFace(p);
188  }
189 }
190 
191 
192 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
List of cloud function objects.
virtual void postEvolve()
Post-evolve hook.
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
virtual void postFace(const typename CloudType::parcelType &p)
Post-face hook.
const dictionary & dict() const
Return the forces dictionary.
const CloudType & owner() const
Return const access to the cloud owner.
virtual void preEvolve()
Pre-evolve hook.
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp)
Post-patch hook.
virtual ~CloudFunctionObjectList()
Destructor.
CloudFunctionObjectList(CloudType &owner)
Null constructor.
virtual void preFace(const typename CloudType::parcelType &p)
Pre-face hook.
Templated cloud function object base class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:79
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:221
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
bool set(const label) const
Is element set.
Definition: PtrListI.H:65
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:860
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:998
wordList toc() const
Return the table of contents.
Definition: dictionary.C:1131
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
A class for handling words, derived from string.
Definition: word.H:62
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
Definition: ReadFields.C:244
messageStream Info
dictionary dict
volScalarField & p