Loading...
Searching...
No Matches
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 Copyright (C) 2020-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
30#include "entry.H"
31
32// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
34template<class CloudType>
36(
38)
39:
42 dict_()
43{}
44
45
46template<class CloudType>
48(
49 CloudType& owner,
50 const dictionary& dict,
51 const bool readFields
52)
53:
55 owner_(owner),
56 dict_(dict)
57{
58 if (readFields)
59 {
60 Info<< "Constructing cloud functions" << endl;
61
62 this->resize(dict.size());
63
64 label count = 0;
65 for (const word& modelName : dict.toc())
66 {
67 const dictionary& modelDict = dict.subDict(modelName);
68
69 {
70 this->set
71 (
72 count,
74 (
75 modelDict,
76 owner,
77 modelDict.get<word>("type"),
78 modelName
79 )
80 );
81 }
82 ++count;
83 }
85 if (!count)
86 {
87 Info<< " none" << endl;
88 }
89 }
90}
91
92
93template<class CloudType>
95(
96 const CloudFunctionObjectList& cfol
97)
98:
100 owner_(cfol.owner_),
102{}
103
104
105// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106
107template<class CloudType>
109(
110 const typename parcelType::trackingData& td
111)
112{
113 for (auto& cfo : *this)
115 cfo.preEvolve(td);
116 }
117}
118
119
120template<class CloudType>
122(
123 const typename parcelType::trackingData& td
124)
125{
126 for (auto& cfo : *this)
128 cfo.postEvolve(td);
129 }
130}
131
132
133template<class CloudType>
135(
136 parcelType& p,
137 const scalar dt,
138 const point& position0,
139 const typename parcelType::trackingData& td
140)
142 if (!td.keepParticle)
143 {
144 return td.keepParticle;
145 }
146
147 for (auto& cfo : *this)
148 {
149 if (!cfo.postMove(p, dt, position0, td))
150 {
151 return false;
152 }
154
155 return true;
156}
157
158
159template<class CloudType>
161(
162 parcelType& p,
163 const polyPatch& pp,
164 const typename parcelType::trackingData& td
165)
166{
167 if (!td.keepParticle)
168 {
169 return td.keepParticle;
171
172 for (auto& cfo : *this)
173 {
174 if (!cfo.postPatch(p, pp, td))
175 {
176 return false;
177 }
179
180 return true;
181}
182
183
184template<class CloudType>
186(
187 parcelType& p,
188 const typename parcelType::trackingData& td
189)
190{
191 if (!td.keepParticle)
192 {
193 return td.keepParticle;
194 }
195
196 for (auto& cfo : *this)
197 {
198 if (!cfo.postFace(p, td))
199 {
200 return false;
201 }
202 }
203
204 return true;
205}
206
207
208// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
List of cloud function objects.
const CloudType & owner_
Reference to the owner cloud.
virtual bool postFace(parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
virtual bool postPatch(parcelType &p, const polyPatch &pp, const typename parcelType::trackingData &td)
Post-patch hook.
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
const dictionary dict_
Dictionary.
const dictionary & dict() const
Return the forces dictionary.
const CloudType & owner() const
Return const access to the cloud owner.
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
virtual bool postMove(parcelType &p, const scalar dt, const point &position0, const typename parcelType::trackingData &td)
Post-move hook.
CloudFunctionObjectList(CloudType &owner)
Null constructor.
Templated cloud function object base class.
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
label size() const noexcept
The number of elements in list.
Definition DLListBase.H:194
particle::trackingData trackingData
Definition DSMCParcel.H:155
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
const CloudFunctionObject< CloudType > * set(const label i) const
Definition PtrList.H:171
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
DSMCCloud< dsmcParcel > CloudType
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
vector point
Point is a vector.
Definition point.H:37
dictionary dict