Loading...
Searching...
No Matches
InteractionLists.H
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::InteractionLists
28
29Description
30
31 Builds direct interaction list, specifying which local (real)
32 cells are potentially in range of each other.
33
34 Builds referred interaction list, specifying which cells are
35 required to provide interactions across coupled patches (cyclic or
36 processor). Generates referred cells, and refers particles to the
37 correct processor, applying the appropriate transform.
38
39 Simultaneous communication and computation is possible using:
40
41 \verbatim
42 PstreamBuffers pBufs;
43 label startOfRequests = Pstream::nRequests();
44 il_.sendReferredData(cellOccupancy_, pBufs);
45 // Do other things
46 il_.receiveReferredData(pBufs, startOfRequests);
47 \endverbatim
48
49 Requiring data:
50
51 \verbatim
52 List<DynamicList<typename CloudType::parcelType*>> cellOccupancy_;
53 \endverbatim
54
55SourceFiles
56 InteractionListsI.H
57 InteractionLists.C
58 InteractionListsIO.C
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef InteractionLists_H
63#define InteractionLists_H
64
65#include "polyMesh.H"
66#include "referredWallFace.H"
67//#include "mapDistribute.H"
68
69// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70
71namespace Foam
72{
73
75class mapDistribute;
76
77/*---------------------------------------------------------------------------*\
78 Class InteractionLists Declaration
79\*---------------------------------------------------------------------------*/
80
81template<class ParticleType>
82class InteractionLists
83{
84 // Private data
85
86 //- Reference to mesh
87 const polyMesh& mesh_;
88
89 //- Dummy cloud to give to particles
91
92 //- Switch controlling whether or not the cloud gets populated
93 // with the referred particles, hence gets written out
94 const bool writeCloud_;
95
96 //- mapDistribute to exchange referred particles into referred cells
97 autoPtr<mapDistribute> cellMapPtr_;
98
99 //- mapDistribute to exchange wall face data
100 autoPtr<mapDistribute> wallFaceMapPtr_;
101
102 //- Maximum distance over which interactions will be detected
103 scalar maxDistance_;
104
105 //- Direct interaction list
106 labelListList dil_;
107
108 //- Wall faces on this processor that are in interaction range
109 // of each each cell (direct wall face interaction list)
110 labelListList dwfil_;
111
112 //- Referred interaction list - which real cells are to be
113 // supplied with particle interactions from the referred
114 // particle container with the same index.
115 labelListList ril_;
116
117 //- Inverse addressing for referred cells, specifies which
118 // referred cells (indices of entries in the ril_ and
119 // referredParticles_ lists) interact with the real cell
120 // indexed in this container.
121 labelListList rilInverse_;
122
123 //- Which real cells on this on this processor are in
124 // interaction range of each referred wall face (referred
125 // wall face interaction list)
126 labelListList rwfil_;
127
128 //- Inverse addressing for referred wall faces, specifies
129 // which referred wall faces interact with the real cells
130 // indexed in this container.
131 labelListList rwfilInverse_;
132
133 //- Which cells are to be sent via the cellMap, and an index
134 // specifying how they should be transformed.
135 List<labelPair> cellIndexAndTransformToDistribute_;
136
137 //- Which wallFaces are to be sent via the wallFaceMap, and an index
138 // specifying how they should be transformed.
139 List<labelPair> wallFaceIndexAndTransformToDistribute_;
140
141 //- Referred wall faces
142 List<referredWallFace> referredWallFaces_;
143
144 //- Velocity field name, default to "U"
145 const word UName_;
146
147 //- Referred wall face velocity field values;
148 List<vector> referredWallData_;
149
150 //- Referred particle container
151 List<IDLList<ParticleType>> referredParticles_;
152
153
154 // Private Member Functions
155
156 //- Construct all interaction lists
157 void buildInteractionLists();
158
159 //- Find the other processors which have interaction range
160 // extended bound boxes in range
161 void findExtendedProcBbsInRange
162 (
163 const treeBoundBox& procBb,
164 const List<treeBoundBox>& allExtendedProcBbs,
165 const globalIndexAndTransform& globalTransforms,
166 List<treeBoundBox>& extendedProcBbsInRange,
167 List<label>& extendedProcBbsTransformIndex,
168 List<label>& extendedProcBbsOrigProc
169 );
170
171 //- Build the mapDistribute from information about which entry
172 // is to be sent to which processor
173 void buildMap
174 (
176 const List<label>& toProc
177 );
178
179 //- Fill the referredParticles container with particles that
180 // will be referred
181 void prepareParticlesToRefer
182 (
184 );
185
186 //- Prepare particle to be referred
187 void prepareParticleToBeReferred
188 (
189 ParticleType* particle,
190 labelPair iat
191 );
192
193 //- Fill the referredParticles so that it will be written out
194 void fillReferredParticleCloud();
195
196 //- Populate the referredWallData container with data that
197 // will be referred.
198 void prepareWallDataToRefer();
199
200 //- Write the referred wall faces out for debug
201 void writeReferredWallFaces() const;
202
203 //- No copy construct
204 InteractionLists(const InteractionLists&) = delete;
205
206 //- No copy assignment
207 void operator=(const InteractionLists&) = delete;
208
209
210public:
211
212 // Constructors
213
214 //- Construct null from mesh
215 InteractionLists(const polyMesh& mesh);
216
217 //- Construct and call function to create all information from
218 // the mesh
219 InteractionLists
220 (
221 const polyMesh& mesh,
222 scalar maxDistance,
223 bool writeCloud = false,
224 const word& UName = "U"
225 );
226
227 // Destructor
228
230
231
232 // Member Functions
233
234 //- Prepare and send referred particles and wall data (nonBlocking)
236 (
238 PstreamBuffers& pBufs
239 );
240
241 //- Receive referred data
243 (
244 PstreamBuffers& pBufs,
245 const label startReq = 0
246 );
247
248
249 // Access
250
251 //- Return access to the mesh
252 inline const polyMesh& mesh() const;
253
254 //- Return access to the cellMap
255 inline const mapDistribute& cellMap() const;
256
257 //- Return access to the wallFaceMap
258 inline const mapDistribute& wallFaceMap() const;
259
260 //- Return access to the direct interaction list
261 inline const labelListList& dil() const;
262
263 //- Return access to the direct wall face interaction list
264 inline const labelListList& dwfil() const;
265
266 //- Return access to the referred interaction list
267 inline const labelListList& ril() const;
268
269 //- Return access to the inverse referred interaction list
270 inline const labelListList& rilInverse() const;
271
272 //- Return access to the referred wall face interaction list
273 inline const labelListList& rwfil() const;
274
275 //- Return access to the inverse referred wall face
276 // interaction list
277 inline const labelListList& rwfilInverse() const;
278
279 //- Return access to the cellIndexAndTransformToDistribute list
280 inline const List<labelPair>&
282
283 //- Return access to the wallFaceIndexAndTransformToDistribute list
284 inline const List<labelPair>&
286
287 //- Return access to the referred wall faces
288 inline const List<referredWallFace>& referredWallFaces() const;
289
290 //- Return the name of the velocity field
291 inline const word& UName() const;
292
293 //- Return access to the referred wall data
294 inline const List<vector>& referredWallData() const;
295
296 //- Return access to the referred particle container
297 inline const List<IDLList<ParticleType>>&
298 referredParticles() const;
299
300 //- Return non-const access to the referred particle container
302};
303
304
305// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306
307} // End namespace Foam
308
309// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310
311#include "InteractionListsI.H"
312
313// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314
315#ifdef NoRepository
316 #include "InteractionLists.C"
317#endif
318
319// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320
321#endif
322
323// ************************************************************************* //
const List< DynamicList< molecule * > > & cellOccupancy
Base cloud calls templated on particle type.
Definition Cloud.H:64
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
const List< IDLList< ParticleType > > & referredParticles() const
Return access to the referred particle container.
const mapDistribute & cellMap() const
Return access to the cellMap.
const List< labelPair > & wallFaceIndexAndTransformToDistribute() const
Return access to the wallFaceIndexAndTransformToDistribute list.
const List< labelPair > & cellIndexAndTransformToDistribute() const
Return access to the cellIndexAndTransformToDistribute list.
const List< vector > & referredWallData() const
Return access to the referred wall data.
const List< referredWallFace > & referredWallFaces() const
Return access to the referred wall faces.
const labelListList & rilInverse() const
Return access to the inverse referred interaction list.
const polyMesh & mesh() const
Return access to the mesh.
const mapDistribute & wallFaceMap() const
Return access to the wallFaceMap.
const labelListList & dil() const
Return access to the direct interaction list.
const labelListList & ril() const
Return access to the referred interaction list.
const labelListList & rwfil() const
Return access to the referred wall face interaction list.
void sendReferredData(const List< DynamicList< ParticleType * > > &cellOccupancy, PstreamBuffers &pBufs)
Prepare and send referred particles and wall data (nonBlocking).
const labelListList & rwfilInverse() const
Return access to the inverse referred wall face.
const word & UName() const
Return the name of the velocity field.
const labelListList & dwfil() const
Return access to the direct wall face interaction list.
void receiveReferredData(PstreamBuffers &pBufs, const label startReq=0)
Receive referred data.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Determination and storage of the possible independent transforms introduced by coupledPolyPatches,...
Class containing processor-to-processor mapping information.
Base particle class.
Definition particle.H:72
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Standard boundBox with extra functionality for use in octree.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
Pair< label > labelPair
A pair of labels.
Definition Pair.H:54
List< labelList > labelListList
List of labelList.
Definition labelList.H:38