PairCollisionRecord.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "PairCollisionRecord.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 :
33  origProcOfOther_(0),
34  origIdOfOther_(-1),
35  data_(Zero)
36 {}
37 
38 
39 template<class Type>
41 (
42  bool accessed,
43  label origProcOfOther,
44  label origIdOfOther,
45  const Type& data
46 )
47 :
48  origProcOfOther_(origProcOfOther + 1),
49  origIdOfOther_(origIdOfOther),
50  data_(data)
51 {
52  // Default assignment to origProcOfOther_ assumes accessed is true
53 
54  if (!accessed)
55  {
56  setUnaccessed();
57  }
58 }
59 
60 
61 template<class Type>
63 (
64  const PairCollisionRecord<Type>& pCR
65 )
66 :
67  origProcOfOther_(pCR.origProcOfOther_),
68  origIdOfOther_(pCR.origIdOfOther_),
69  data_(pCR.data_)
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
75 template<class Type>
77 {}
78 
79 
80 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
81 
82 template<class Type>
83 void Foam::PairCollisionRecord<Type>::operator=
84 (
85  const PairCollisionRecord<Type>& rhs
86 )
87 {
88  // Check for assignment to self
89  if (this == &rhs)
90  {
92  << "Attempted assignment to self"
93  << abort(FatalError);
94  }
95 
96  origProcOfOther_ = rhs.origProcOfOther_;
97  origIdOfOther_ = rhs.origIdOfOther_;
98  data_ = rhs.data_;
99 }
100 
101 
102 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
103 
104 #include "PairCollisionRecordIO.C"
105 
106 
107 // ************************************************************************* //
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
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
static const zero Zero
Definition: zero.H:91
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Record of a collision between the particle holding the record and the particle with the stored id...
PairCollisionRecord()
Construct null.