sendingReferralList.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "sendingReferralList.H"
00028
00029
00030
00031 Foam::sendingReferralList::sendingReferralList()
00032 :
00033 labelList(),
00034 destinationProc_(-1)
00035 {}
00036
00037
00038 Foam::sendingReferralList::sendingReferralList
00039 (
00040 const label destinationProc,
00041 const labelList& cellsToSend
00042 )
00043 :
00044 labelList(cellsToSend),
00045 destinationProc_(destinationProc)
00046 {}
00047
00048
00049 Foam::sendingReferralList::sendingReferralList
00050 (
00051 const sendingReferralList& rL
00052 )
00053 :
00054 labelList(rL),
00055 destinationProc_(rL.destinationProc())
00056 {}
00057
00058
00059
00060
00061 Foam::sendingReferralList::~sendingReferralList()
00062 {}
00063
00064
00065
00066
00067 void Foam::sendingReferralList::operator=(const sendingReferralList& rhs)
00068 {
00069
00070 if (this == &rhs)
00071 {
00072 FatalErrorIn
00073 (
00074 "Foam::distribution::operator=(const Foam::distribution&)"
00075 )
00076 << "Attempted assignment to self"
00077 << abort(FatalError);
00078 }
00079
00080 labelList::operator=(rhs);
00081
00082 destinationProc_ = rhs.destinationProc();
00083 }
00084
00085
00086
00087
00088 bool operator==
00089 (
00090 const Foam::sendingReferralList& a,
00091 const Foam::sendingReferralList& b
00092 )
00093 {
00094
00095 if (a.size() != b.size())
00096 {
00097 return false;
00098 }
00099
00100
00101 if (a.destinationProc() != b.destinationProc())
00102 {
00103 return false;
00104 }
00105
00106 Foam::List<bool> fnd(a.size(), false);
00107
00108 forAll (b, bI)
00109 {
00110 Foam::label curLabel = b[bI];
00111
00112 bool found = false;
00113
00114 forAll (a, aI)
00115 {
00116 if (a[aI] == curLabel)
00117 {
00118 found = true;
00119 fnd[aI] = true;
00120 break;
00121 }
00122 }
00123
00124 if (!found)
00125 {
00126 return false;
00127 }
00128 }
00129
00130
00131 bool result = true;
00132
00133 forAll (fnd, aI)
00134 {
00135 result = (result && fnd[aI]);
00136 }
00137
00138 return result;
00139 }
00140
00141
00142 Foam::Istream& Foam::operator>>
00143 (
00144 Istream& is,
00145 sendingReferralList& sRL
00146 )
00147 {
00148 is >> sRL.destinationProc_ >> static_cast<labelList&>(sRL);
00149
00150 is.check("Istream& operator<<(Istream& f, const sendingReferralList& sRL");
00151
00152 return is;
00153 }
00154
00155
00156 Foam::Ostream& Foam::operator<<
00157 (
00158 Ostream& os,
00159 const sendingReferralList& rL
00160 )
00161 {
00162 os << rL.destinationProc() << token::SPACE
00163 << static_cast< const labelList& >(rL);
00164
00165 os.check("Ostream& operator<<(Ostream& f, const sendingReferralList& rL");
00166
00167 return os;
00168 }
00169
00170
00171
Copyright © 2000-2009 OpenCFD Ltd