1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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"
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 sendingReferralList::sendingReferralList()
41 sendingReferralList::sendingReferralList
43 const label destinationProc,
44 const labelList& cellsToSend
47 labelList(cellsToSend),
48 destinationProc_(destinationProc)
52 sendingReferralList::sendingReferralList
54 const sendingReferralList& rL
58 destinationProc_(rL.destinationProc())
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
64 sendingReferralList::~sendingReferralList()
68 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
70 void sendingReferralList::operator=(const sendingReferralList& rhs)
72 // Check for assignment to self
77 "Foam::distribution::operator=(const Foam::distribution&)"
79 << "Attempted assignment to self"
83 labelList::operator=(rhs);
85 destinationProc_ = rhs.destinationProc();
89 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
93 const sendingReferralList& a,
94 const sendingReferralList& b
97 // Trivial reject: lists are different size
98 if (a.size() != b.size())
103 // Or if source processors are not the same.
104 if (a.destinationProc() != b.destinationProc())
109 List<bool> fnd(a.size(), false);
113 label curLabel = b[bI];
119 if (a[aI] == curLabel)
133 // check if all labels on a were marked
138 result = (result && fnd[aI]);
148 sendingReferralList& sRL
151 is >> sRL.destinationProc_ >> static_cast<labelList&>(sRL);
153 is.check("Istream& operator<<(Istream& f, const sendingReferralList& sRL");
162 const sendingReferralList& rL
165 os << rL.destinationProc() << token::SPACE
166 << static_cast< const labelList& >(rL);
168 os.check("Ostream& operator<<(Ostream& f, const sendingReferralList& rL");
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 } // End namespace Foam
178 // ************************************************************************* //