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