MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
VoxelPoolsBase.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-2014 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 #ifndef _VOXEL_POOLS_BASE_H
11 #define _VOXEL_POOLS_BASE_H
12 
13 #include <map>
14 #include <vector>
15 
16 using namespace std;
17 
18 class RateTerm;
19 class Stoich;
20 class Id;
21 
32 {
33 public:
35  virtual ~VoxelPoolsBase();
36 
38  // Compute access operations.
41  void resizeArrays( unsigned int totNumPools );
42 
46  unsigned int size() const;
47 
52  const double* S() const;
53 
55  vector< double >& Svec();
56 
61  double* varS();
62 
67  const double* Sinit() const;
68 
73  double* varSinit();
74 
78  void reinit();
79 
81  void setVolume( double vol );
83  double getVolume() const;
84 
89  virtual void setVolumeAndDependencies( double vol );
90 
92  // Field assignment functions
94 
95  void setN( unsigned int i, double v );
96  double getN( unsigned int ) const;
97  void setNinit( unsigned int, double v );
98  double getNinit( unsigned int ) const;
99  void setDiffConst( unsigned int, double v );
100  double getDiffConst( unsigned int ) const;
102  // Functions to set up rates vector
104 
107  virtual void updateAllRateTerms( const vector< RateTerm* >& rates,
108  unsigned int numCoreRates ) = 0;
109 
115  virtual void updateRateTerms( const vector< RateTerm* >& rates,
116  unsigned int numCoreRates, unsigned int index ) = 0;
117 
121  void filterCrossRateTerms( const vector< Id >& offSolverReacs, const vector< pair< Id, Id > >& offSolverReacCompts );
122 
124  // Functions to handle cross-compartment reactions.
126 
130  void xferIn( const vector< unsigned int >& poolIndex,
131  const vector< double >& values,
132  const vector< double >& lastValues,
133  unsigned int voxelIndex );
134 
140  void xferInOnlyProxies(
141  const vector< unsigned int >& poolIndex,
142  const vector< double >& values,
143  unsigned int numProxyPools,
144  unsigned int voxelIndex );
145 
147  void xferOut( unsigned int voxelIndex,
148  vector< double >& values,
149  const vector< unsigned int >& poolIndex );
151  void addProxyVoxy( unsigned int comptIndex,
152  Id comptId, unsigned int voxel );
153  void addProxyTransferIndex( unsigned int comptIndex,
154  unsigned int transferIndex );
155 
162  bool hasXfer( unsigned int comptIndex ) const;
164 
169  bool isVoxelJunctionPresent( Id i1, Id i2 ) const;
171  // Functions for cross-compartment rate scaling.
173 
177  void resetXreacScale( unsigned int size );
178 
184  void forwardReacVolumeFactor( unsigned int i, double volume );
185 
191  void backwardReacVolumeFactor( unsigned int i, double volume );
192 
197  double getXreacScaleSubstrates( unsigned int i ) const;
198 
203  double getXreacScaleProducts( unsigned int i ) const;
204 
205  void scaleVolsBufsRates( double ratio, const Stoich* stoichPtr );
206 
208  void print() const;
209 
210 protected:
212  vector< RateTerm* > rates_;
213 
214 private:
229  vector< double > S_;
230 
237  vector< double > Sinit_;
238 
251  vector< vector< unsigned int > > proxyPoolVoxels_;
258  vector< vector< unsigned int > > proxyTransferIndex_;
259 
263  map< Id, unsigned int > proxyComptMap_;
264 
273  double volume_;
274 
281  vector< double > xReacScaleSubstrates_;
282 
289  vector< double > xReacScaleProducts_;
290 };
291 
292 #endif // _VOXEL_POOLS_BASE_H
const Stoich * stoichPtr_
vector< double > xReacScaleProducts_
vector< double > S_
vector< double > Sinit_
vector< vector< unsigned int > > proxyTransferIndex_
Definition: Stoich.h:49
vector< double > xReacScaleSubstrates_
Definition: Id.h:17
vector< vector< unsigned int > > proxyPoolVoxels_
map< Id, unsigned int > proxyComptMap_
vector< RateTerm * > rates_