rowcol.hxx

来自「不错的国外的有限元程序代码,附带详细的manual,可以节省很多的底层工作.」· HXX 代码 · 共 69 行

HXX
69
字号
//   ************************
//   *** CLASS ROW-COLUMN ***
//   ************************


#ifndef rowcol_hxx
#define rowcol_hxx

#include "debug.def"
class FloatArray ; class IntArray ;


class RowColumn
/*
   This class implements a segment of a unsymmetric matrix stored in
   segmented form (skyline).
 DESCRIPTION :
   A row-column segment i contains the following items :
     - the i-th row of the lower half of the matrix ('row')
     - the i-th column of the upper part of the matrix ('column')
     - the i-th diagonal coefficient of the matrix ('diag').
   Since the profile of the matrix is supposed to be symmetric (but not
   its coeefficients), the row and the column have the same length.
   The row stores coefficients from left to right, the column from up to
   down ; both exclude the diagonal coefficient. Both start at the first
   non-zero coefficient, whose position is 'start'.
 TASKS :
   - storing and returning coefficents. For segment k :
     .any coefficient A(i,k) of the upper part of the matrix (i<k) is acces-
      sed through method 'atU(i)'. It belongs to the column of the segment ;
     .any coefficient A(k,i) of the lower part of the matrix (i<k) is acces-
      sed through method 'atL(i)'. It belongs to the row of the segment ;
     .the coefficient A(k,k) is obtained through method 'atDiag()' ;
   - enlarging itself in order to accomodate more coefficients (method
     'growTo') ;
   - resetting to zero all of its coefficients (method 'reinitialized').
*/
{
   protected :
      int        number ;
      int        start ;
      double*    row ;
      double*    column ;
      double     diag ;

   public :
      RowColumn (int,int) ;
      ~RowColumn () ;

#     ifdef DEBUG
	 double&  atU (int) ;
	 double&  atL (int) ;
#     else
	 double&  atU (int i)                    { return column[i-start] ;}
	 double&  atL (int i)                    { return row[i-start] ;}
#     endif
      double&     atDiag ()                      { return diag ;}
      void        checkBounds (int) ;
      void        checkSizeTowards (IntArray*) ;
      double      dot (FloatArray*,char,int,int) ;
      int         giveStart ()                   { return start ;}
      void        growTo (int) ;
      RowColumn*  reinitialized() ;
      void        printYourself () ;
} ;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?