Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFEMItpackSparseMatrix.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFEMItpackSparseMatrix.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/06/03 18:56:06 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkItpackSparseMatrix_h
00019 #define __itkItpackSparseMatrix_h
00020 
00021 #include "itpack_f2c.h"
00022 #include "itpack.h"
00023 #include "itkFEMException.h"
00024 #include <vector>
00025 
00026 
00027 namespace itk {
00028 namespace fem {
00029 
00037 // Forward declaration of friend class
00038 class ItpackLinearSystemWrapper;
00039   
00040 class ItpackSparseMatrix
00041 {
00042 public:
00043 
00045   typedef itpack::integer integer;
00046 
00048   typedef itpack::doublereal doublereal;
00049 
00051   ItpackSparseMatrix();
00052   
00057   ItpackSparseMatrix(integer order);
00058 
00059 
00066   ItpackSparseMatrix(integer order, integer maxNonZeroValues);
00067 
00071   ~ItpackSparseMatrix();
00072 
00078   void SetOrder(integer order) { m_N = order; } 
00079 
00085   void SetMaxNonZeroValues(integer maxNonZeroValues) { m_NZ = maxNonZeroValues; }
00086 
00093   void Set(integer i, integer j, doublereal value);
00094 
00101   void Add(integer i, integer j, doublereal value);
00102 
00107   doublereal Get(integer i, integer j);
00108 
00112   integer*    GetN()   { return &m_N; }
00113 
00117   integer*     GetIA();
00118 
00125   void  SetCompressedRow(integer *ia, integer *ja, doublereal *a);
00129   integer*     GetJA();
00130 
00134   doublereal*  GetA();
00135 
00139   doublereal* GetValueArray()       { return GetA();  }
00140 
00144   integer*    GetColumnArray()      { return GetJA(); }
00145 
00149   integer*    GetRowArray()         { return GetIA(); }
00150 
00154   integer     GetOrder()       const     { return m_N; }
00155 
00159   integer     GetMaxNonZeroValues() const { return m_NZ; }
00160 
00164   void Clear();
00165 
00169   void mult(doublereal* vector, doublereal* result);
00170 
00174   void mult(ItpackSparseMatrix* rightMatrix, ItpackSparseMatrix* resultMatrix);
00175 
00177   void PrintCompressedRow();
00178 
00179 private:
00180 
00182   friend class LinearSystemWrapperItpack;
00183 
00185   void Initialize();
00186 
00188   void UnFinalize();
00189 
00191   void Finalize();
00192 
00193 
00194 
00196   integer m_MatrixFinalized;
00197 
00199   integer m_MatrixInitialized;
00200   
00202   integer m_N;
00203 
00205   integer m_NZ;
00206 
00208   integer *m_IA;
00209 
00211   integer *m_JA;
00212 
00214   doublereal *m_A;
00215 
00217   integer *m_IWORK;
00218 
00225   integer m_MODE;
00226 
00228   integer m_NOUT;
00229   
00237   integer m_LEVEL;
00238 
00246   //integer m_IER;
00247 };
00248 
00255 class FEMExceptionItpackSparseMatrixSbagn : public FEMException
00256 {
00257 public:
00263   FEMExceptionItpackSparseMatrixSbagn(const char *file, unsigned int lineNumber, std::string location, itpack::integer errorCode);
00264  
00266   virtual ~FEMExceptionItpackSparseMatrixSbagn() throw() {}
00267   
00269   itkTypeMacro(FEMExceptionItpackSparseMatrixSbagn,FEMException);
00270   
00271 };
00272 
00279 class FEMExceptionItpackSparseMatrixSbsij : public FEMException
00280 {
00281 public:
00287   FEMExceptionItpackSparseMatrixSbsij(const char *file, unsigned int lineNumber, std::string location, itpack::integer errorCode);
00288  
00290   virtual ~FEMExceptionItpackSparseMatrixSbsij() throw() {}
00291   
00293   itkTypeMacro(FEMExceptionItpackSparseMatrixSbsij,FEMException);
00294   
00295 };
00296 
00297 }} // end namespace itk::fem
00298 
00299 #endif
00300 

Generated at Fri May 21 01:14:45 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000