MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZombieCompartment.cpp
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-2007 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 #include "ZombieCompartment.h"
11 
12 using namespace moose;
13 const double ZombieCompartment::EPSILON = 1.0e-15;
14 
15 
25 {
27  // static Finfo* compartmentFinfos[] = { };
28 
29  static string doc[] =
30  {
31  "Name", "ZombieCompartment",
32  "Author", "Upi Bhalla",
33  "Description", "Compartment object, for branching neuron models.",
34  };
35 
36  static Dinfo< ZombieCompartment > dinfo;
38  "ZombieCompartment",
40  0,
41  0,
42  // compartmentFinfos,
43  // sizeof( compartmentFinfos ) / sizeof( Finfo* ),
44  &dinfo,
45  doc,
46  sizeof( doc )/ sizeof( string )
47  );
48 
49  return &zombieCompartmentCinfo;
50 }
51 
53 
55 // Here we put the Compartment class functions.
57 
59 {
60  hsolve_ = NULL;
61 }
62 
64 {
65  ;
66 }
67 
68 // Value Field access function definitions.
69 void ZombieCompartment::vSetVm( const Eref& e , double Vm )
70 {
71  assert(hsolve_);
72  hsolve_->setVm( e.id(), Vm );
73 }
74 
75 double ZombieCompartment::vGetVm( const Eref& e ) const
76 {
77  assert(hsolve_);
78  return hsolve_->getVm( e.id() );
79 }
80 
81 void ZombieCompartment::vSetEm( const Eref& e , double Em )
82 {
83  hsolve_->setEm( e.id(), Em );
84 }
85 
86 double ZombieCompartment::vGetEm( const Eref& e ) const
87 {
88  return hsolve_->getEm( e.id() );
89 }
90 
91 void ZombieCompartment::vSetCm( const Eref& e , double Cm )
92 {
93  if ( rangeWarning( "Cm", Cm ) ) return;
94  hsolve_->setCm( e.id(), Cm );
95 }
96 
97 double ZombieCompartment::vGetCm( const Eref& e ) const
98 {
99  return hsolve_->getCm( e.id() );
100 }
101 
102 void ZombieCompartment::vSetRm( const Eref& e , double Rm )
103 {
104  if ( rangeWarning( "Rm", Rm ) ) return;
105  hsolve_->setRm( e.id(), Rm );
106 }
107 
108 double ZombieCompartment::vGetRm( const Eref& e ) const
109 {
110  return hsolve_->getRm( e.id() );
111 }
112 
113 void ZombieCompartment::vSetRa( const Eref& e , double Ra )
114 {
115  if ( rangeWarning( "Ra", Ra ) ) return;
116  hsolve_->setRa( e.id(), Ra );
117 }
118 
119 double ZombieCompartment::vGetRa( const Eref& e ) const
120 {
121  return hsolve_->getRa( e.id() );
122 }
123 
124 //~ void ZombieCompartment::setIm( const Eref& e , double Im )
125 //~ {
126 //~ Im_ = Im;
127 //~ }
128 
129 double ZombieCompartment::vGetIm( const Eref& e ) const
130 {
131  return hsolve_->getIm( e.id() );
132 }
133 
134 void ZombieCompartment::vSetInject( const Eref& e , double Inject )
135 {
136  hsolve_->setInject( e.id(), Inject );
137 }
138 
139 double ZombieCompartment::vGetInject( const Eref& e ) const
140 {
141  return hsolve_->getInject( e.id() );
142 }
143 
144 void ZombieCompartment::vSetInitVm( const Eref& e , double initVm )
145 {
146  hsolve_->setInitVm( e.id(), initVm );
147 }
148 
149 double ZombieCompartment::vGetInitVm( const Eref& e ) const
150 {
151  return hsolve_->getInitVm( e.id() );
152 }
153 
155 // ZombieCompartment::Dest function definitions.
157 //
159 {
160  ;
161 }
162 
164 {
166 }
167 
169 {
170  ;
171 }
172 
174 {
175  ;
176 }
177 
178 void ZombieCompartment::vHandleChannel( const Eref& e, double Gk, double Ek)
179 {
180  hsolve_->addGkEk( e.id(), Gk, Ek );
181 }
182 
183 void ZombieCompartment::vHandleRaxial( double Ra, double Vm )
184 {
185  ;
186 }
187 
189 {
190  ;
191 }
192 
193 void ZombieCompartment::vInjectMsg( const Eref& e , double current )
194 {
195  hsolve_->addInject( e.id(), current );
196 }
197 
198 void ZombieCompartment::vRandInject( const Eref& e , double prob, double current )
199 {
200  //~ if ( mtrand() < prob * dt_ ) {
201  //~ hsolve_->addInject( e.id(), current );
202  //~ }
203 }
205 
206 void ZombieCompartment::vSetSolver( const Eref& e , Id hsolve )
207 {
208  if ( !hsolve.element()->cinfo()->isA( "HSolve" ) ) {
209  cout << "Error: ZombieCompartment::vSetSolver: Object: " <<
210  hsolve.path() << " is not an HSolve. Aborted\n";
211  hsolve_ = 0;
212  return;
213  }
214  hsolve_ = reinterpret_cast< HSolve* >( hsolve.eref().data() );
215 }
216 
218 {
219  return rng.uniform( );
220 }
Id id() const
Definition: Eref.cpp:62
char * data() const
Definition: Eref.cpp:41
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
void vSetRm(const Eref &e, double Rm)
static const double EPSILON
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
Definition: Dinfo.h:60
static const Cinfo * initCinfo()
void setSeed(const unsigned long seed)
If seed if 0 then set seed to a random number else set seed to the given number.
Definition: RNG.h:73
void vReinit(const Eref &e, ProcPtr p)
moose::RNG< double > rng
Definition: global.cpp:47
Eref eref() const
Definition: Id.cpp:125
double vGetInject(const Eref &e) const
void vSetSolver(const Eref &e, Id hsolve)
Assigns the solver to the zombie.
void vInitProc(const Eref &e, ProcPtr p)
void vSetVm(const Eref &e, double Vm)
double vGetCm(const Eref &e) const
void vSetCm(const Eref &e, double Cm)
double vGetRa(const Eref &e) const
void vSetInject(const Eref &e, double Inject)
void vInjectMsg(const Eref &e, double current)
void vHandleAxial(double Vm)
double vGetInitVm(const Eref &e) const
unsigned long __rng_seed__
A global seed for all RNGs in moose. When moose.seed( x ) is called, this variable is set...
Definition: global.cpp:45
static const Cinfo * zombieCompartmentCinfo
double vGetRm(const Eref &e) const
Definition: HSolve.h:16
void vSetEm(const Eref &e, double Em)
void vHandleChannel(const Eref &e, double Gk, double Ek)
Definition: Eref.h:26
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66
void vProcess(const Eref &e, ProcPtr p)
void vSetInitVm(const Eref &e, double initVm)
void vRandInject(const Eref &e, double prob, double current)
double vGetIm(const Eref &e) const
Definition: Id.h:17
void vInitReinit(const Eref &e, ProcPtr p)
double vGetVm(const Eref &e) const
double vGetEm(const Eref &e) const
T uniform(const T a, const T b)
Generate a uniformly distributed random number between a and b.
Definition: RNG.h:90
void vSetRa(const Eref &e, double Ra)
Definition: Cinfo.h:18
void vHandleRaxial(double Ra, double Vm)
static const Cinfo * initCinfo()