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 \*---------------------------------------------------------------------------*/
29 template<class graphType>
30 inline void Foam::subGraph<graphType>::checkIndex(const label i) const
32 if( (i < 0) || (i >= size_) )
36 "void Foam::subGraph<graphType>::"
37 "checkIndex(const label i) const"
38 ) << "Row index " << i
39 << " is not in range " << Foam::label(0)
40 << " and " << size_ << abort(FatalError);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 template<class graphType>
47 inline Foam::subGraph<graphType>::subGraph
60 template<class graphType>
61 inline Foam::subGraph<graphType>::subGraph
63 const subGraph<graphType>& ol
72 template<class graphType>
73 inline Foam::subGraph<graphType>::~subGraph()
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 template<class graphType>
81 inline Foam::label Foam::subGraph<graphType>::size() const
86 template<class graphType>
87 inline Foam::label Foam::subGraph<graphType>::sizeOfRow(const label rowI) const
89 return data_.sizeOfRow(start_+rowI);
92 template<class graphType>
93 inline void Foam::subGraph<graphType>::append(const label rowI, const label el)
95 data_.append(start_+rowI, el);
98 template<class graphType>
99 inline void Foam::subGraph<graphType>::appendIfNotIn
105 data_.appendIfNotIn(start_+rowI, el);
108 template<class graphType>
109 inline bool Foam::subGraph<graphType>::contains
115 return data_.contains(start_+rowI, e);
118 template<class graphType>
119 inline Foam::label Foam::subGraph<graphType>::containsAtPosition
125 return data_.containsAtPosition(start_+rowI, e);
128 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
130 template<class graphType>
131 inline Foam::label Foam::subGraph<graphType>::operator()
141 return data_(start_+i, j);
144 template<class graphType>
145 inline Foam::label& Foam::subGraph<graphType>::operator()
151 return data_(start_+i, j);
155 template<class graphType>
156 inline const Foam::graphRow<const graphType>
157 Foam::subGraph<graphType>::operator[]
162 return data_[start_+i];
165 template<class graphType>
166 inline Foam::graphRow<graphType>
167 Foam::subGraph<graphType>::operator[](const label i)
169 return data_[start_+i];
172 template<class graphType>
173 inline Foam::Ostream& operator<<
176 const Foam::subGraph<graphType>& sg
179 os << sg.size() << "\n" << "(";
180 for(Foam::label i=0;i<sg.size();++i)
182 os << "\n" << sg.sizeOfRow(i) << "(";
183 for(Foam::label j=0;j<sg.sizeOfRow(i);++j)
185 if( j > 0 ) os << " ";
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 } // End namespace Foam
202 // ************************************************************************* //