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 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 template<class T, class Container>
33 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev()
39 template<class T, class Container>
40 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
52 template<class T, class Container>
53 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
66 template<class T, class Container>
67 inline Foam::autoPtr<Foam::CompactListList_dev<T, Container> >
68 Foam::CompactListList_dev<T, Container>::clone() const
70 return autoPtr<CompactListList_dev<T, Container> >
72 new CompactListList_dev<T, Container>(*this)
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 template<class T, class Container>
80 inline const Foam::CompactListList_dev<T, Container>&
81 Foam::CompactListList_dev<T, Container>::null()
83 return *reinterpret_cast< CompactListList_dev<T, Container>* >(0);
87 template<class T, class Container>
88 inline Foam::label Foam::CompactListList_dev<T, Container>::size() const
94 template<class T, class Container>
95 inline bool Foam::CompactListList_dev<T, Container>::empty() const
101 template<class T, class Container>
102 inline const Foam::List<Foam::label>&
103 Foam::CompactListList_dev<T, Container>::offsets() const
109 template<class T, class Container>
110 inline Foam::List<Foam::label>& Foam::CompactListList_dev<T, Container>::offsets()
116 template<class T, class Container>
117 inline const Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
124 template<class T, class Container>
125 inline Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
131 template<class T, class Container>
132 inline Foam::label Foam::CompactListList_dev<T, Container>::index
138 return offsets_[i] + j;
142 template<class T, class Container>
143 inline Foam::label Foam::CompactListList_dev<T, Container>::whichRow(const label i)
146 if (i < 0 || i >= m_.size())
150 "CompactListList_dev<T, Container>::whichRow(const label) const"
151 ) << "Index " << i << " outside 0.." << m_.size()
152 << abort(FatalError);
155 return findLower(offsets_, i+1);
159 template<class T, class Container>
160 inline Foam::label Foam::CompactListList_dev<T, Container>::whichColumn
166 return i - index(row, 0);
170 template<class T, class Container>
171 inline Foam::Xfer<Foam::CompactListList_dev<T, Container> >
172 Foam::CompactListList_dev<T, Container>::xfer()
174 return xferMove(*this);
178 template<class T, class Container>
179 inline void Foam::CompactListList_dev<T, Container>::resize(const label nRows)
181 this->setSize(nRows);
185 template<class T, class Container>
186 inline void Foam::CompactListList_dev<T, Container>::resize
192 this->setSize(nRows, nData);
196 template<class T, class Container>
197 inline void Foam::CompactListList_dev<T, Container>::resize
204 this->setSize(nRows, nData, t);
208 template<class T, class Container>
209 inline void Foam::CompactListList_dev<T, Container>::resize
211 const UList<label>& rowSizes
214 this->setSize(rowSizes);
218 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
220 template<class T, class Container>
221 inline Foam::UList<T> Foam::CompactListList_dev<T, Container>::operator[]
226 label start = offsets_[i];
227 return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
231 template<class T, class Container>
232 inline const Foam::UList<T>
233 Foam::CompactListList_dev<T, Container>::operator[]
238 label start = offsets_[i];
241 (m_.size() ? const_cast<T*>(&m_[start]) : NULL),
242 offsets_[i+1] - start
247 template<class T, class Container>
248 inline T& Foam::CompactListList_dev<T, Container>::operator()
254 return m_[index(i, j)];
258 template<class T, class Container>
259 inline const T& Foam::CompactListList_dev<T, Container>::operator()
265 return m_[index(i, j)];
269 template<class T, class Container>
270 inline void Foam::CompactListList_dev<T, Container>::operator=(const T& t)
276 // ************************************************************************* //