hbio.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2010 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 #ifndef HBIO_HPP
44 #define HBIO_HPP 1
45 
46 
47 #include <cstdlib>
48 #include <iostream>
49 #include "error.hpp"
50 #include "mvector.hpp"
51 #include "ccolmatrix.hpp"
52 
53 
66 class HBIO {
67  std::string filename;
68  std::string title;
69  std::string key;
70  int valacc;
71  int rhsacc;
72 
73  CColMatrix mat;
74  Vector rhs;
75  Vector sol;
76 
77 public:
78 
81  HBIO();
82 
85  void write( const std::string filename ) const;
86 
89  void read( const std::string filename );
90 
93  const std::string get_title( void ) const;
94 
97  void set_title( const std::string ttitle );
98 
101  const std::string get_key( void ) const;
102 
105  void set_key( const std::string kkey );
106 
109  int get_valacc( void ) const;
110 
113  void set_valacc( int vvalacc );
114 
117  int get_rhsacc( void ) const;
118 
121  void set_rhsacc( int rrhsacc );
122 
125  void get_matrix( CColMatrix &mmat ) const;
126 
129  void set_matrix( const CColMatrix &mmat );
130 
133  void get_rhs_vector( Vector &rrhs ) const;
134 
137  void set_rhs_vector( const Vector &rrhs );
138 
141  void get_solution_vector( Vector &ssol ) const;
142 
145  void set_solution_vector( const Vector &ssol );
146 };
147 
148 
149 inline HBIO::HBIO()
150 {
151  valacc = 8;
152  rhsacc = 8;
153 }
154 
155 
156 inline const std::string HBIO::get_title( void ) const
157 {
158  return( title );
159 }
160 
161 
162 inline void HBIO::set_title( const std::string ttitle )
163 {
164  title = ttitle;
165 }
166 
167 
168 inline const std::string HBIO::get_key( void ) const
169 {
170  return( key );
171 }
172 
173 
174 inline void HBIO::set_key( const std::string kkey )
175 {
176  key = kkey;
177 }
178 
179 
180 inline int HBIO::get_valacc( void ) const
181 {
182  return( valacc );
183 }
184 
185 
186 inline void HBIO::set_valacc( int vvalacc )
187 {
188  valacc = vvalacc;
189 }
190 
191 
192 inline int HBIO::get_rhsacc( void ) const
193 {
194  return( rhsacc );
195 }
196 
197 
198 inline void HBIO::set_rhsacc( int rrhsacc )
199 {
200  rhsacc = rrhsacc;
201 }
202 
203 
204 
205 
206 #endif
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
224 
225 
226 
void read(const std::string filename)
Dense math vector class.
Definition: mvector.hpp:68
int get_valacc(void) const
Definition: hbio.hpp:180
void set_matrix(const CColMatrix &mmat)
void get_solution_vector(Vector &ssol) const
void get_rhs_vector(Vector &rrhs) const
HBIO()
Constructor.
Definition: hbio.hpp:149
const std::string get_title(void) const
Definition: hbio.hpp:156
void set_rhsacc(int rrhsacc)
Definition: hbio.hpp:198
void set_key(const std::string kkey)
Definition: hbio.hpp:174
int get_rhsacc(void) const
Definition: hbio.hpp:192
const std::string get_key(void) const
Definition: hbio.hpp:168
void set_solution_vector(const Vector &ssol)
void get_matrix(CColMatrix &mmat) const
Error classes and handling
void write(const std::string filename) const
Harwell Boeing sparse matrix file format I/O class.
Definition: hbio.hpp:66
void set_valacc(int vvalacc)
Definition: hbio.hpp:186
Compressed column sparse matrix algebra.
void set_rhs_vector(const Vector &rrhs)
N-dimensional vector.
void set_title(const std::string ttitle)
Definition: hbio.hpp:162
Compressed column sparse matrix class.
Definition: ccolmatrix.hpp:75