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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "entry.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  CloudType& owner
37 )
38 :
40  owner_(owner),
41  dict_(dictionary::null)
42 {}
43 
44 
45 template<class CloudType>
47 (
48  CloudType& owner,
49  const dictionary& dict,
50  const bool readFields
51 )
52 :
54  owner_(owner),
55  dict_(dict)
56 {
57  if (readFields)
58  {
59  wordList modelNames(dict.toc());
60 
61  Info<< "Constructing cloud functions" << endl;
62 
63  if (modelNames.size() > 0)
64  {
65  this->setSize(modelNames.size());
66 
67  forAll(modelNames, i)
68  {
69  const word& modelName = modelNames[i];
70 
71  const dictionary& modelDict(dict.subDict(modelName));
72 
73  this->set
74  (
75  i,
77  (
78  modelDict,
79  owner,
80  modelDict.get<word>("type"),
81  modelName
82  )
83  );
84  }
85  }
86  else
87  {
88  Info<< " none" << endl;
89  }
90  }
91 }
92 
93 
94 template<class CloudType>
96 (
97  const CloudFunctionObjectList& cfol
98 )
99 :
101  owner_(cfol.owner_),
102  dict_(cfol.dict_)
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
107 
108 template<class CloudType>
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
115 template<class CloudType>
117 {
118  forAll(*this, i)
119  {
120  this->operator[](i).preEvolve();
121  }
122 }
123 
124 
125 template<class CloudType>
127 {
128  forAll(*this, i)
129  {
130  this->operator[](i).postEvolve();
131  }
132 }
133 
134 
135 template<class CloudType>
137 (
138  typename CloudType::parcelType& p,
139  const scalar dt,
140  const point& position0,
141  bool& keepParticle
142 )
143 {
144  forAll(*this, i)
145  {
146  if (!keepParticle)
147  {
148  return;
149  }
150 
151  this->operator[](i).postMove(p, dt, position0, keepParticle);
152  }
153 }
154 
155 
156 template<class CloudType>
158 (
159  const typename CloudType::parcelType& p,
160  const polyPatch& pp,
161  bool& keepParticle
162 )
163 {
164  forAll(*this, i)
165  {
166  if (!keepParticle)
167  {
168  return;
169  }
170 
171  this->operator[](i).postPatch(p, pp, keepParticle);
172  }
173 }
174 
175 
176 template<class CloudType>
178 (
179  const typename CloudType::parcelType& p,
180  bool& keepParticle
181 )
182 {
183  forAll(*this, i)
184  {
185  if (!keepParticle)
186  {
187  return;
188  }
189 
190  this->operator[](i).postFace(p, keepParticle);
191  }
192 }
193 
194 
195 // ************************************************************************* //
setSize
points setSize(newPointi)
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::CloudFunctionObjectList::owner_
const CloudType & owner_
Reference to the owner cloud.
Definition: CloudFunctionObjectList.H:62
entry.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
CloudFunctionObjectList.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:65
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::CloudFunctionObjectList
List of cloud function objects.
Definition: CloudFunctionObjectList.H:53
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
Foam::CloudFunctionObjectList::preEvolve
virtual void preEvolve()
Pre-evolve hook.
Definition: CloudFunctionObjectList.C:116
Foam::Vector< scalar >
Foam::CloudFunctionObjectList::postPatch
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
Definition: CloudFunctionObjectList.C:158
Foam::CloudFunctionObjectList::~CloudFunctionObjectList
virtual ~CloudFunctionObjectList()
Destructor.
Definition: CloudFunctionObjectList.C:109
Foam::List< word >
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:61
Foam::CloudFunctionObjectList::postFace
virtual void postFace(const typename CloudType::parcelType &p, bool &keepParticle)
Post-face hook.
Definition: CloudFunctionObjectList.C:178
Foam::CloudFunctionObjectList::dict_
const dictionary dict_
Dictionary.
Definition: CloudFunctionObjectList.H:65
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::CloudFunctionObjectList::postEvolve
virtual void postEvolve()
Post-evolve hook.
Definition: CloudFunctionObjectList.C:126
Foam::CloudFunctionObjectList::postMove
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: CloudFunctionObjectList.C:137
Foam::CloudFunctionObjectList::CloudFunctionObjectList
CloudFunctionObjectList(CloudType &owner)
Null constructor.
Definition: CloudFunctionObjectList.C:35