1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*----------------------------------------------------------------------------*/
27 #include "sendingReferralList.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 Foam::sendingReferralList::sendingReferralList()
38 Foam::sendingReferralList::sendingReferralList
40 const label destinationProc,
41 const labelList& cellsToSend
44 labelList(cellsToSend),
45 destinationProc_(destinationProc)
49 Foam::sendingReferralList::sendingReferralList
51 const sendingReferralList& rL
55 destinationProc_(rL.destinationProc())
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 Foam::sendingReferralList::~sendingReferralList()
65 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
67 void Foam::sendingReferralList::operator=(const sendingReferralList& rhs)
69 // Check for assignment to self
74 "Foam::distribution::operator=(const Foam::distribution&)"
76 << "Attempted assignment to self"
80 labelList::operator=(rhs);
82 destinationProc_ = rhs.destinationProc();
86 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
90 const Foam::sendingReferralList& a,
91 const Foam::sendingReferralList& b
94 // Trivial reject: lists are different size
95 if (a.size() != b.size())
100 // Or if source processors are not the same.
101 if (a.destinationProc() != b.destinationProc())
106 Foam::List<bool> fnd(a.size(), false);
110 Foam::label curLabel = b[bI];
116 if (a[aI] == curLabel)
130 // check if all labels on a were marked
135 result = (result && fnd[aI]);
142 Foam::Istream& Foam::operator>>
145 sendingReferralList& sRL
148 is >> sRL.destinationProc_ >> static_cast<labelList&>(sRL);
150 is.check("Istream& operator<<(Istream& f, const sendingReferralList& sRL");
156 Foam::Ostream& Foam::operator<<
159 const sendingReferralList& rL
162 os << rL.destinationProc() << token::SPACE
163 << static_cast< const labelList& >(rL);
165 os.check("Ostream& operator<<(Ostream& f, const sendingReferralList& rL");
171 // ************************************************************************* //