MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FastMatrixElim.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 class FastMatrixElim: public SparseMatrix< double >
11 {
12  public:
14  FastMatrixElim( unsigned int nrows, unsigned int ncolumns );
16 
17  void makeTestMatrix( const double* test, unsigned int numCompts );
18 
36  void buildForwardElim( vector< unsigned int >& diag,
37  vector< Triplet< double > >& fops );
43  void buildBackwardSub( vector< unsigned int >& diag,
44  vector< Triplet< double > >& bops, vector< double >& diagVal );
46  // Here we do stuff to set up the Hines ordering of the matrix.
48 
55  bool hinesReorder( const vector< unsigned int >& parentVoxel,
56  vector< unsigned int >& lookupOldRowsFromNew );
57 
62  static void opsReorder(
63  const vector< unsigned int >& lookupOldRowsFromNew,
64  vector< Triplet< double > >& ops,
65  vector< double >& diagVal );
66 
73  void shuffleRows(
74  const vector< unsigned int >& lookupOldRowFromNew );
75 
80  bool checkSymmetricShape() const;
81 
82  bool operator==( const FastMatrixElim& other ) const;
83  bool isSymmetric() const;
84 
90  const vector< unsigned int >& parentVoxel,
91  double diffConst, double motorConst, double dt );
92 
97  bool buildForDiffusion(
98  const vector< unsigned int >& parentVoxel,
99  const vector< double >& volume,
100  const vector< double >& area,
101  const vector< double >& length,
102  double diffConst, double motorConst, double dt );
103 
109  static void advance( vector< double >& y,
110  const vector< Triplet< double > >& ops, //has both fops and bops
111  const vector< double >& diagVal );
112 };
113 
114 void sortByColumn(
115  vector< unsigned int >& col, vector< double >& entry );
116 
117 // Todo: Maintain an internal vector of the mapping between rows so that
118 // the output vector can be updated in the right order, and input values
119 // can be mapped if matrix reassignment happens.
120 // The input to the parent class should just be a matrix with diameter
121 // and connectivity info, and then the system spawns out the ops
122 // vector depending on diffusion constant.
void buildBackwardSub(vector< unsigned int > &diag, vector< Triplet< double > > &bops, vector< double > &diagVal)
static void advance(vector< double > &y, const vector< Triplet< double > > &ops, const vector< double > &diagVal)
bool hinesReorder(const vector< unsigned int > &parentVoxel, vector< unsigned int > &lookupOldRowsFromNew)
void shuffleRows(const vector< unsigned int > &lookupOldRowFromNew)
bool operator==(const FastMatrixElim &other) const
static void opsReorder(const vector< unsigned int > &lookupOldRowsFromNew, vector< Triplet< double > > &ops, vector< double > &diagVal)
bool checkSymmetricShape() const
void makeTestMatrix(const double *test, unsigned int numCompts)
void sortByColumn(vector< unsigned int > &col, vector< double > &entry)
void setDiffusionAndTransport(const vector< unsigned int > &parentVoxel, double diffConst, double motorConst, double dt)
bool buildForDiffusion(const vector< unsigned int > &parentVoxel, const vector< double > &volume, const vector< double > &area, const vector< double > &length, double diffConst, double motorConst, double dt)
This function makes the diffusion matrix.
bool isSymmetric() const
void buildForwardElim(vector< unsigned int > &diag, vector< Triplet< double > > &fops)