CollisionRecordList.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-2016 OpenFOAM Foundation
9 Copyright (C) 2020 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
27Class
28 Foam::CollisionRecordList
29
30Description
31
32SourceFiles
33 CollisionRecordListI.H
34 CollisionRecordList.C
35 CollisionRecordListIO.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef CollisionRecordList_H
40#define CollisionRecordList_H
41
42#include "DynamicList.H"
43#include "PairCollisionRecord.H"
44#include "WallCollisionRecord.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52template<class PairType, class WallType>
53class CollisionRecordList;
54
55template<class PairType, class WallType>
56inline bool operator==
57(
58 const CollisionRecordList<PairType, WallType>&,
59 const CollisionRecordList<PairType, WallType>&
60);
61
62template<class PairType, class WallType>
63inline bool operator!=
64(
65 const CollisionRecordList<PairType, WallType>&,
66 const CollisionRecordList<PairType, WallType>&
67);
68
69template<class PairType, class WallType>
71
72template<class PairType, class WallType>
74
75
76/*---------------------------------------------------------------------------*\
77 Class CollisionRecordList Declaration
78\*---------------------------------------------------------------------------*/
79
80template<class PairType, class WallType>
82{
83 // Private Data
84
85 //- List of active pair collisions
87
88 //- List of active wall collisions
90
91
92public:
93
94 // Generated Methods
95
96 //- Default construct
97 CollisionRecordList() = default;
98
99
100 // Constructors
101
102 //- Construct from Istream
103 explicit CollisionRecordList(Istream& is);
104
105 //- Construct from component fields (for IO)
107 (
113 const vectorField& wallPRel,
115 );
116
117
118 // Member Functions
119
120 //- Return the active pair collisions
122 pairRecords() const;
123
124 //- Return the active wall collisions
126 wallRecords() const;
127
128 // Fields representing the data from each record, i.e if the
129 // records 0-N containing each data members {a, b, c, d...}
130 // are organised:
131 //
132 // a0 b0 c0 d0 ...
133 // a1 b1 c1 d1 ...
134 // a2 b2 c2 d2 ...
135 // ...
136 // aN bN cN dN ...
137 //
138 // Then these field return, for example, (c0, c1, c2,... cN)
139
140 //- Return field of pair accessed from each record, used for
141 // field IO
142 labelField pairAccessed() const;
143
144 //- Return field of pair origProcOfOther from each record,
145 // used for field IO
147
148 //- Return field of pair origIdOfOther from each record, used
149 // for field IO
151
152 //- Return field of pair data from each record, used for field IO
154
155 //- Return field of wall accessed from each record, used for field IO
156 labelField wallAccessed() const;
157
158 //- Return field of wall pRel from each record, used for field IO
159 vectorField wallPRel() const;
160
161 //- Return field of wall data from each record, used for field IO
163
164 //- Enquires if the proc and id pair of the other particle are
165 // present in the records. If so, return non-const access to
166 // the PairCollisionRecord (hence the data) and mark the
167 // PairCollisionRecord as accessed this step, if not, create
168 // the record and return access to it.
170 (
171 label origProcOfOther,
172 label origIdOfOther
173 );
174
175 //- Enquire if the specified record exists without modifying
176 // its accessed status
177 bool checkPairRecord(label origProcOfOther, label origIdOfOther);
178
179 //- Enquires if the position of wall impact relative to the
180 // particle centre is present in the records. If so, return
181 // access to the WallCollisionRecord (hence the data) and
182 // mark the WallCollisionRecord as accesses this step, if
183 // not, create the record and return access to it.
185 (
186 const vector& pRel,
187 scalar radius
188 );
189
190 //- Enquire if the specified record exists without modifying
191 // its accessed status
192 bool checkWallRecord(const vector& pRel, scalar radius);
193
194 //- Update the collision records, deleting any records not
195 // marked as having been accessed, then mark all records as
196 // not accessed ready for the next evaluation
197 void update();
198
199
200 // Friend Operators
202 friend bool operator== <PairType, WallType>
203 (
206 );
208 friend bool operator!= <PairType, WallType>
209 (
212 );
213
214
215 // IOstream Operators
217 friend Istream& operator>> <PairType, WallType>
218 (
219 Istream&,
221 );
223 friend Ostream& operator<< <PairType, WallType>
224 (
225 Ostream&,
227 );
228};
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233} // End namespace Foam
234
235// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236
237#include "CollisionRecordListI.H"
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240
241#ifdef NoRepository
242 #include "CollisionRecordList.C"
243#endif
244
245// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246
247#endif
248
249// ************************************************************************* //
const DynamicList< WallCollisionRecord< WallType > > & wallRecords() const
Return the active wall collisions.
PairCollisionRecord< PairType > & matchPairRecord(label origProcOfOther, label origIdOfOther)
Enquires if the proc and id pair of the other particle are.
const DynamicList< PairCollisionRecord< PairType > > & pairRecords() const
Return the active pair collisions.
labelField pairAccessed() const
Return field of pair accessed from each record, used for.
labelField pairOrigIdOfOther() const
Return field of pair origIdOfOther from each record, used.
vectorField wallPRel() const
Return field of wall pRel from each record, used for field IO.
bool checkPairRecord(label origProcOfOther, label origIdOfOther)
Enquire if the specified record exists without modifying.
Field< WallType > wallData() const
Return field of wall data from each record, used for field IO.
Field< PairType > pairData() const
Return field of pair data from each record, used for field IO.
WallCollisionRecord< WallType > & matchWallRecord(const vector &pRel, scalar radius)
Enquires if the position of wall impact relative to the.
labelField wallAccessed() const
Return field of wall accessed from each record, used for field IO.
bool checkWallRecord(const vector &pRel, scalar radius)
Enquire if the specified record exists without modifying.
void update()
Update the collision records, deleting any records not.
labelField pairOrigProcOfOther() const
Return field of pair origProcOfOther from each record,.
CollisionRecordList()=default
Default construct.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Record of a collision between the particle holding the record and the particle with the stored id.
Record of a collision between the particle holding the record and a wall face at the position relativ...
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)