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::graphRow<graphType>::checkIndex(const label i) const
32 if( (i < 0) || (i >=data_.sizeOfRow(rowI_)) )
36 "void Foam::graphRow<graphType>::"
37 "checkIndex(const label i) const"
38 ) << "Row index " << rowI_
39 << " is not in range " << Foam::label(0)
40 << " and " << data_.sizeOfRow(rowI_) << abort(FatalError);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 template<class graphType>
47 inline Foam::graphRow<graphType>::graphRow(graphType& g, const label i)
54 template<class graphType>
55 inline Foam::graphRow<graphType>::graphRow
57 const graphRow<graphType>& ol
65 template<class graphType>
66 inline Foam::graphRow<graphType>::~graphRow()
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 template<class graphType>
74 inline Foam::label Foam::graphRow<graphType>::size() const
76 return data_.sizeOfRow(rowI_);
79 template<class graphType>
80 inline void Foam::graphRow<graphType>::setSize(const label s)
82 data_.setRowSize(rowI_, s);
85 template<class graphType>
86 inline void Foam::graphRow<graphType>::clear()
88 data_.setRowSize(rowI_, 0);
91 template<class graphType>
92 inline void Foam::graphRow<graphType>::append(const label el)
94 data_.append(rowI_, el);
97 template<class graphType>
98 inline void Foam::graphRow<graphType>::appendIfNotIn(const label el)
100 data_.appendIfNotIn(rowI_, el);
103 template<class graphType>
104 inline bool Foam::graphRow<graphType>::contains(const label e) const
106 return data_.contains(rowI_, e);
109 template<class graphType>
110 inline Foam::label Foam::graphRow<graphType>::containsAtPosition
115 return data_.containsAtPosition(rowI_, e);
118 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
120 template<class graphType>
121 inline Foam::label Foam::graphRow<graphType>::operator[](const label i) const
123 return data_(rowI_, i);
126 template<class graphType>
127 inline Foam::label& Foam::graphRow<graphType>::operator[](const label i)
129 return data_(rowI_, i);
132 template<class graphType>
133 inline void Foam::graphRow<graphType>::operator=
135 const graphRow<graphType>& l
138 data_.setRowSize(rowI_, l.size());
139 for(label i=0;i<l.size();++i)
140 data_(rowI_, i) = l[i];
143 template<class graphType>
144 template<class listType>
145 inline void Foam::graphRow<graphType>::operator=(const listType& l)
147 data_.setRowSize(rowI_, l.size());
148 for(label i=0;i<l.size();++i)
149 data_(rowI_, i) = l[i];
152 template<class graphType>
153 inline Foam::Ostream& operator<<
156 const Foam::graphRow<graphType>& r
159 os << r.size() << "(";
160 for(Foam::label i=0;i<r.size();++i)
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 } // End namespace Foam
171 // ************************************************************************* //