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
00028
00029 template<class T>
00030 inline Foam::CompactListList<T>::CompactListList()
00031 {}
00032
00033
00034 template<class T>
00035 inline Foam::CompactListList<T>::CompactListList
00036 (
00037 const label nRows,
00038 const label nData
00039 )
00040 :
00041 offsets_(nRows, 0),
00042 m_(nData)
00043 {}
00044
00045
00046 template<class T>
00047 inline Foam::CompactListList<T>::CompactListList
00048 (
00049 const label nRows,
00050 const label nData,
00051 const T& t
00052 )
00053 :
00054 offsets_(nRows, 0),
00055 m_(nData, t)
00056 {}
00057
00058
00059 template<class T>
00060 inline Foam::autoPtr<Foam::CompactListList<T> >
00061 Foam::CompactListList<T>::clone() const
00062 {
00063 return autoPtr<CompactListList<T> >(new CompactListList<T>(*this));
00064 }
00065
00066
00067
00068
00069 template<class T>
00070 inline const Foam::CompactListList<T>& Foam::CompactListList<T>::null()
00071 {
00072 return *reinterpret_cast< CompactListList<T>* >(0);
00073 }
00074
00075
00076 template<class T>
00077 inline Foam::label Foam::CompactListList<T>::size() const
00078 {
00079 return offsets_.size();
00080 }
00081
00082
00083 template<class T>
00084 inline bool Foam::CompactListList<T>::empty() const
00085 {
00086 return offsets_.empty();
00087 }
00088
00089
00090 template<class T>
00091 inline const Foam::List<Foam::label>& Foam::CompactListList<T>::offsets() const
00092 {
00093 return offsets_;
00094 }
00095
00096
00097 template<class T>
00098 inline Foam::List<Foam::label>& Foam::CompactListList<T>::offsets()
00099 {
00100 return offsets_;
00101 }
00102
00103
00104 template<class T>
00105 inline const Foam::List<T>& Foam::CompactListList<T>::m() const
00106 {
00107 return m_;
00108 }
00109
00110
00111 template<class T>
00112 inline Foam::List<T>& Foam::CompactListList<T>::m()
00113 {
00114 return m_;
00115 }
00116
00117
00118 template<class T>
00119 inline Foam::label Foam::CompactListList<T>::index
00120 (
00121 const label i,
00122 const label j
00123 ) const
00124 {
00125 if (i == 0)
00126 {
00127 return j;
00128 }
00129 else
00130 {
00131 return offsets_[i-1] + j;
00132 }
00133 }
00134
00135
00136 template<class T>
00137 inline Foam::label Foam::CompactListList<T>::whichRow(const label i) const
00138 {
00139 if (i < 0 || i >= m_.size())
00140 {
00141 FatalErrorIn
00142 (
00143 "CompactListList<T>::whichRow(const label) const"
00144 ) << "Index " << i << " outside 0.." << m_.size()
00145 << abort(FatalError);
00146 }
00147
00148 forAll(offsets_, rowI)
00149 {
00150 if (i < offsets_[rowI])
00151 {
00152 return rowI;
00153 }
00154 }
00155
00156 return -1;
00157 }
00158
00159
00160 template<class T>
00161 inline Foam::label Foam::CompactListList<T>::whichColumn
00162 (
00163 const label row,
00164 const label i
00165 ) const
00166 {
00167 return i - index(row, 0);
00168 }
00169
00170
00171 template<class T>
00172 inline Foam::Xfer<Foam::CompactListList<T> > Foam::CompactListList<T>::xfer()
00173 {
00174 return xferMove(*this);
00175 }
00176
00177
00178 template<class T>
00179 inline void Foam::CompactListList<T>::resize(const label nRows)
00180 {
00181 this->setSize(nRows);
00182 }
00183
00184
00185 template<class T>
00186 inline void Foam::CompactListList<T>::resize
00187 (
00188 const label nRows,
00189 const label nData
00190 )
00191 {
00192 this->setSize(nRows, nData);
00193 }
00194
00195
00196 template<class T>
00197 inline void Foam::CompactListList<T>::resize
00198 (
00199 const label nRows,
00200 const label nData,
00201 const T& t
00202 )
00203 {
00204 this->setSize(nRows, nData, t);
00205 }
00206
00207
00208 template<class T>
00209 inline void Foam::CompactListList<T>::resize(const UList<label>& rowSizes)
00210 {
00211 this->setSize(rowSizes);
00212 }
00213
00214
00215
00216
00217 template<class T>
00218 inline Foam::UList<T> Foam::CompactListList<T>::operator[]
00219 (
00220 const label i
00221 )
00222 {
00223 if (i == 0)
00224 {
00225 return UList<T>(m_.begin(), offsets_[i]);
00226 }
00227 else
00228 {
00229 return UList<T>(&m_[offsets_[i-1]], offsets_[i] - offsets_[i-1]);
00230 }
00231 }
00232
00233
00234 template<class T>
00235 inline const Foam::UList<T> Foam::CompactListList<T>::operator[]
00236 (
00237 const label i
00238 ) const
00239 {
00240 if (i == 0)
00241 {
00242 return UList<T>(m_.begin(), offsets_[i]);
00243 }
00244 else
00245 {
00246 return UList<T>(&m_[offsets_[i-1]], offsets_[i] - offsets_[i-1]);
00247 }
00248 }
00249
00250
00251 template<class T>
00252 inline T& Foam::CompactListList<T>::operator()
00253 (
00254 const label i,
00255 const label j
00256 )
00257 {
00258 return m_[index(i, j)];
00259 }
00260
00261
00262 template<class T>
00263 inline const T& Foam::CompactListList<T>::operator()
00264 (
00265 const label i,
00266 const label j
00267 ) const
00268 {
00269 return m_[index(i, j)];
00270 }
00271
00272
00273 template<class T>
00274 inline void Foam::CompactListList<T>::operator=(const T& t)
00275 {
00276 m_ = t;
00277 }
00278
00279
00280