1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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 template<class T, class Container>
32 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev()
38 template<class T, class Container>
39 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
51 template<class T, class Container>
52 inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
65 template<class T, class Container>
66 inline Foam::autoPtr<Foam::CompactListList_dev<T, Container> >
67 Foam::CompactListList_dev<T, Container>::clone() const
69 return autoPtr<CompactListList_dev<T, Container> >
71 new CompactListList_dev<T, Container>(*this)
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 template<class T, class Container>
79 inline const Foam::CompactListList_dev<T, Container>&
80 Foam::CompactListList_dev<T, Container>::null()
82 return *reinterpret_cast< CompactListList_dev<T, Container>* >(0);
86 template<class T, class Container>
87 inline Foam::label Foam::CompactListList_dev<T, Container>::size() const
93 template<class T, class Container>
94 inline bool Foam::CompactListList_dev<T, Container>::empty() const
100 template<class T, class Container>
101 inline const Foam::List<Foam::label>&
102 Foam::CompactListList_dev<T, Container>::offsets() const
108 template<class T, class Container>
109 inline Foam::List<Foam::label>& Foam::CompactListList_dev<T, Container>::offsets()
115 template<class T, class Container>
116 inline const Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
123 template<class T, class Container>
124 inline Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
130 template<class T, class Container>
131 inline Foam::label Foam::CompactListList_dev<T, Container>::index
137 return offsets_[i] + j;
141 template<class T, class Container>
142 inline Foam::label Foam::CompactListList_dev<T, Container>::whichRow(const label i)
145 if (i < 0 || i >= m_.size())
149 "CompactListList_dev<T, Container>::whichRow(const label) const"
150 ) << "Index " << i << " outside 0.." << m_.size()
151 << abort(FatalError);
154 return findLower(offsets_, i+1);
158 template<class T, class Container>
159 inline Foam::label Foam::CompactListList_dev<T, Container>::whichColumn
165 return i - index(row, 0);
169 template<class T, class Container>
170 inline Foam::Xfer<Foam::CompactListList_dev<T, Container> >
171 Foam::CompactListList_dev<T, Container>::xfer()
173 return xferMove(*this);
177 template<class T, class Container>
178 inline void Foam::CompactListList_dev<T, Container>::resize(const label nRows)
180 this->setSize(nRows);
184 template<class T, class Container>
185 inline void Foam::CompactListList_dev<T, Container>::resize
191 this->setSize(nRows, nData);
195 template<class T, class Container>
196 inline void Foam::CompactListList_dev<T, Container>::resize
203 this->setSize(nRows, nData, t);
207 template<class T, class Container>
208 inline void Foam::CompactListList_dev<T, Container>::resize
210 const UList<label>& rowSizes
213 this->setSize(rowSizes);
217 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
219 template<class T, class Container>
220 inline Foam::UList<T> Foam::CompactListList_dev<T, Container>::operator[]
225 label start = offsets_[i];
226 return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
230 template<class T, class Container>
231 inline const Foam::UList<T>
232 Foam::CompactListList_dev<T, Container>::operator[]
237 label start = offsets_[i];
240 (m_.size() ? const_cast<T*>(&m_[start]) : NULL),
241 offsets_[i+1] - start
246 template<class T, class Container>
247 inline T& Foam::CompactListList_dev<T, Container>::operator()
253 return m_[index(i, j)];
257 template<class T, class Container>
258 inline const T& Foam::CompactListList_dev<T, Container>::operator()
264 return m_[index(i, j)];
268 template<class T, class Container>
269 inline void Foam::CompactListList_dev<T, Container>::operator=(const T& t)
275 // ************************************************************************* //