PairCollisionRecord.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::PairCollisionRecord
28 
29 Description
30 
31  Record of a collision between the particle holding the record and
32  the particle with the stored id.
33 
34  The access status of the record is to be coded in the
35  origProcOfOther data member. The actual processor is offset by
36  +1. A negative value means that the record has not been accessed,
37  positive means that it has.
38 
39 SourceFiles
40  PairCollisionRecordI.H
41  PairCollisionRecord.C
42  PairCollisionRecordIO.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef PairCollisionRecord_H
47 #define PairCollisionRecord_H
48 
49 #include "label.H"
50 #include "vector.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of friend functions and operators
58 template<class Type>
60 
61 template<class Type>
62 inline bool operator==
63 (
66 );
67 
68 template<class Type>
69 inline bool operator!=
70 (
73 );
74 
75 template<class Type>
77 
78 template<class Type>
80 
81 
82 /*---------------------------------------------------------------------------*\
83  Class PairCollisionRecord Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 template<class Type>
88 {
89  // Private data
90 
91  //- Originating processor id of other collision partner
92  label origProcOfOther_;
93 
94  //- Local particle id on originating processor of other
95  // collision partner
96  label origIdOfOther_;
97 
98  //- Collision data, stored as if the storing particle was the
99  // first particle (particle A) in the collision.
100  Type data_;
101 
102 
103 public:
104 
105  // Constructors
106 
107  //- Construct null
109 
110  //- Construct from components
112  (
113  bool accessed,
114  label origProcOfOther,
115  label origIdOfOther,
116  const Type& data = Type(Zero)
117  );
118 
119  //- Construct from Istream
121 
122  //- Construct as copy
124 
125 
126  //- Destructor
128 
129 
130  // Member Functions
131 
132 
133  // Access
134 
135  //- Return the origProcOfOther data
136  inline label origProcOfOther() const;
137 
138  //- Return the origIdOfOther data
139  inline label origIdOfOther() const;
140 
141  //- Return access to the collision data
142  inline const Type& collisionData() const;
143 
144  //- Return access to the collision data
145  inline Type& collisionData();
146 
147 
148  // Check
149 
150  inline bool match
151  (
152  label queryOrigProcOfOther,
153  label queryOrigIdOfOther
154  ) const;
155 
156  //- Return the accessed status of the record
157  inline bool accessed() const;
158 
159 
160  // Edit
161 
162  //- Set the accessed property of the record to accessed
163  inline void setAccessed();
164 
165  //- Set the accessed property of the record to unaccessed
166  inline void setUnaccessed();
167 
168 
169  // Member Operators
170 
171  void operator=(const PairCollisionRecord&);
172 
173 
174  // Friend Operators
175 
176  friend bool operator== <Type>
177  (
180  );
181 
182  friend bool operator!= <Type>
183  (
186  );
187 
188 
189  // IOstream Operators
190 
191  friend Istream& operator>> <Type>
192  (
193  Istream&,
195  );
196 
197  friend Ostream& operator<< <Type>
198  (
199  Ostream&,
201  );
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #include "PairCollisionRecordI.H"
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
216  #include "PairCollisionRecord.C"
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Foam::PairCollisionRecord::~PairCollisionRecord
~PairCollisionRecord()
Destructor.
Definition: PairCollisionRecord.C:79
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::PairCollisionRecord::accessed
bool accessed() const
Return the accessed status of the record.
Definition: PairCollisionRecordI.H:75
PairCollisionRecordI.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::PairCollisionRecord::collisionData
const Type & collisionData() const
Return access to the collision data.
Definition: PairCollisionRecordI.H:61
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::PairCollisionRecord::match
bool match(label queryOrigProcOfOther, label queryOrigIdOfOther) const
Definition: PairCollisionRecordI.H:32
Foam::PairCollisionRecord::PairCollisionRecord
PairCollisionRecord()
Construct null.
Definition: PairCollisionRecord.C:34
Foam::PairCollisionRecord
Record of a collision between the particle holding the record and the particle with the stored id.
Definition: PairCollisionRecord.H:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PairCollisionRecord::origProcOfOther
label origProcOfOther() const
Return the origProcOfOther data.
Definition: PairCollisionRecordI.H:46
Foam::PairCollisionRecord::setUnaccessed
void setUnaccessed()
Set the accessed property of the record to unaccessed.
Definition: PairCollisionRecordI.H:89
Foam::PairCollisionRecord::operator=
void operator=(const PairCollisionRecord &)
Definition: PairCollisionRecord.C:87
Foam::PairCollisionRecord::origIdOfOther
label origIdOfOther() const
Return the origIdOfOther data.
Definition: PairCollisionRecordI.H:53
label.H
vector.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
PairCollisionRecord.C
Foam::PairCollisionRecord::setAccessed
void setAccessed()
Set the accessed property of the record to accessed.
Definition: PairCollisionRecordI.H:82