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 "receivingReferralList.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 Foam::receivingReferralList::receivingReferralList()
39 Foam::receivingReferralList::receivingReferralList
41 const label sourceProc,
42 const labelListList& refCellsToSendTo
45 labelListList(refCellsToSendTo),
46 sourceProc_(sourceProc)
50 Foam::receivingReferralList::receivingReferralList
52 const receivingReferralList& rL
56 sourceProc_(rL.sourceProc())
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 Foam::receivingReferralList::~receivingReferralList()
66 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
68 void Foam::receivingReferralList::operator=(const receivingReferralList& rhs)
70 // Check for assignment to self
75 "Foam::receivingReferralList::operator="
76 "(const Foam::receivingReferralList&)"
78 << "Attempted assignment to self"
82 labelListList::operator=(rhs);
84 sourceProc_ = rhs.sourceProc();
88 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
92 const Foam::receivingReferralList& a,
93 const Foam::receivingReferralList& b
96 // Trivial reject: lists are different size
97 if (a.size() != b.size())
102 // Or if source processors are not the same.
103 if (a.sourceProc() != b.sourceProc())
108 Foam::List<bool> fnd(a.size(), false);
112 Foam::labelList curLList = b[bI];
118 if (a[aI] == curLList)
132 // check if all LLists on a were marked
137 result = (result && fnd[aI]);
144 Foam::Istream& Foam::operator>>(Istream& is, receivingReferralList& rRL)
146 is >> rRL.sourceProc_ >> static_cast<labelListList&>(rRL);
150 "Istream& operator<<(Istream& f, const receivingReferralList& rRL"
157 Foam::Ostream& Foam::operator<<
160 const receivingReferralList& rRL
163 os << rRL.sourceProc() << token::SPACE
164 << static_cast< const labelListList& >(rRL);
168 "Ostream& operator<<(Ostream& f, const receivingReferralList& rRL"
175 // ************************************************************************* //