Correction to the compilation of mesquite-2.1.2. Bug fix contributed by Philippose...
[OpenFOAM-1.6-ext.git] / src / lduSolvers / crMatrix / crAddressing.H
blob1a30c27e9cb07e9be7784e3b1680fe8aab1ac755
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-6 H. Jasak All rights reserved
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     crAddressing
28 Description
29     Compressed row matrix addressing
31 Author
32     Hrvoje Jasak, Wikki Ltd.  All rights reserved
34 SourceFiles
35     crAddressing.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef crAddressing_H
40 #define crAddressing_H
42 #include "labelList.H"
43 #include "refCount.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                         Class crAddressing Declaration
52 \*---------------------------------------------------------------------------*/
54 class crAddressing
56     public refCount
58     // Private data
60         //- Number of rows
61         label nRows_;
63         //- Number of columns
64         label nCols_;
66         //- Row array.
67         //  Provides start index for each row, dimensioned to nRows + 1
68         labelList row_;
70         //- Column array
71         labelList col_;
73     // Private Member Functions
75         //- Set row count
76         void setRowCount(const labelList& count);
79 public:
81     // Constructors
83         //- Construct given size.  Column and coefficients set later
84         crAddressing
85         (
86             const label nRows,
87             const label nCols,
88             const labelList& count
89         );
91         //- Construct from components
92         crAddressing
93         (
94             const label nRows,
95             const label nCols,
96             const labelList& row,
97             const labelList& col
98         );
100         //- Construct as copy
101         crAddressing(const crAddressing&);
103         //- Construct from Istream
104         crAddressing(Istream&);
107     // Destructor - default
110     // Member Functions
112         // Access
114             //- Return number of rows
115             label nRows() const
116             {
117                 return nRows_;
118             }
120             //- Return number of columns
121             label nCols() const
122             {
123                 return nCols_;
124             }
126             //- Return number of coefficients
127             label nEntries() const
128             {
129                 return col_.size();
130             }
132             //- Return row array
133             const labelList& row() const
134             {
135                 return row_;
136             }
138             //- Return column array
139             const labelList& col() const
140             {
141                 return col_;
142             }
145         // Edit
147             //- Return column array
148             labelList& col()
149             {
150                 return col_;
151             }
154         // Operations
156             //- Return transpose addressing
157             tmp<crAddressing> T() const;
160     // Member Operators
162         void operator=(const crAddressing&);
164     // IOstream Operators
166         friend Ostream& operator<<(Ostream&, const crAddressing&);
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #endif
178 // ************************************************************************* //