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 | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::CollisionRecordList
26 
27 Description
28 
29 SourceFiles
30  CollisionRecordListI.H
31  CollisionRecordList.C
32  CollisionRecordListIO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef CollisionRecordList_H
37 #define CollisionRecordList_H
38 
39 #include "DynamicList.H"
40 #include "PairCollisionRecord.H"
41 #include "WallCollisionRecord.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of friend functions and operators
49 template<class PairType, class WallType>
51 
52 template<class PairType, class WallType>
53 inline bool operator==
54 (
57 );
58 
59 template<class PairType, class WallType>
60 inline bool operator!=
61 (
64 );
65 
66 template<class PairType, class WallType>
68 
69 template<class PairType, class WallType>
70 Ostream& operator<<(Ostream&, const CollisionRecordList<PairType, WallType>&);
71 
72 
73 /*---------------------------------------------------------------------------*\
74  Class CollisionRecordList Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 template<class PairType, class WallType>
79 {
80  // Private data
81 
82  //- List of active pair collisions
84 
85  //- List of active wall collisions
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct null
95 
96  //- Construct from Istream
98 
99  //- Construct from component fields (for IO)
101  (
102  const labelField& pairAccessed,
105  const Field<PairType>& pairData,
106  const labelField& wallAccessed,
107  const vectorField& wallPRel,
109  );
110 
111  //- Destructor
113 
114 
115  // Member Functions
116 
117  //- Return the active pair collisions
119  pairRecords() const;
120 
121  //- Return the active wall collisions
123  wallRecords() const;
124 
125  // Fields representing the data from each record, i.e if the
126  // records 0-N containing each data members {a, b, c, d...}
127  // are organised:
128  //
129  // a0 b0 c0 d0 ...
130  // a1 b1 c1 d1 ...
131  // a2 b2 c2 d2 ...
132  // ...
133  // aN bN cN dN ...
134  //
135  // Then these field return, for example, (c0, c1, c2,... cN)
136 
137  //- Return field of pair accessed from each record, used for
138  // field IO
139  labelField pairAccessed() const;
140 
141  //- Return field of pair origProcOfOther from each record,
142  // used for field IO
144 
145  //- Return field of pair origIdOfOther from each record, used
146  // for field IO
148 
149  //- Return field of pair data from each record, used for field IO
150  Field<PairType> pairData() const;
151 
152  //- Return field of wall accessed from each record, used for field IO
153  labelField wallAccessed() const;
154 
155  //- Return field of wall pRel from each record, used for field IO
156  vectorField wallPRel() const;
157 
158  //- Return field of wall data from each record, used for field IO
159  Field<WallType> wallData() const;
160 
161  //- Enquires if the proc and id pair of the other particle are
162  // present in the records. If so, return non-const access to
163  // the PairCollisionRecord (hence the data) and mark the
164  // PairCollisionRecord as accessed this step, if not, create
165  // the record and return access to it.
167  (
168  label origProcOfOther,
169  label origIdOfOther
170  );
171 
172  //- Enquire if the specified record exists without modifying
173  // its accessed status
174  bool checkPairRecord(label origProcOfOther, label origIdOfOther);
175 
176  //- Enquires if the position of wall impact relative to the
177  // particle centre is present in the records. If so, return
178  // access to the WallCollisionRecord (hence the data) and
179  // mark the WallCollisionRecord as accesses this step, if
180  // not, create the record and return access to it.
182  (
183  const vector& pRel,
184  scalar radius
185  );
186 
187  //- Enquire if the specified record exists without modifying
188  // its accessed status
189  bool checkWallRecord(const vector& pRel, scalar radius);
190 
191  //- Update the collision records, deleting any records not
192  // marked as having been accessed, then mark all records as
193  // not accessed ready for the next evaluation
194  void update();
195 
196 
197  // Member Operators
198 
199  void operator=(const CollisionRecordList&);
200 
201 
202  // Friend Operators
203 
204  friend bool operator== <PairType, WallType>
205  (
207  const CollisionRecordList<PairType, WallType>&
208  );
209 
210  friend bool operator!= <PairType, WallType>
211  (
212  const CollisionRecordList<PairType, WallType>&,
213  const CollisionRecordList<PairType, WallType>&
214  );
215 
216 
217  // IOstream Operators
218 
219  friend Istream& operator>> <PairType, WallType>
220  (
221  Istream&,
222  CollisionRecordList<PairType, WallType>&
223  );
224 
225  friend Ostream& operator<< <PairType, WallType>
226  (
227  Ostream&,
228  const CollisionRecordList<PairType, WallType>&
229  );
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #include "CollisionRecordListI.H"
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "CollisionRecordList.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
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:59
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Field< PairType > pairData() const
Return field of pair data from each record, used for field IO.
void update()
Update the collision records, deleting any records not.
void operator=(const CollisionRecordList &)
CollisionRecordList()
Construct null.
Field< WallType > wallData() const
Return field of wall data from each record, used for field IO.
bool checkWallRecord(const vector &pRel, scalar radius)
Enquire if the specified record exists without modifying.
labelField pairOrigProcOfOther() const
Return field of pair origProcOfOther from each record,.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
Istream & operator>>(Istream &, directionInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
PairCollisionRecord< PairType > & matchPairRecord(label origProcOfOther, label origIdOfOther)
Enquires if the proc and id pair of the other particle are.
Record of a collision between the particle holding the record and a wall face at the position relativ...
WallCollisionRecord< WallType > & matchWallRecord(const vector &pRel, scalar radius)
Enquires if the position of wall impact relative to the.
const DynamicList< WallCollisionRecord< WallType > > & wallRecords() const
Return the active wall collisions.
labelField pairOrigIdOfOther() const
Return field of pair origIdOfOther from each record, used.
const DynamicList< PairCollisionRecord< PairType > > & pairRecords() const
Return the active pair collisions.
Record of a collision between the particle holding the record and the particle with the stored id...
labelField wallAccessed() const
Return field of wall accessed from each record, used for field IO.
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.
labelField pairAccessed() const
Return field of pair accessed from each record, used for.
Namespace for OpenFOAM.