MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Dsolve.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 #ifndef _DSOLVE_H
11 #define _DSOLVE_H
12 
30 {
31  public:
32  Dsolve();
33  ~Dsolve();
34 
36  // Field assignment stuff
38  unsigned int getNumVarPools() const;
39 
40  void setStoich( Id id );
41  Id getStoich() const;
42  void setCompartment( Id id );
43  // Defined in base class. Id getCompartment() const;
44  void setDsolve( Id id );
45 
46  void setPath( const Eref& e, string path );
47  string getPath( const Eref& e ) const;
48 
49  unsigned int getNumVoxels() const;
51  void setNumAllVoxels( unsigned int numVoxels );
52 
53  vector< double > getNvec( unsigned int pool ) const;
54  void setNvec( unsigned int pool, vector< double > vec );
55 
57  double getDiffVol1( unsigned int voxel ) const;
58  void setDiffVol1( unsigned int voxel, double vol );
59  double getDiffVol2( unsigned int voxel ) const;
60  void setDiffVol2( unsigned int voxel, double vol );
61  double getDiffScale( unsigned int voxel ) const;
62  void setDiffScale( unsigned int voxel, double scale );
63 
65  // Dest Finfos
67  void process( const Eref& e, ProcPtr p );
68  void reinit( const Eref& e, ProcPtr p );
69 
71  void updateJunctions( double dt );
72 
85  void buildNeuroMeshJunctions( const Eref& e, Id spineD, Id psdD );
86 
92  void buildMeshJunctions( const Eref& e, Id other );
93 
99  static void innerBuildMeshJunctions( Id self, Id other,
100  bool isMembraneBound );
101 
103  static void mapDiffPoolsBetweenDsolves( DiffJunction& jn,
104  Id self, Id other);
105 
106  static void mapXfersBetweenDsolves(
107  vector< unsigned int >& srcPools,
108  vector< unsigned int >& destPools,
109  Id src, Id dest );
110  static void mapChansBetweenDsolves( DiffJunction& jn,
111  Id self, Id other);
112 
121  void calcJunction( const DiffJunction& jn, double dt );
123  // Inherited virtual funcs from ZombiePoolInterface
125  double getNinit( const Eref& e ) const;
126  void setNinit( const Eref& e, double value );
127  double getN( const Eref& e ) const;
128  void setN( const Eref& e, double value );
129  double getDiffConst( const Eref& e ) const;
130  void setDiffConst( const Eref& e, double value );
131  void setMotorConst( const Eref& e, double value );
132 
133  void setNumPools( unsigned int num );
134  unsigned int getNumPools() const;
135  unsigned int getNumLocalVoxels() const;
136  VoxelPoolsBase* pools( unsigned int i );
137  double volume( unsigned int i ) const;
138 
139  void getBlock( vector< double >& values ) const;
140  void setBlock( const vector< double >& values );
141  void setPrev();
142 
143  // This one isn't used in Dsolve, but is defined as a dummy.
145  const map< Id, vector< Id > >& xr, Id otherStoich );
147  const vector< vector< Id > >& subCompts,
148  const vector< vector< Id > >& prdCompts );
149  void filterCrossRateTerms( const vector< pair< Id, Id > >& xrt );
150 
151  // Do any updates following a volume or rate constant change.
152  void updateRateTerms( unsigned int index );
154  // Model traversal and building functions
156  unsigned int convertIdToPoolIndex( Id id ) const;
157  unsigned int convertIdToPoolIndex( const Eref& e ) const;
158  unsigned int getPoolIndex( const Eref& e ) const;
159 
165  void makePoolMapFromElist( const vector< ObjId >& elist,
166  vector< Id >& temp );
167 
174  void build( double dt );
175  void rebuildPools();
176  void calcJnDiff( const DiffJunction& jn, Dsolve* other, double dt );
177  void calcJnXfer( const DiffJunction& jn,
178  const vector< unsigned int >& srcXfer,
179  const vector< unsigned int >& destXfer,
180  Dsolve* srcDsolve, Dsolve* destDsolve );
181  void calcJnChan( const DiffJunction& jn, Dsolve* other, double dt );
182  void calcOtherJnChan( const DiffJunction& jn, Dsolve* other,
183  double dt );
184  void fillConcChans( const vector< ObjId >& chans );
185 
189  void print() const;
190 
192  static const Cinfo* initCinfo();
193  private:
194 
196  string path_;
197 
199  double dt_;
200 
201  unsigned int numTotPools_;
202  unsigned int numLocalPools_;
203  unsigned int poolStartIndex_;
204  unsigned int numVoxels_;
205 
207  vector< DiffPoolVec > pools_;
209  vector< ConcChanInfo > channels_;
210 
212  unsigned int poolMapStart_;
213 
215  vector< unsigned int > poolMap_;
216 
222  vector< DiffJunction > junctions_;
223 };
224 
225 
226 #endif // _DSOLVE_H
void setNumAllVoxels(unsigned int numVoxels)
Inherited virtual.
Definition: Dsolve.cpp:975
void fillConcChans(const vector< ObjId > &chans)
Definition: Dsolve.cpp:547
uint32_t value
Definition: moosemodule.h:42
void calcJunction(const DiffJunction &jn, double dt)
Definition: Dsolve.cpp:457
string getPath(const Eref &e) const
Definition: Dsolve.cpp:697
double getDiffScale(unsigned int voxel) const
Definition: Dsolve.cpp:282
void setDiffScale(unsigned int voxel, double scale)
Definition: Dsolve.cpp:274
string path_
Path of pools managed by Dsolve, may include other classes too.
Definition: Dsolve.h:196
unsigned int poolMapStart_
smallest Id value for poolMap_
Definition: Dsolve.h:212
void print() const
unsigned int numVoxels_
Definition: Dsolve.h:204
unsigned int getNumVoxels() const
Definition: Dsolve.cpp:970
void setPath(const Eref &e, string path)
Dummy, inherited but not used.
Definition: Dsolve.cpp:660
void setupCrossSolverReacVols(const vector< vector< Id > > &subCompts, const vector< vector< Id > > &prdCompts)
static void innerBuildMeshJunctions(Id self, Id other, bool isMembraneBound)
Definition: Dsolve.cpp:941
unsigned int getNumLocalVoxels() const
Number of voxels here. pools_.size() == getNumLocalVoxels.
Definition: Dsolve.cpp:1167
void setNumPools(unsigned int num)
Specifies number of pools (species) handled by system.
Definition: Dsolve.cpp:1078
double getNinit(const Eref &e) const
get initial # of molecules in given pool and voxel. Bdry cond.
Definition: Dsolve.cpp:1041
unsigned int numTotPools_
Definition: Dsolve.h:201
Definition: Dsolve.h:29
vector< DiffJunction > junctions_
Definition: Dsolve.h:222
double getDiffVol2(unsigned int voxel) const
Definition: Dsolve.cpp:265
static void mapChansBetweenDsolves(DiffJunction &jn, Id self, Id other)
Definition: Dsolve.cpp:892
void calcJnDiff(const DiffJunction &jn, Dsolve *other, double dt)
Definition: Dsolve.cpp:309
double dt_
Timestep used by diffusion calculations.
Definition: Dsolve.h:199
Id getStoich() const
Definition: Dsolve.cpp:595
void setStoich(Id id)
Definition: Dsolve.cpp:506
void setMotorConst(const Eref &e, double value)
Definition: Dsolve.cpp:1070
vector< double > getNvec(unsigned int pool) const
Definition: Dsolve.cpp:215
void filterCrossRateTerms(const vector< pair< Id, Id > > &xrt)
void setNinit(const Eref &e, double value)
Set initial # of molecules in given pool and voxel. Bdry cond.
Definition: Dsolve.cpp:1027
void setNvec(unsigned int pool, vector< double > vec)
Definition: Dsolve.cpp:204
double volume(unsigned int i) const
Return volume of voxel i.
Definition: Dsolve.cpp:1177
void calcJnChan(const DiffJunction &jn, Dsolve *other, double dt)
Definition: Dsolve.cpp:373
vector< ConcChanInfo > channels_
Internal vector, one for each ConcChan managed by Dsolve.
Definition: Dsolve.h:209
void setDiffConst(const Eref &e, double value)
Diffusion constant: Only one per pool, voxel number is ignored.
Definition: Dsolve.cpp:1054
void setPrev()
Used to tell Dsolver to assign 'prev' values.
Definition: Dsolve.cpp:1124
static const Cinfo * initCinfo()
Definition: Dsolve.cpp:36
void rebuildPools()
void getBlock(vector< double > &values) const
Definition: Dsolve.cpp:1099
void buildMeshJunctions(const Eref &e, Id other)
Definition: Dsolve.cpp:792
void setDsolve(Id id)
Inherited, defining dummy function here.
Definition: Dsolve.cpp:601
void makePoolMapFromElist(const vector< ObjId > &elist, vector< Id > &temp)
Definition: Dsolve.cpp:622
Definition: Eref.h:26
static void mapXfersBetweenDsolves(vector< unsigned int > &srcPools, vector< unsigned int > &destPools, Id src, Id dest)
Definition: Dsolve.cpp:858
void calcJnXfer(const DiffJunction &jn, const vector< unsigned int > &srcXfer, const vector< unsigned int > &destXfer, Dsolve *srcDsolve, Dsolve *destDsolve)
Definition: Dsolve.cpp:349
unsigned int numLocalPools_
Definition: Dsolve.h:202
void setBlock(const vector< double > &values)
Definition: Dsolve.cpp:1132
void setupCrossSolverReacs(const map< Id, vector< Id > > &xr, Id otherStoich)
vector< DiffPoolVec > pools_
Internal vector, one for each pool species managed by Dsolve.
Definition: Dsolve.h:207
unsigned int getPoolIndex(const Eref &e) const
Return pool index, using Stoich ptr to do lookup.
Definition: Dsolve.cpp:1162
unsigned int getNumVarPools() const
Definition: Dsolve.cpp:965
void setDiffVol2(unsigned int voxel, double vol)
Definition: Dsolve.cpp:257
void updateJunctions(double dt)
Used for telling Dsolver to handle all ops across Junctions.
Definition: Dsolve.cpp:495
double getDiffVol1(unsigned int voxel) const
LookupFied for examining cross-solver diffusion terms.
Definition: Dsolve.cpp:248
void setN(const Eref &e, double value)
Set # of molecules in given pool and voxel. Varies with time.
Definition: Dsolve.cpp:999
static void mapDiffPoolsBetweenDsolves(DiffJunction &jn, Id self, Id other)
Sets up map of matching pools for diffusion.
Definition: Dsolve.cpp:824
void setCompartment(Id id)
Assigns compartment.
Definition: Dsolve.cpp:604
~Dsolve()
Definition: Dsolve.cpp:197
Dsolve()
Definition: Dsolve.cpp:188
unsigned int getNumPools() const
gets number of pools (species) handled by system.
Definition: Dsolve.cpp:1093
void calcOtherJnChan(const DiffJunction &jn, Dsolve *other, double dt)
Definition: Dsolve.cpp:415
Definition: Id.h:17
void reinit(const Eref &e, ProcPtr p)
Definition: Dsolve.cpp:486
void build(double dt)
Definition: Dsolve.cpp:723
VoxelPoolsBase * pools(unsigned int i)
Return a pointer to the specified VoxelPool.
Definition: Dsolve.cpp:1172
void setDiffVol1(unsigned int voxel, double vol)
Definition: Dsolve.cpp:240
void process(const Eref &e, ProcPtr p)
Definition: Dsolve.cpp:478
double getN(const Eref &e) const
Get # of molecules in given pool and voxel. Varies with time.
Definition: Dsolve.cpp:1014
double getDiffConst(const Eref &e) const
Diffusion constant: Only one per pool, voxel number is ignored.
Definition: Dsolve.cpp:1062
void buildNeuroMeshJunctions(const Eref &e, Id spineD, Id psdD)
Definition: Dsolve.cpp:768
void updateRateTerms(unsigned int index)
Definition: Dsolve.cpp:1157
Definition: Cinfo.h:18
static char path[]
Definition: mfield.cpp:403
vector< unsigned int > poolMap_
Looks up pool# from pool Id, using poolMapStart_ as offset.
Definition: Dsolve.h:215
unsigned int convertIdToPoolIndex(Id id) const
Definition: Dsolve.cpp:982
unsigned int poolStartIndex_
Definition: Dsolve.h:203