MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Gsolve.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 _GSOLVE_H
11 #define _GSOLVE_H
12 
13 class Stoich;
15 {
16 public:
17  Gsolve();
18  ~Gsolve();
19 
20  // Assignment operator required for c++11
21  Gsolve& operator=(const Gsolve& );
22 
24  // Field assignment stuff
26  Id getStoich() const;
27  void setStoich( Id stoich );
28  Id getCompartment() const;
29  void setCompartment( Id compt );
30 
31  unsigned int getNumLocalVoxels() const;
32  unsigned int getNumAllVoxels() const;
37  void setNumAllVoxels( unsigned int num );
38 
43  void setNumPools( unsigned int num );
44  unsigned int getNumPools() const;
45  VoxelPoolsBase* pools( unsigned int i );
46  double volume( unsigned int i ) const;
47 
49  vector< double > getNvec( unsigned int voxel) const;
50  void setNvec( unsigned int voxel, vector< double > vec );
52  // Dest Finfos
54  void process( const Eref& e, ProcPtr p );
55  void reinit( const Eref& e, ProcPtr p );
56  void initProc( const Eref& e, ProcPtr p );
57  void initReinit( const Eref& e, ProcPtr p );
58 
64  void updateVoxelVol( vector< double > vols );
65 
67  // Solver setup functions
69  void rebuildGssaSystem();
70  void fillMmEnzDep();
71  void fillPoolFuncDep();
72  void fillIncrementFuncDep();
73  void insertMathDepReacs( unsigned int mathDepIndex,
74  unsigned int firedReac );
75  void makeReacDepsUnique();
76 
78  // Solver interface functions
80  unsigned int getPoolIndex( const Eref& e ) const;
81  unsigned int getVoxelIndex( const Eref& e ) const;
82  vector< unsigned int > getNumFire( unsigned int voxel) const;
83 
89  void setDsolve( Id dsolve );
90 
92  // ZombiePoolInterface inherited functions
94 
95  void setN( const Eref& e, double v );
96  double getN( const Eref& e ) const;
97  void setNinit( const Eref& e, double v );
98  double getNinit( const Eref& e ) const;
99  void setDiffConst( const Eref& e, double v );
100  double getDiffConst( const Eref& e ) const;
101 
102  void getBlock( vector< double >& values ) const;
103  void setBlock( const vector< double >& values );
104 
109  void updateRateTerms( unsigned int index );
110 
111 
112  // A wrapper to call advance function of GssaVoxelPool
113  // concurrently.
114  void parallel_advance(int begin, int end, size_t nWorkers
115  , ProcPtr p , const GssaSystem* sys
116  );
117 
120  bool getRandInit() const;
122  void setRandInit( bool val );
123 
125  bool getClockedUpdate() const;
127  void setClockedUpdate( bool val );
128 
129 #if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC
130  unsigned int getNumThreads( ) const;
131  void setNumThreads( unsigned int x );
132 #endif
133 
135  static const Cinfo* initCinfo();
136 private:
137 
138 #if PARALLELIZE_GSOLVE_WITH_CPP11_ASYNC
139 
143  unsigned int numThreads_;
144 #endif
145 
154  vector< GssaVoxelPools > pools_;
155 
157  unsigned int startVoxel_;
158 
161 
166 
169 
172 };
173 
174 #endif // _GSOLVE_H
unsigned int getNumAllVoxels() const
Definition: Gsolve.cpp:283
void fillIncrementFuncDep()
Definition: Gsolve.cpp:694
bool getRandInit() const
Flag: returns true if randomized round to integers is done.
Definition: Gsolve.cpp:342
double getN(const Eref &e) const
Get # of molecules in given pool and voxel. Varies with time.
Definition: Gsolve.cpp:903
Id getCompartment() const
Inherited from ZombiePoolInterface.
Definition: Gsolve.cpp:256
void updateVoxelVol(vector< double > vols)
Definition: Gsolve.cpp:1016
Gsolve & operator=(const Gsolve &)
Definition: Gsolve.cpp:219
unsigned int getVoxelIndex(const Eref &e) const
Definition: Gsolve.cpp:849
void process(const Eref &e, ProcPtr p)
Definition: Gsolve.cpp:398
void setStoich(Id stoich)
Definition: Gsolve.cpp:261
void setRandInit(bool val)
Flag: set true if randomized round to integers is to be done.
Definition: Gsolve.cpp:347
static const Cinfo * initCinfo()
Definition: Gsolve.cpp:37
void setNvec(unsigned int voxel, vector< double > vec)
Definition: Gsolve.cpp:309
unsigned int startVoxel_
First voxel indexed on the current node.
Definition: Gsolve.h:157
unsigned int getPoolIndex(const Eref &e) const
Return pool index, using Stoich ptr to do lookup.
Definition: Gsolve.cpp:844
void fillPoolFuncDep()
Definition: Gsolve.cpp:631
void fillMmEnzDep()
Definition: Gsolve.cpp:580
Stoich * stoichPtr_
Utility ptr used to help Pool Id lookups by the Ksolve.
Definition: Gsolve.h:160
void initReinit(const Eref &e, ProcPtr p)
Definition: Gsolve.cpp:535
double getDiffConst(const Eref &e) const
Diffusion constant: Only one per pool, voxel number is ignored.
Definition: Gsolve.cpp:948
void setN(const Eref &e, double v)
Set # of molecules in given pool and voxel. Varies with time.
Definition: Gsolve.cpp:883
void updateRateTerms(unsigned int index)
Definition: Gsolve.cpp:1031
void rebuildGssaSystem()
Definition: Gsolve.cpp:548
Definition: Stoich.h:49
void setClockedUpdate(bool val)
Flag: set true if randomized round to integers is to be done.
Definition: Gsolve.cpp:357
double getNinit(const Eref &e) const
get initial # of molecules in given pool and voxel. Bdry cond.
Definition: Gsolve.cpp:935
unsigned int getNumPools() const
Inherited.
Definition: Gsolve.cpp:963
Id getStoich() const
Definition: Gsolve.cpp:233
Gsolve()
Definition: Gsolve.cpp:206
VoxelPoolsBase * pools(unsigned int i)
Inherited.
Definition: Gsolve.cpp:1052
vector< GssaVoxelPools > pools_
Definition: Gsolve.h:154
unsigned int getNumLocalVoxels() const
Number of voxels here. pools_.size() == getNumLocalVoxels.
Definition: Gsolve.cpp:278
~Gsolve()
Definition: Gsolve.cpp:224
void getBlock(vector< double > &values) const
Definition: Gsolve.cpp:970
void setCompartment(Id compt)
Assigns compartment.
Definition: Gsolve.cpp:238
void insertMathDepReacs(unsigned int mathDepIndex, unsigned int firedReac)
Definition: Gsolve.cpp:805
Definition: Eref.h:26
bool useClockedUpdate_
Flag: True if atot should be updated every clock tick.
Definition: Gsolve.h:171
void setDsolve(Id dsolve)
Definition: Gsolve.cpp:857
void setBlock(const vector< double > &values)
Definition: Gsolve.cpp:993
bool getClockedUpdate() const
Flag: returns true if randomized round to integers is done.
Definition: Gsolve.cpp:352
ZombiePoolInterface * dsolvePtr_
Pointer to diffusion solver.
Definition: Gsolve.h:168
void setDiffConst(const Eref &e, double v)
Diffusion constant: Only one per pool, voxel number is ignored.
Definition: Gsolve.cpp:943
void initProc(const Eref &e, ProcPtr p)
Definition: Gsolve.cpp:532
vector< unsigned int > getNumFire(unsigned int voxel) const
Definition: Gsolve.cpp:331
Definition: Id.h:17
void setNinit(const Eref &e, double v)
Set initial # of molecules in given pool and voxel. Bdry cond.
Definition: Gsolve.cpp:911
Id dsolve_
Definition: Gsolve.h:165
void makeReacDepsUnique()
Definition: Gsolve.cpp:822
GssaSystem sys_
Definition: Gsolve.h:146
void setNumAllVoxels(unsigned int num)
Definition: Gsolve.cpp:289
vector< double > getNvec(unsigned int voxel) const
Returns the vector of pool Num at the specified voxel.
Definition: Gsolve.cpp:299
void parallel_advance(int begin, int end, size_t nWorkers, ProcPtr p, const GssaSystem *sys)
double volume(unsigned int i) const
Inherited.
Definition: Gsolve.cpp:1059
Definition: Cinfo.h:18
void reinit(const Eref &e, ProcPtr p)
Definition: Gsolve.cpp:503
void setNumPools(unsigned int num)
Definition: Gsolve.cpp:953
Definition: Gsolve.h:14