MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
moose::Compartment Class Reference

#include <Compartment.h>

+ Inheritance diagram for moose::Compartment:
+ Collaboration diagram for moose::Compartment:

Public Member Functions

void cable ()
 
 Compartment ()
 
virtual double vGetCm (const Eref &e) const
 
virtual double vGetEm (const Eref &e) const
 
virtual double vGetIm (const Eref &e) const
 
virtual double vGetInitVm (const Eref &e) const
 
virtual double vGetInject (const Eref &e) const
 
virtual double vGetRa (const Eref &e) const
 
virtual double vGetRm (const Eref &e) const
 
virtual double vGetVm (const Eref &e) const
 
void vHandleAxial (double Vm)
 
void vHandleChannel (const Eref &e, double Gk, double Ek)
 
void vHandleRaxial (double Ra, double Vm)
 
void vInitProc (const Eref &e, ProcPtr p)
 
void vInitReinit (const Eref &e, ProcPtr p)
 
void vInjectMsg (const Eref &e, double current)
 
void vProcess (const Eref &e, ProcPtr p)
 
void vRandInject (const Eref &e, double prob, double current)
 
void vReinit (const Eref &e, ProcPtr p)
 
virtual void vSetCm (const Eref &e, double Cm)
 
virtual void vSetEm (const Eref &e, double Em)
 
virtual void vSetInitVm (const Eref &e, double initVm)
 
virtual void vSetInject (const Eref &e, double Inject)
 
virtual void vSetRa (const Eref &e, double Ra)
 
virtual void vSetRm (const Eref &e, double Rm)
 
virtual void vSetVm (const Eref &e, double Vm)
 
virtual ~Compartment ()
 
- Public Member Functions inherited from moose::CompartmentBase
void cable ()
 
 CompartmentBase ()
 
void displace (double dx, double dy, double dz)
 Displaces compartment by specified distance vector. More...
 
double getCm (const Eref &e) const
 
double getDiameter () const
 
double getEm (const Eref &e) const
 
double getIm (const Eref &e) const
 
double getInitVm (const Eref &e) const
 
double getInject (const Eref &e) const
 
double getLength () const
 
double getRa (const Eref &e) const
 
double getRm (const Eref &e) const
 
double getVm (const Eref &e) const
 
double getX () const
 
double getX0 () const
 
double getY () const
 
double getY0 () const
 
double getZ () const
 
double getZ0 () const
 
void handleAxial (double Vm)
 
void handleChannel (const Eref &e, double Gk, double Ek)
 
void handleRaxial (double Ra, double Vm)
 
void initProc (const Eref &e, ProcPtr p)
 
void initReinit (const Eref &e, ProcPtr p)
 
void injectMsg (const Eref &e, double current)
 
void process (const Eref &e, ProcPtr p)
 
void randInject (const Eref &e, double prob, double current)
 
bool rangeWarning (const string &field, double value)
 
void reinit (const Eref &e, ProcPtr p)
 
void setCm (const Eref &e, double Cm)
 
void setDiameter (double diameter)
 
void setEm (const Eref &e, double Em)
 
void setGeomAndElec (const Eref &e, double length, double dia)
 Scales electrical values along with setting length, dia. More...
 
void setInitVm (const Eref &e, double initVm)
 
void setInject (const Eref &e, double Inject)
 
void setLength (double length)
 
void setRa (const Eref &e, double Ra)
 
void setRm (const Eref &e, double Rm)
 
void setVm (const Eref &e, double Vm)
 
void setX (double value)
 
void setX0 (double value)
 
void setY (double value)
 
void setY0 (double value)
 
void setZ (double value)
 
void setZ0 (double value)
 
void updateLength ()
 
virtual void vSetSolver (const Eref &e, Id hsolve)
 
virtual ~CompartmentBase ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 
- Static Public Member Functions inherited from moose::CompartmentBase
static const CinfoinitCinfo ()
 
static SrcFinfo1< double > * VmOut ()
 
static void zombify (Element *orig, const Cinfo *zClass, Id hsolve)
 

Protected Attributes

double A_
 
double B_
 
double Cm_
 
double Em_
 
double Im_
 
double initVm_
 
double inject_
 
double lastIm_
 
double Ra_
 
double Rm_
 
double sumInject_
 
double Vm_
 

Private Attributes

double dt_
 
double invRm_
 

Static Private Attributes

static const double EPSILON = 1.0e-15
 

Detailed Description

Definition at line 22 of file Compartment.h.

Constructor & Destructor Documentation

Compartment::Compartment ( )

Definition at line 74 of file Compartment.cpp.

References A_, B_, Cm_, Em_, Im_, initVm_, inject_, invRm_, lastIm_, Ra_, Rm_, sumInject_, and Vm_.

75 {
76  Vm_ = -0.06;
77  Em_ = -0.06;
78  Cm_ = 1.0;
79  Rm_ = 1.0;
80  invRm_ = 1.0;
81  Ra_ = 1.0;
82  Im_ = 0.0;
83  lastIm_ = 0.0;
84  inject_ = 0.0;
85  sumInject_ = 0.0;
86  initVm_ = -0.06;
87  A_ = 0.0;
88  B_ = 0.0;
89 }
Compartment::~Compartment ( )
virtual

Definition at line 91 of file Compartment.cpp.

92 {
93  ;
94 }

Member Function Documentation

void moose::Compartment::cable ( )

Dummy function to act as recipient of 'cable' message, which is just for grouping compartments.

const Cinfo * Compartment::initCinfo ( )
static

Initializes the class info.

The initCinfo() function sets up the Compartment class. This function uses the common trick of having an internal static value which is created the first time the function is called. There are several static arrays set up here. The ones which use SharedFinfos are for shared messages where multiple kinds of information go along the same connection.

Definition at line 26 of file Compartment.cpp.

References compartmentCinfo, and moose::CompartmentBase::initCinfo().

Referenced by SymCompartment::initCinfo(), and moose::IntFireBase::initCinfo().

27 {
29  // static Finfo* compartmentFinfos[] = { };
30 
31  static string doc[] =
32  {
33  "Name", "Compartment",
34  "Author", "Upi Bhalla",
35  "Description", "Compartment object, for branching neuron models.",
36  };
37  static Dinfo< Compartment > dinfo;
38  static Cinfo compartmentCinfo(
39  "Compartment",
41  0,
42  0,
43  // compartmentFinfos,
44  // sizeof( compartmentFinfos ) / sizeof( Finfo* ),
45  &dinfo,
46  doc,
47  sizeof(doc)/sizeof(string)
48  );
49 
50  return &compartmentCinfo;
51 }
Definition: Dinfo.h:60
static const Cinfo * compartmentCinfo
Definition: Compartment.cpp:53
Definition: Cinfo.h:18
static const Cinfo * initCinfo()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double Compartment::vGetCm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 123 of file Compartment.cpp.

References Cm_.

124 {
125  return Cm_;
126 }
double Compartment::vGetEm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 112 of file Compartment.cpp.

References Em_.

113 {
114  return Em_;
115 }
double Compartment::vGetIm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 151 of file Compartment.cpp.

References lastIm_.

152 {
153  return lastIm_;
154 }
double Compartment::vGetInitVm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 171 of file Compartment.cpp.

References initVm_.

172 {
173  return initVm_;
174 }
double Compartment::vGetInject ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 161 of file Compartment.cpp.

References inject_.

162 {
163  return inject_;
164 }
double Compartment::vGetRa ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 146 of file Compartment.cpp.

References Ra_.

147 {
148  return Ra_;
149 }
double Compartment::vGetRm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 135 of file Compartment.cpp.

References Rm_.

136 {
137  return Rm_;
138 }
double Compartment::vGetVm ( const Eref e) const
virtual

Implements moose::CompartmentBase.

Definition at line 102 of file Compartment.cpp.

References Vm_.

103 {
104  return Vm_;
105 }
void Compartment::vHandleAxial ( double  Vm)
virtual

handleAxial handles incoming axial message data.

Implements moose::CompartmentBase.

Definition at line 245 of file Compartment.cpp.

References A_, B_, Im_, Ra_, and Vm_.

246 {
247  A_ += Vm / Ra_;
248  B_ += 1.0 / Ra_;
249  Im_ += ( Vm - Vm_ ) / Ra_;
250 }
void Compartment::vHandleChannel ( const Eref e,
double  Gk,
double  Ek 
)
virtual

handleChannel handles information coming from the channel to the compartment

Implements moose::CompartmentBase.

Definition at line 232 of file Compartment.cpp.

References A_, and B_.

233 {
234  A_ += Gk * Ek;
235  B_ += Gk;
236 }
void Compartment::vHandleRaxial ( double  Ra,
double  Vm 
)
virtual

handleRaxial handles incoming raxial message data.

Implements moose::CompartmentBase.

Definition at line 238 of file Compartment.cpp.

References A_, B_, Im_, and Vm_.

239 {
240  A_ += Vm / Ra;
241  B_ += 1.0 / Ra;
242  Im_ += ( Vm - Vm_ ) / Ra;
243 }
void Compartment::vInitProc ( const Eref e,
ProcPtr  p 
)
virtual

The initProc function is for a second phase of 'process' operations. It sends the axial and raxial messages to other compartments. It has to be executed out of phase with the main process so that all compartments are equivalent and there is no calling order dependence in the results.

Implements moose::CompartmentBase.

Reimplemented in SymCompartment.

Definition at line 219 of file Compartment.cpp.

References axialOut, Ra_, raxialOut, and Vm_.

220 {
221  // Send out the axial messages
222  axialOut->send( e, Vm_ );
223  // Send out the raxial messages
224  raxialOut->send( e, Ra_, Vm_ );
225 }
const SrcFinfo2< double, double > * raxialOut
Definition: Compartment.cpp:66
const SrcFinfo1< double > * axialOut
Definition: Compartment.cpp:62
void Compartment::vInitReinit ( const Eref e,
ProcPtr  p 
)
virtual

Empty function to do another reinit step out of phase with the main one. Nothing needs doing there.

Implements moose::CompartmentBase.

Reimplemented in SymCompartment.

Definition at line 227 of file Compartment.cpp.

228 {
229  ; // Nothing happens here
230 }
void Compartment::vInjectMsg ( const Eref e,
double  current 
)
virtual

Injects a constantly updated current into the compartment. Unlike the 'inject' field, this injected current is applicable only for a single timestep. So this is meant to be used as the destination of a message rather than as a one-time assignment.

Implements moose::CompartmentBase.

Definition at line 252 of file Compartment.cpp.

References Im_, and sumInject_.

253 {
254  sumInject_ += current;
255  Im_ += current;
256 }
void Compartment::vProcess ( const Eref e,
ProcPtr  p 
)
virtual

The process function does the object updating and sends out messages to channels, nernsts, and so on.

Implements moose::CompartmentBase.

Reimplemented in moose::IzhIF, moose::IntFireBase, moose::AdExIF, moose::AdThreshIF, moose::QIF, moose::ExIF, and moose::LIF.

Definition at line 181 of file Compartment.cpp.

References A_, B_, Cm_, ProcInfo::dt, Em_, EPSILON, Im_, inject_, invRm_, lastIm_, sumInject_, Vm_, and moose::CompartmentBase::VmOut().

Referenced by moose::LIF::vProcess(), moose::ExIF::vProcess(), moose::AdExIF::vProcess(), and moose::AdThreshIF::vProcess().

182 {
183  //cout << "Compartment " << e.id().path() << ":: process: A = " << A_ << ", B = " << B_ << endl;
184  A_ += inject_ + sumInject_ + Em_ * invRm_;
185  if ( B_ > EPSILON )
186  {
187  double x = exp( -B_ * p->dt / Cm_ );
188  Vm_ = Vm_ * x + ( A_ / B_ ) * ( 1.0 - x );
189  }
190  else
191  {
192  Vm_ += ( A_ - Vm_ * B_ ) * p->dt / Cm_;
193  }
194  A_ = 0.0;
195  B_ = invRm_;
196  lastIm_ = Im_;
197  Im_ = 0.0;
198  sumInject_ = 0.0;
199  // Send out Vm to channels, SpikeGens, etc.
200  VmOut()->send( e, Vm_ );
201 
202  // The axial/raxial messages go out in the 'init' phase.
203 }
static const double EPSILON
Definition: Compartment.h:135
double dt
Definition: ProcInfo.h:18
static SrcFinfo1< double > * VmOut()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Compartment::vRandInject ( const Eref e,
double  prob,
double  current 
)
virtual

Injects a constantly updated current into the compartment, with a probability prob. Note that it isn't the current amplitude that is random, it is the presence or absence of the current that is probabilistic.

Implements moose::CompartmentBase.

Definition at line 258 of file Compartment.cpp.

References dt_, Im_, moose::mtrand(), and sumInject_.

259 {
260  if ( moose::mtrand() < prob * dt_ )
261  {
262  sumInject_ += current;
263  Im_ += current;
264  }
265 }
double mtrand(void)
Generate a random double between 0 and 1.
Definition: global.cpp:97

+ Here is the call graph for this function:

void Compartment::vReinit ( const Eref e,
ProcPtr  p 
)
virtual

The reinit function reinitializes all fields.

Implements moose::CompartmentBase.

Reimplemented in moose::IzhIF, moose::IntFireBase, moose::AdExIF, moose::AdThreshIF, moose::QIF, SymCompartment, moose::ExIF, and moose::LIF.

Definition at line 205 of file Compartment.cpp.

References A_, B_, ProcInfo::dt, dt_, Im_, initVm_, invRm_, lastIm_, sumInject_, Vm_, and moose::CompartmentBase::VmOut().

Referenced by moose::LIF::vReinit(), moose::ExIF::vReinit(), SymCompartment::vReinit(), moose::QIF::vReinit(), moose::AdExIF::vReinit(), moose::AdThreshIF::vReinit(), and moose::IzhIF::vReinit().

206 {
207  Vm_ = initVm_;
208  A_ = 0.0;
209  B_ = invRm_;
210  Im_ = 0.0;
211  lastIm_ = 0.0;
212  sumInject_ = 0.0;
213  dt_ = p->dt;
214 
215  // Send out the resting Vm to channels, SpikeGens, etc.
216  VmOut()->send( e, Vm_ );
217 }
double dt
Definition: ProcInfo.h:18
static SrcFinfo1< double > * VmOut()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Compartment::vSetCm ( const Eref e,
double  Cm 
)
virtual

Implements moose::CompartmentBase.

Definition at line 117 of file Compartment.cpp.

References Cm_, and moose::CompartmentBase::rangeWarning().

118 {
119  if ( rangeWarning( "Cm", Cm ) ) return;
120  Cm_ = Cm;
121 }
bool rangeWarning(const string &field, double value)

+ Here is the call graph for this function:

void Compartment::vSetEm ( const Eref e,
double  Em 
)
virtual

Implements moose::CompartmentBase.

Definition at line 107 of file Compartment.cpp.

References Em_.

108 {
109  Em_ = Em;
110 }
void Compartment::vSetInitVm ( const Eref e,
double  initVm 
)
virtual

Implements moose::CompartmentBase.

Definition at line 166 of file Compartment.cpp.

References initVm_.

167 {
168  initVm_ = initVm;
169 }
void Compartment::vSetInject ( const Eref e,
double  Inject 
)
virtual

Implements moose::CompartmentBase.

Definition at line 156 of file Compartment.cpp.

References inject_.

157 {
158  inject_ = inject;
159 }
void Compartment::vSetRa ( const Eref e,
double  Ra 
)
virtual

Implements moose::CompartmentBase.

Definition at line 140 of file Compartment.cpp.

References Ra_, and moose::CompartmentBase::rangeWarning().

141 {
142  if ( rangeWarning( "Ra", Ra ) ) return;
143  Ra_ = Ra;
144 }
bool rangeWarning(const string &field, double value)

+ Here is the call graph for this function:

void Compartment::vSetRm ( const Eref e,
double  Rm 
)
virtual

Implements moose::CompartmentBase.

Definition at line 128 of file Compartment.cpp.

References invRm_, moose::CompartmentBase::rangeWarning(), and Rm_.

129 {
130  if ( rangeWarning( "Rm", Rm ) ) return;
131  Rm_ = Rm;
132  invRm_ = 1.0/Rm;
133 }
bool rangeWarning(const string &field, double value)

+ Here is the call graph for this function:

void Compartment::vSetVm ( const Eref e,
double  Vm 
)
virtual

Implements moose::CompartmentBase.

Definition at line 97 of file Compartment.cpp.

References Vm_.

98 {
99  Vm_ = Vm;
100 }

Member Data Documentation

double moose::Compartment::Cm_
protected
double moose::Compartment::dt_
private

Definition at line 134 of file Compartment.h.

Referenced by vRandInject(), and vReinit().

double moose::Compartment::Em_
protected
const double Compartment::EPSILON = 1.0e-15
staticprivate

Definition at line 135 of file Compartment.h.

Referenced by vProcess().

double moose::Compartment::initVm_
protected

Definition at line 120 of file Compartment.h.

Referenced by Compartment(), vGetInitVm(), vReinit(), and vSetInitVm().

double moose::Compartment::inject_
protected
double moose::Compartment::invRm_
private

Definition at line 133 of file Compartment.h.

Referenced by Compartment(), vProcess(), vReinit(), and vSetRm().

double moose::Compartment::lastIm_
protected

The documentation for this class was generated from the following files: