1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 Foam::UPstream::commsStruct::commsStruct()
40 Foam::UPstream::commsStruct::commsStruct
43 const labelList& below,
44 const labelList& allBelow,
45 const labelList& allNotBelow
51 allNotBelow_(allNotBelow)
55 Foam::UPstream::commsStruct::commsStruct
60 const labelList& below,
61 const labelList& allBelow
67 allNotBelow_(nProcs - allBelow.size() - 1)
69 boolList inBelow(nProcs, false);
71 forAll(allBelow, belowI)
73 inBelow[allBelow[belowI]] = true;
77 forAll(inBelow, procI)
79 if ((procI != myProcID) && !inBelow[procI])
81 allNotBelow_[notI++] = procI;
84 if (notI != allNotBelow_.size())
86 FatalErrorIn("commsStruct") << "problem!" << Foam::abort(FatalError);
91 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
93 bool Foam::UPstream::commsStruct::operator==(const commsStruct& comm) const
97 (above_ == comm.above())
98 && (below_ == comm.below())
99 && (allBelow_ == allBelow())
100 && (allNotBelow_ == allNotBelow())
105 bool Foam::UPstream::commsStruct::operator!=(const commsStruct& comm) const
107 return !operator==(comm);
111 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
113 Foam::Ostream& Foam::operator<<(Ostream& os, const UPstream::commsStruct& comm)
115 os << comm.above_ << token::SPACE
116 << comm.below_ << token::SPACE
117 << comm.allBelow_ << token::SPACE
118 << comm.allNotBelow_;
122 "Ostream& operator<<(Ostream&, const commsStruct&)"
129 // ************************************************************************* //