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-2024 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 "functionObject.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 )
49 :
51  owner_(owner),
52  dict_(dict)
53 {
55  {
56  wordList modelNames(dict.toc());
57 
58  Info<< "Constructing cloud functions" << endl;
59 
60  if (modelNames.size() > 0)
61  {
62  this->setSize(modelNames.size());
63 
64  forAll(modelNames, i)
65  {
66  const word& modelName = modelNames[i];
67 
68  const dictionary& modelDict(dict.subDict(modelName));
69 
70  // read the type of the function object
71  const word objectType(modelDict.lookup("type"));
72 
73  this->set
74  (
75  i,
77  (
78  modelDict,
79  owner,
80  objectType,
81  modelName
82  )
83  );
84  }
85  }
86  else
87  {
88  Info<< " none" << endl;
89  }
90  }
91  else
92  {
93  Info<< "Not constructing cloud functions" << endl;
94  }
95 }
96 
97 
98 template<class CloudType>
100 (
102 )
103 :
105  owner_(cfol.owner_),
106  dict_(cfol.dict_)
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
111 
112 template<class CloudType>
114 {}
115 
116 
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 
119 template<class CloudType>
121 {
122  forAll(*this, i)
123  {
124  this->operator[](i).preEvolve();
125  }
126 }
127 
128 
129 template<class CloudType>
131 {
132  forAll(*this, i)
133  {
134  this->operator[](i).postEvolve();
135  }
136 }
137 
138 
139 template<class CloudType>
141 (
142  typename CloudType::parcelType& p,
143  const scalar dt,
144  const point& position0,
145  bool& keepParticle
146 )
147 {
148  forAll(*this, i)
149  {
150  this->operator[](i).postMove(p, dt, position0, keepParticle);
151  }
152 }
153 
154 
155 template<class CloudType>
157 (
158  const typename CloudType::parcelType& p,
159  const polyPatch& pp
160 )
161 {
162  forAll(*this, i)
163  {
164  this->operator[](i).postPatch(p, pp);
165  }
166 }
167 
168 
169 template<class CloudType>
171 (
172  const typename CloudType::parcelType& p
173 )
174 {
175  forAll(*this, i)
176  {
177  this->operator[](i).preFace(p);
178  }
179 }
180 
181 
182 template<class CloudType>
184 (
185  const typename CloudType::parcelType& p
186 )
187 {
188  forAll(*this, i)
189  {
190  this->operator[](i).postFace(p);
191  }
192 }
193 
194 
195 // ************************************************************************* //
#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:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
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:62
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:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:710
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:843
wordList toc() const
Return the table of contents.
Definition: dictionary.C:976
static bool postProcess
Global post-processing mode switch.
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:257
messageStream Info
dictionary dict
volScalarField & p