All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PairCollisionRecord.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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::PairCollisionRecord
26 
27 Description
28 
29  Record of a collision between the particle holding the record and
30  the particle with the stored id.
31 
32  The access status of the record is to be coded in the
33  origProcOfOther data member. The actual processor is offset by
34  +1. A negative value means that the record has not been accessed,
35  positive means that it has.
36 
37 SourceFiles
38  PairCollisionRecordI.H
39  PairCollisionRecord.C
40  PairCollisionRecordIO.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef PairCollisionRecord_H
45 #define PairCollisionRecord_H
46 
47 #include "label.H"
48 #include "vector.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of friend functions and operators
56 template<class Type>
58 
59 template<class Type>
60 inline bool operator==
61 (
64 );
65 
66 template<class Type>
67 inline bool operator!=
68 (
71 );
72 
73 template<class Type>
75 
76 template<class Type>
77 Ostream& operator<<(Ostream&, const PairCollisionRecord<Type>&);
78 
79 
80 /*---------------------------------------------------------------------------*\
81  Class PairCollisionRecord Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 template<class Type>
86 {
87  // Private Data
88 
89  //- Originating processor id of other collision partner
90  label origProcOfOther_;
91 
92  //- Local particle id on originating processor of other
93  // collision partner
94  label origIdOfOther_;
95 
96  //- Collision data, stored as if the storing particle was the
97  // first particle (particle A) in the collision.
98  Type data_;
99 
100 
101 public:
102 
103  // Constructors
104 
105  //- Construct null
107 
108  //- Construct from components
110  (
111  bool accessed,
114  const Type& data = pTraits<Type>::zero
115  );
116 
117  //- Construct from Istream
119 
120  //- Copy constructor
122 
123 
124  //- Destructor
126 
127 
128  // Member Functions
129 
130 
131  // Access
132 
133  //- Return the origProcOfOther data
134  inline label origProcOfOther() const;
135 
136  //- Return the origIdOfOther data
137  inline label origIdOfOther() const;
138 
139  //- Return access to the collision data
140  inline const Type& collisionData() const;
141 
142  //- Return access to the collision data
143  inline Type& collisionData();
144 
145 
146  // Check
147 
148  inline bool match
149  (
150  label queryOrigProcOfOther,
151  label queryOrigIdOfOther
152  ) const;
153 
154  //- Return the accessed status of the record
155  inline bool accessed() const;
156 
157 
158  // Edit
159 
160  //- Set the accessed property of the record to accessed
161  inline void setAccessed();
162 
163  //- Set the accessed property of the record to unaccessed
164  inline void setUnaccessed();
165 
166 
167  // Member Operators
168 
169  void operator=(const PairCollisionRecord&);
170 
171 
172  // Friend Operators
173 
174  friend bool operator== <Type>
175  (
177  const PairCollisionRecord<Type>&
178  );
179 
180  friend bool operator!= <Type>
181  (
182  const PairCollisionRecord<Type>&,
183  const PairCollisionRecord<Type>&
184  );
185 
186 
187  // IOstream Operators
188 
189  friend Istream& operator>> <Type>
190  (
191  Istream&,
192  PairCollisionRecord<Type>&
193  );
194 
195  friend Ostream& operator<< <Type>
196  (
197  Ostream&,
198  const PairCollisionRecord<Type>&
199  );
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #include "PairCollisionRecordI.H"
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #ifdef NoRepository
214  #include "PairCollisionRecord.C"
215 #endif
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
void setUnaccessed()
Set the accessed property of the record to unaccessed.
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
bool match(label queryOrigProcOfOther, label queryOrigIdOfOther) const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool accessed() const
Return the accessed status of the record.
Traits class for primitives.
Definition: pTraits.H:50
const Type & collisionData() const
Return access to the collision data.
label origIdOfOther() const
Return the origIdOfOther data.
label origProcOfOther() const
Return the origProcOfOther data.
Istream & operator>>(Istream &, directionInfo &)
void setAccessed()
Set the accessed property of the record to accessed.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void operator=(const PairCollisionRecord &)
Database for solution and other reduced data.
Definition: data.H:51
Record of a collision between the particle holding the record and the particle with the stored id...
PairCollisionRecord()
Construct null.
Namespace for OpenFOAM.