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-2015 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_(pTraits<Type>::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>
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 // ************************************************************************* //
Foam::PairCollisionRecord::~PairCollisionRecord
~PairCollisionRecord()
Destructor.
Definition: PairCollisionRecord.C:76
PairCollisionRecord.H
Foam::PairCollisionRecord::accessed
bool accessed() const
Return the accessed status of the record.
Definition: PairCollisionRecordI.H:73
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:59
Foam::PairCollisionRecord::PairCollisionRecord
PairCollisionRecord()
Construct null.
Definition: PairCollisionRecord.C:31
Foam::PairCollisionRecord
Record of a collision between the particle holding the record and the particle with the stored id.
Definition: PairCollisionRecord.H:56
Foam::FatalError
error FatalError
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::PairCollisionRecord::setUnaccessed
void setUnaccessed()
Set the accessed property of the record to unaccessed.
Definition: PairCollisionRecordI.H:87
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
PairCollisionRecordIO.C
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::zero
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:47