00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _CHEM_COMPT_H
00011 #define _CHEM_COMPT_H
00012
00013 #include "VoxelJunction.h"
00014
00023 class ChemCompt
00024 {
00025 public:
00026 ChemCompt();
00027 virtual ~ChemCompt();
00029
00031
00036 double getEntireVolume( const Eref& e ) const;
00037
00038
00039 virtual double vGetEntireVolume() const = 0;
00040
00047 void setEntireVolume( const Eref& e, double volume);
00048
00052 double getOneVoxelVolume( const Eref& e, unsigned int voxel ) const;
00053 void setOneVoxelVolume( const Eref& e, unsigned int voxel,
00054 double volume );
00055
00060 unsigned int getDimensions() const;
00061 virtual unsigned int innerGetDimensions() const = 0;
00062
00069 void setMethod( string method );
00070 string getMethod() const;
00071
00076 vector< double > getStencilRate( unsigned int row ) const;
00077
00079 virtual vector< double > innerGetStencilRate( unsigned int row ) const = 0;
00080
00086 vector< unsigned int > getStencilIndex( unsigned int row ) const;
00087
00089 vector< double > getVoxelVolume() const;
00091 virtual const vector< double >& vGetVoxelVolume() const = 0;
00092
00094 vector< double > getVoxelMidpoint() const;
00096 virtual const vector< double >& vGetVoxelMidpoint() const = 0;
00097
00099
00101
00111 void setVolumeNotRates( double volume);
00112
00114 virtual bool vSetVolumeNotRates( double volume) = 0;
00115
00123 void buildDefaultMesh( const Eref& e,
00124 double volume, unsigned int numEntries );
00125 virtual void innerBuildDefaultMesh(
00126 const Eref& e,
00127 double volume, unsigned int numEntries ) = 0;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 void handleNodeInfo( const Eref& e,
00139 unsigned int numNodes, unsigned int numThreads );
00140 virtual void innerHandleNodeInfo(
00141 const Eref& e,
00142 unsigned int numNodes, unsigned int numThreads ) = 0;
00143
00148 void resetStencil();
00149 virtual void innerResetStencil() = 0;
00150
00152
00154
00157 unsigned int getNumEntries() const;
00158 virtual unsigned int innerGetNumEntries() const = 0;
00159
00164 void setNumEntries( unsigned int num );
00165 virtual void innerSetNumEntries( unsigned int n ) = 0;
00166
00170 MeshEntry* lookupEntry( unsigned int index );
00171
00173
00175 static double distance( double x, double y, double z );
00176
00178
00180
00188 void getChildConcs( const Eref& e, vector< double >& childConcs )
00189 const;
00190
00199 unsigned int setChildConcs( const Eref& e,
00200 const vector< double >& childConcs, unsigned int start ) const;
00201
00203
00205
00206
00207
00208
00209
00210
00216 void buildJunction( ChemCompt* other, vector< VoxelJunction >& ret );
00217
00232 virtual void matchMeshEntries( const ChemCompt* other,
00233 vector< VoxelJunction > & ret ) const = 0;
00234
00235
00242 virtual double nearest( double x, double y, double z,
00243 unsigned int& index ) const = 0;
00244
00249 virtual void indexToSpace( unsigned int index,
00250 double& x, double& y, double& z ) const = 0;
00251
00253 void flipRet( vector< VoxelJunction >& ret ) const;
00254
00256
00259 virtual unsigned int getMeshType( unsigned int fid )
00260 const = 0;
00262 virtual unsigned int getMeshDimensions( unsigned int fid )
00263 const = 0;
00265 virtual double getMeshEntryVolume( unsigned int fid )
00266 const = 0;
00267
00270 virtual void setMeshEntryVolume( unsigned int fid, double volume );
00271
00273 virtual vector< double > getCoordinates( unsigned int fid )
00274 const = 0;
00276 virtual vector< unsigned int > getNeighbors( unsigned int fid )
00277 const = 0;
00279 virtual vector< double > getDiffusionArea( unsigned int fid )
00280 const = 0;
00282 virtual vector< double > getDiffusionScaling( unsigned int fid )
00283 const = 0;
00284
00286 virtual double extendedMeshEntryVolume( unsigned int fid )
00287 const = 0;
00288
00290 virtual void clearExtendedMeshEntryVolume() = 0;
00291
00309 virtual unsigned int getStencilRow( unsigned int meshIndex,
00310 const double** entry, const unsigned int** colIndex )
00311 const = 0;
00312
00313
00321 virtual void extendStencil(
00322 const ChemCompt* other, const vector< VoxelJunction >& vj ) = 0;
00323
00325 static SrcFinfo1< vector< double > >* voxelVolOut();
00326
00327 static const Cinfo* initCinfo();
00328
00329 private:
00330 MeshEntry entry_;
00331
00344 vector< Boundary > boundaries_;
00345
00351 string method_;
00352 };
00353
00354 extern SrcFinfo5<
00355 double,
00356 vector< double >,
00357 vector< unsigned int>,
00358 vector< vector< unsigned int > >,
00359 vector< vector< unsigned int > >
00360 >* meshSplit();
00361
00362 #endif // _CHEM_COMPT_H