1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 3 of the License, or (at your
14 option) any later version.
16 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 template<class T, Foam::label width>
27 void Foam::FRWGraph<T, width>::checkIndex(const label i, const label j) const
29 if( (i < 0) || (i >= nRows_) )
33 "void Foam::FRWGraph<T,width>::"
34 "checkIndex(const label i, const label j) const"
35 ) << "Row index " << i
36 << " is not in range " << 0
37 << " and " << nRows_ << abort(FatalError);
40 if( (j < 0) || (j >= width) )
43 "void Foam::FRWGraph<T,width>::"
44 "checkIndex(const label i, const label j) const"
45 ) << "Column index " << j
46 << " is not in range " << 0
47 << " and " << width << abort(FatalError);
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 template<class T, Foam::label width>
54 inline Foam::FRWGraph<T,width>::FRWGraph()
60 //- Construct given size
61 template<class T, Foam::label width>
62 inline Foam::FRWGraph<T,width>::FRWGraph
72 //- Construct given size
73 template<class T, Foam::label width>
74 inline Foam::FRWGraph<T,width>::FRWGraph
84 template<class T, Foam::label width>
85 inline Foam::FRWGraph<T,width>::FRWGraph
87 const FRWGraph<T,width>& ol
94 template<class T, Foam::label width>
95 inline Foam::FRWGraph<T,width>::~FRWGraph()
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 template<class T, Foam::label width>
102 inline Foam::label Foam::FRWGraph<T,width>::size() const
107 template<class T, Foam::label width>
108 inline Foam::label Foam::FRWGraph<T,width>::sizeOfRow(const label rowI) const
113 template<class T, Foam::label width>
114 inline void Foam::FRWGraph<T,width>::setSize(const label i)
116 data_.setSize(i * width);
120 template<class T, Foam::label width>
121 inline void Foam::FRWGraph<T,width>::clear()
127 template<class T, Foam::label width>
128 inline void Foam::FRWGraph<T,width>::appendFixedList
130 const FixedList<T, width>& l
134 data_.append(l[elI]);
138 template<class T, Foam::label width>
139 inline void Foam::FRWGraph<T,width>::setRow
142 const FixedList<T, width>& l
145 const label start = rowI * width;
147 data_[start+elI] = l[elI];
150 template<class T, Foam::label width>
151 inline bool Foam::FRWGraph<T,width>::contains
157 const label start = rowI * width;
158 for(register label i=0;i<width;++i)
159 if( data_[start+i] == e )
165 template<class T, Foam::label width>
166 inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
172 const label start = rowI * width;
173 for(register label i=0;i<width;++i)
174 if( data_[start+i] == e )
180 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
181 template<class T, Foam::label width>
182 inline const T& Foam::FRWGraph<T,width>::operator()
192 return data_[i * width + j];
195 template<class T, Foam::label width>
196 inline T& Foam::FRWGraph<T,width>::operator()
198 const label i, const label j
205 return data_[i * width + j];
208 template<class T, Foam::label width>
209 inline void Foam::FRWGraph<T,width>::operator=
211 const FRWGraph<T, width>& l
219 // ************************************************************************* //