CloudFunctionObjectList.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 | Copyright (C) 2011-2014 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 label cellI,
141  const scalar dt,
142  const point& position0,
143  bool& keepParticle
144 )
145 {
146  forAll(*this, i)
147  {
148  this->operator[](i).postMove(p, cellI, dt, position0, keepParticle);
149 
150  if (!keepParticle)
151  {
152  return;
153  }
154  }
155 }
156 
157 
158 template<class CloudType>
160 (
161  const typename CloudType::parcelType& p,
162  const polyPatch& pp,
163  const scalar trackFraction,
164  const tetIndices& tetIs,
165  bool& keepParticle
166 )
167 {
168  forAll(*this, i)
169  {
170  this->operator[](i).postPatch
171  (
172  p,
173  pp,
174  trackFraction,
175  tetIs,
176  keepParticle
177  );
178 
179  if (!keepParticle)
180  {
181  return;
182  }
183  }
184 }
185 
186 
187 template<class CloudType>
189 (
190  const typename CloudType::parcelType& p,
191  const label faceI,
192  bool& keepParticle
193 )
194 {
195  forAll(*this, i)
196  {
197  this->operator[](i).postFace(p, faceI, keepParticle);
198 
199  if (!keepParticle)
200  {
201  return;
202  }
203  }
204 }
205 
206 
207 // ************************************************************************* //
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
A class for handling words, derived from string.
Definition: word.H:59
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:638
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
CloudFunctionObjectList(CloudType &owner)
Null constructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
const dictionary dict_
Dictionary.
wordList toc() const
Return the table of contents.
Definition: dictionary.C:707
List of cloud function objects.
#define forAll(list, i)
Definition: UList.H:421
virtual ~CloudFunctionObjectList()
Destructor.
virtual void postMove(typename CloudType::parcelType &p, const label cellI, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
points setSize(newPointi)
const CloudType & owner_
Reference to the owner cloud.
virtual void postEvolve()
Post-evolve hook.
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, const scalar trackFraction, const tetIndices &tetIs, bool &keepParticle)
Post-patch hook.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
virtual void postFace(const typename CloudType::parcelType &p, const label faceI, bool &keepParticle)
Post-face hook.
virtual void preEvolve()
Pre-evolve hook.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:73