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/>.
28 This class provides access to a row of a graph
33 \*---------------------------------------------------------------------------*/
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 template<class graphType> class subGraph;
49 template<class graphType>
50 Ostream& operator<<(Ostream&, const subGraph<graphType>&);
52 /*---------------------------------------------------------------------------*\
53 Class subGraph Declaration
54 \*---------------------------------------------------------------------------*/
56 template<class graphType>
60 //- reference to the graph
66 //- number of rows in the subGraph
69 // Private member functions
71 inline void checkIndex(const label i) const;
77 //- Construct from graph and start row and size
78 inline subGraph(graphType&, const label, const label);
81 inline subGraph(const subGraph<graphType>&);
89 //- Returns the number of rows
90 inline label size() const;
92 //- Returns the size of a given row
93 inline label sizeOfRow(const label rowI) const;
97 //- Append an element to the given row
98 inline void append(const label rowI, const label);
100 //- Append an element to the given row if it does not exist there
101 inline void appendIfNotIn(const label rowI, const label);
103 //- check if the element is in the given row (takes linear time)
104 inline bool contains(const label rowI, const label e) const;
105 inline label containsAtPosition(const label rowI, const label e) const;
107 //- set and get operators
108 inline label operator()(const label i, const label j) const;
109 inline label& operator()(const label i, const label j);
110 inline const graphRow<const graphType> operator[](const label) const;
111 inline graphRow<graphType> operator[](const label);
113 // IOstream operators
115 // Write subGraph to Ostream.
116 friend Ostream& operator<< <graphType>
119 const subGraph<graphType>&
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 } // End namespace Foam
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 #include "subGraphI.H"
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 // ************************************************************************* //