ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkFEMItpackSparseMatrix.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkFEMItpackSparseMatrix_h
20 #define __itkFEMItpackSparseMatrix_h
21 
22 #include "itkFEMException.h"
23 
24 namespace itk
25 {
26 namespace fem
27 {
36 // Forward declaration of friend class
37 class ItpackLinearSystemWrapper;
38 
40 {
41 public:
42 
44  typedef long integer;
45  typedef double doublereal;
46 
49 
55 
62  ItpackSparseMatrix(integer order, integer maxNonZeroValues);
63 
68 
74  void SetOrder(integer order)
75  {
76  m_N = order;
77  }
78 
84  void SetMaxNonZeroValues(integer maxNonZeroValues)
85  {
86  m_NZ = maxNonZeroValues;
87  }
88 
95  void Set(integer i, integer j, doublereal value);
96 
103  void Add(integer i, integer j, doublereal value);
104 
110 
115  {
116  return &m_N;
117  }
118 
122  integer * GetIA();
123 
130  void SetCompressedRow(integer *ia, integer *ja, doublereal *a);
131 
135  integer * GetJA();
136 
140  doublereal * GetA();
141 
146  {
147  return GetA();
148  }
149 
154  {
155  return GetJA();
156  }
157 
162  {
163  return GetIA();
164  }
165 
170  {
171  return m_N;
172  }
173 
178  {
179  return m_NZ;
180  }
181 
185  void Clear();
186 
190  void mult(doublereal *vector, doublereal *result);
191 
195  void mult(ItpackSparseMatrix *rightMatrix, ItpackSparseMatrix *resultMatrix);
196 
198  void PrintCompressedRow();
199 
200 private:
201 
204 
206  void Initialize();
207 
209  void UnFinalize();
210 
212  void Finalize();
213 
216 
219 
222 
225 
228 
231 
234 
237 
245 
248 
257 
265  // integer m_IER;
266 };
267 
276 {
277 public:
278 
280  typedef long integer;
281  typedef double doublereal;
282 
288  FEMExceptionItpackSparseMatrixSbagn(const char *file, unsigned int lineNumber, std::string location,
289  integer errorCode);
290 
293  throw ( )
294  {
295  }
296 
299 };
300 
309 {
310 public:
311 
313  typedef long integer;
314  typedef double doublereal;
315 
321  FEMExceptionItpackSparseMatrixSbsij(const char *file, unsigned int lineNumber, std::string location,
322  integer errorCode);
323 
326  throw ( )
327  {
328  }
329 
332 };
333 }
334 } // end namespace itk::fem
335 
336 #endif
337