00001 /********************************************************************** 00002 ** This program is part of 'MOOSE', the 00003 ** Messaging Object Oriented Simulation Environment. 00004 ** Copyright (C) 2011 Upinder S. Bhalla. and NCBS 00005 ** It is made available under the terms of the 00006 ** GNU Lesser General Public License version 2.1 00007 ** See the file COPYING.LIB for the full notice. 00008 **********************************************************************/ 00009 00010 #ifndef _MESH_COMPT_H 00011 #define _MESH_COMPT_H 00012 00020 class MeshCompt: public ChemCompt 00021 { 00022 public: 00023 MeshCompt(); 00024 ~MeshCompt(); 00025 00027 00031 double extendedMeshEntryVolume( unsigned int fid ) const; 00032 00034 void clearExtendedMeshEntryVolume(); 00035 00037 void innerResetStencil(); 00038 00041 unsigned int getStencilRow( unsigned int meshIndex, 00042 const double** entry, const unsigned int** colIndex ) const; 00043 00045 const SparseMatrix< double >& getStencil() const; 00046 00048 vector< unsigned int > getNeighbors( unsigned int fid ) const; 00049 00054 vector< double > innerGetStencilRate( unsigned int row ) const; 00055 00056 void addRow( unsigned int index, const vector< double >& entry, 00057 const vector< unsigned int >& colIndex ); 00058 00059 void setStencilSize( unsigned int numRows, unsigned int numCols ); 00060 00062 00064 void extendStencil( 00065 const ChemCompt* other, const vector< VoxelJunction >& vj ); 00066 00067 virtual vector< unsigned int > getParentVoxel() const = 0; 00068 virtual const vector< double >& getVoxelArea() const = 0; 00069 virtual const vector< double >& getVoxelLength() const = 0; 00070 00071 private: 00072 00074 SparseMatrix< double > coreStencil_; 00075 00077 SparseMatrix< double > m_; 00078 00085 vector< double > extendedMeshEntryVolume_; 00086 }; 00087 00088 // Helper class for setting up and sorting rows of matrix entries. 00089 class Ecol { 00090 public: 00091 Ecol( double e, unsigned int col ) 00092 : e_( e ), col_( col ) 00093 {;} 00094 00095 Ecol() 00096 : e_( 0 ), col_( 0 ) 00097 {;} 00098 00099 bool operator<( const Ecol& other ) const 00100 { 00101 return col_ < other.col_; 00102 } 00103 00104 double e_; 00105 double col_; 00106 }; 00107 00108 #endif // _MESH_COMPT_H