MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PoolBase.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-2010 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 _POOL_BASE_H
11 #define _POOL_BASE_H
12 
18 typedef unsigned int SpeciesId;
19 extern const SpeciesId DefaultSpeciesId;
20 
30 class PoolBase
31 {
32  friend void testSyncArray( unsigned int size, unsigned int numThreads,
33  unsigned int method );
34  friend void checkVal( double time, const PoolBase* m, unsigned int size );
35  friend void forceCheckVal( double time, Element* e, unsigned int size );
36 
37 public:
38  PoolBase();
39  virtual ~PoolBase();
40 
42  // Field assignment stuff: Interface for the Cinfo, hence regular
43  // funcs. These internally call the virtual funcs that do the real
44  // work.
46  void setN( const Eref& e, double v );
47  double getN( const Eref& e ) const;
48  void setNinit( const Eref& e, double v );
49  double getNinit( const Eref& e ) const;
50  void setDiffConst( const Eref& e, double v );
51  double getDiffConst( const Eref& e ) const;
52  void setMotorConst( const Eref& e, double v );
53  double getMotorConst( const Eref& e ) const;
54 
55  void setConc( const Eref& e, double v );
56  double getConc( const Eref& e ) const;
57  void setConcInit( const Eref& e, double v );
58  double getConcInit( const Eref& e ) const;
59 
66  void setVolume( const Eref& e, double v );
67  double getVolume( const Eref& e ) const;
68 
69  void setSpecies( const Eref& e, SpeciesId v );
70  SpeciesId getSpecies( const Eref& e ) const;
74  void setIsBuffered( const Eref& e, bool v );
75  bool getIsBuffered( const Eref& e ) const;
76 
78  // Here are the inner virtual funcs for fields.
79  // All these are pure virtual
81 
82  virtual void vSetN( const Eref& e, double v ) = 0;
83  virtual double vGetN( const Eref& e ) const = 0;
84  virtual void vSetNinit( const Eref& e, double v ) = 0;
85  virtual double vGetNinit( const Eref& e ) const = 0;
86  virtual void vSetDiffConst( const Eref& e, double v ) = 0;
87  virtual double vGetDiffConst( const Eref& e ) const = 0;
88  virtual void vSetMotorConst( const Eref& e, double v );
89  virtual double vGetMotorConst( const Eref& e ) const;
90 
91  virtual void vSetConc( const Eref& e, double v ) = 0;
92  virtual double vGetConc( const Eref& e ) const = 0;
93  virtual void vSetConcInit( const Eref& e, double v ) = 0;
94  virtual double vGetConcInit( const Eref& e ) const;
95  virtual double vGetVolume( const Eref& e ) const = 0;
96  virtual void vSetVolume( const Eref& e, double v ) = 0;
97  virtual void vSetSpecies( const Eref& e, SpeciesId v ) = 0;
98  virtual SpeciesId vGetSpecies( const Eref& e ) const = 0;
100  virtual void vSetIsBuffered( const Eref& e, bool v );
101  virtual bool vGetIsBuffered( const Eref& e) const = 0;
108  virtual void vSetSolver( Id ksolve, Id dsolve );
109 
111 
127  static void zombify( Element* original, const Cinfo* zClass,
128  Id ksolve, Id dsolve );
129 
131  // Dest funcs
133  void process( const Eref& e, ProcPtr p );
134  void reinit( const Eref& e, ProcPtr p );
135  void reac( double A, double B );
136  void handleMolWt( const Eref& e, double v );
137  void increment( double val );
138  void decrement( double val );
139  void nIn( double val );
140 
142  // Virtual Dest funcs. Most of these have a generic do-nothing
143  // function here, as most of the derived classes don't need to
144  // do anything.
146  virtual void vProcess( const Eref& e, ProcPtr p );
147  virtual void vReinit( const Eref& e, ProcPtr p );
148  virtual void vReac( double A, double B );
149  virtual void vHandleMolWt( const Eref& e, double v);
150  virtual void vIncrement( double val );
151  virtual void vDecrement( double val );
152  virtual void vnIn( double val );
153 
155  static const Cinfo* initCinfo();
156 private:
157  double concInit_;
158  // We don't store the conc here as this is computed on the fly
159  // by derived classes. But the PoolBase::concInit is authoritative.
160 };
161 
162 #endif // _POOL_BASE_H
virtual SpeciesId vGetSpecies(const Eref &e) const =0
virtual void vSetVolume(const Eref &e, double v)=0
void setVolume(const Eref &e, double v)
Definition: PoolBase.cpp:373
SpeciesId getSpecies(const Eref &e) const
Definition: PoolBase.cpp:388
void handleMolWt(const Eref &e, double v)
Definition: PoolBase.cpp:269
void setConc(const Eref &e, double v)
Definition: PoolBase.cpp:325
virtual void vHandleMolWt(const Eref &e, double v)
Definition: PoolBase.cpp:287
static const Cinfo * initCinfo()
Definition: PoolBase.cpp:19
virtual void vDecrement(double val)
Definition: PoolBase.cpp:293
double concInit_
Definition: PoolBase.h:157
void setConcInit(const Eref &e, double v)
Definition: PoolBase.cpp:336
double getMotorConst(const Eref &e) const
Definition: PoolBase.cpp:368
virtual void vSetMotorConst(const Eref &e, double v)
Dummy MotorConst field for most Pool subclasses.
Definition: PoolBase.cpp:411
void setDiffConst(const Eref &e, double v)
Definition: PoolBase.cpp:353
virtual void vSetSpecies(const Eref &e, SpeciesId v)=0
virtual double vGetVolume(const Eref &e) const =0
static void zombify(Element *original, const Cinfo *zClass, Id ksolve, Id dsolve)
Definition: PoolBase.cpp:430
virtual double vGetDiffConst(const Eref &e) const =0
double getConc(const Eref &e) const
Definition: PoolBase.cpp:331
virtual void vSetConcInit(const Eref &e, double v)=0
virtual double vGetConcInit(const Eref &e) const
Definition: PoolBase.cpp:342
void nIn(double val)
Definition: PoolBase.cpp:259
virtual void vIncrement(double val)
Definition: PoolBase.cpp:290
void setNinit(const Eref &e, double v)
Definition: PoolBase.cpp:313
double getVolume(const Eref &e) const
Definition: PoolBase.cpp:378
virtual double vGetN(const Eref &e) const =0
virtual void vReac(double A, double B)
Definition: PoolBase.cpp:284
virtual void vSetConc(const Eref &e, double v)=0
virtual ~PoolBase()
Definition: PoolBase.cpp:232
friend void testSyncArray(unsigned int size, unsigned int numThreads, unsigned int method)
virtual void vReinit(const Eref &e, ProcPtr p)
Definition: PoolBase.cpp:281
void reinit(const Eref &e, ProcPtr p)
Definition: PoolBase.cpp:244
friend void checkVal(double time, const PoolBase *m, unsigned int size)
virtual double vGetMotorConst(const Eref &e) const
Definition: PoolBase.cpp:414
Definition: Eref.h:26
virtual void vSetDiffConst(const Eref &e, double v)=0
virtual double vGetConc(const Eref &e) const =0
void decrement(double val)
Definition: PoolBase.cpp:254
unsigned int SpeciesId
Definition: PoolBase.h:18
const SpeciesId DefaultSpeciesId
Definition: PoolBase.cpp:17
void setIsBuffered(const Eref &e, bool v)
Definition: PoolBase.cpp:396
double getConcInit(const Eref &e) const
Definition: PoolBase.cpp:347
void increment(double val)
Definition: PoolBase.cpp:249
void setMotorConst(const Eref &e, double v)
Definition: PoolBase.cpp:363
void reac(double A, double B)
Definition: PoolBase.cpp:264
virtual double vGetNinit(const Eref &e) const =0
Definition: Id.h:17
friend void forceCheckVal(double time, Element *e, unsigned int size)
virtual void vSetNinit(const Eref &e, double v)=0
double getNinit(const Eref &e) const
Definition: PoolBase.cpp:319
virtual bool vGetIsBuffered(const Eref &e) const =0
bool getIsBuffered(const Eref &e) const
Definition: PoolBase.cpp:401
double getDiffConst(const Eref &e) const
Definition: PoolBase.cpp:358
virtual void vSetSolver(Id ksolve, Id dsolve)
Definition: PoolBase.cpp:467
virtual void vProcess(const Eref &e, ProcPtr p)
Definition: PoolBase.cpp:278
Definition: Cinfo.h:18
virtual void vSetN(const Eref &e, double v)=0
virtual void vSetIsBuffered(const Eref &e, bool v)
I put in a default empty function for vSetIsBuffered.
Definition: PoolBase.cpp:420
double getN(const Eref &e) const
Definition: PoolBase.cpp:308
void process(const Eref &e, ProcPtr p)
Definition: PoolBase.cpp:239
void setSpecies(const Eref &e, SpeciesId v)
Definition: PoolBase.cpp:383
virtual void vnIn(double val)
Definition: PoolBase.cpp:296
void setN(const Eref &e, double v)
Definition: PoolBase.cpp:303