MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ChanBase.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 "header.h"
11 #include "ElementValueFinfo.h"
12 #include "ChanBase.h"
13 
15 {
16  static SrcFinfo1< double > permeability( "permeabilityOut",
17  "Conductance term going out to GHK object" );
18  return &permeability;
19 }
20 
22 {
23  static SrcFinfo2< double, double > channelOut( "channelOut",
24  "Sends channel variables Gk and Ek to compartment" );
25  return &channelOut;
26 }
27 
29 {
30  static SrcFinfo1< double > IkOut( "IkOut",
31  "Channel current. This message typically goes to concen"
32  "objects that keep track of ion concentration." );
33  return &IkOut;
34 }
35 
37 {
39  // Shared messages
41  static DestFinfo process( "process",
42  "Handles process call",
44  static DestFinfo reinit( "reinit",
45  "Handles reinit call",
47 
48  static Finfo* processShared[] =
49  {
50  &process, &reinit
51  };
52 
53  static SharedFinfo proc( "proc",
54  "Shared message to receive Process message from scheduler",
55  processShared, sizeof( processShared ) / sizeof( Finfo* ) );
56 
59  static DestFinfo Vm( "Vm",
60  "Handles Vm message coming in from compartment",
62 
63  static Finfo* channelShared[] =
64  {
65  channelOut(), &Vm
66  };
67  static SharedFinfo channel( "channel",
68  "This is a shared message to couple channel to compartment. "
69  "The first entry is a MsgSrc to send Gk and Ek to the compartment "
70  "The second entry is a MsgDest for Vm from the compartment.",
71  channelShared, sizeof( channelShared ) / sizeof( Finfo* )
72  );
73 
75  // Here we reuse the Vm DestFinfo declared above.
76 
78  static Finfo* ghkShared[] =
79  {
80  &Vm, permeability()
81  };
82  static SharedFinfo ghk( "ghk",
83  "Message to Goldman-Hodgkin-Katz object",
84  ghkShared, sizeof( ghkShared ) / sizeof( Finfo* ) );
85 
87 // Field definitions
89 
90  static ElementValueFinfo< ChanBase, double > Gbar( "Gbar",
91  "Maximal channel conductance",
94  );
95  static ElementValueFinfo< ChanBase, double > modulation( "modulation",
96  "Modulation, i.e, scale factor for channel conductance."
97  "Note that this is a regular parameter, it is not "
98  "recomputed each timestep. Thus one can use a slow update, "
99  "say, from a molecule pool, to send a message to set "
100  "the modulation, and it will stay at the set value even if "
101  "the channel runs many timesteps before the next assignment. "
102  "This differs from the GENESIS semantics of a similar message,"
103  "which required update each timestep. ",
106  );
108  "Reversal potential of channel",
111  );
113  "Channel conductance variable",
116  );
118  "Channel current variable",
120  );
121 
123 // MsgSrc definitions
125  // IkOut SrcFinfo defined above.
126 
128 // MsgDest definitions
130 
132  static Finfo* ChanBaseFinfos[] =
133  {
134  &channel, // Shared
135  &ghk, // Shared
136  &Gbar, // Value
137  &modulation, // Value
138  &Ek, // Value
139  &Gk, // Value
140  &Ik, // ReadOnlyValue
141  IkOut(), // Src
142  &proc, // Shared
143  };
144 
145  static string doc[] =
146  {
147  "Name", "ChanBase",
148  "Author", "Upinder S. Bhalla, 2007-2014, NCBS",
149  "Description", "ChanBase: Base class for assorted ion channels."
150  "Presents a common interface for all of them. ",
151  };
152 
153  static ZeroSizeDinfo< int > dinfo;
154 
155  static Cinfo ChanBaseCinfo(
156  "ChanBase",
158  ChanBaseFinfos,
159  sizeof( ChanBaseFinfos )/sizeof(Finfo *),
160  &dinfo,
161  doc,
162  sizeof(doc)/sizeof(string)
163  );
164 
165  return &ChanBaseCinfo;
166 }
167 
170 
171 
173 // Constructor
176 { ; }
177 
179 {;}
180 
182 // Field function definitions
184 //
185 void ChanBase::setGbar( const Eref& e, double Gbar )
186 {
187  // Call virtual functions of derived classes for this operation.
188  vSetGbar( e, Gbar );
189 }
190 
191 double ChanBase::getGbar( const Eref& e ) const
192 {
193  return vGetGbar( e );
194 }
195 
196 void ChanBase::setModulation( const Eref& e, double modulation )
197 {
198  // Call virtual functions of derived classes for this operation.
199  vSetModulation( e, modulation );
200 }
201 
202 double ChanBase::getModulation( const Eref& e ) const
203 {
204  return vGetModulation( e );
205 }
206 
207 void ChanBase::setEk( const Eref& e, double Ek )
208 {
209  vSetEk( e, Ek );
210 }
211 double ChanBase::getEk( const Eref& e ) const
212 {
213  return vGetEk( e );
214 }
215 
216 void ChanBase::setGk( const Eref& e, double Gk )
217 {
218  vSetGk( e, Gk );
219 }
220 double ChanBase::getGk( const Eref& e ) const
221 {
222  return vGetGk( e );
223 }
224 
225 void ChanBase::setIk( const Eref& e, double Ik )
226 {
227  vSetIk( e, Ik );
228 }
229 double ChanBase::getIk( const Eref& e ) const
230 {
231  return vGetIk( e );
232 }
233 
235 // Dest function definitions
237 
238 void ChanBase::handleVm( double Vm )
239 {
240  vHandleVm( Vm );
241 }
242 
244 // Looks like a dest function, but it is only called
245 // from the child class. Sends out various messages.
247 
248 void ChanBase::process( const Eref& e, const ProcPtr info )
249 {
250  vProcess( e, info );
251 }
252 
253 
254 void ChanBase::reinit( const Eref& e, const ProcPtr info )
255 {
256  vReinit( e, info );
257 }
static const Cinfo * chanBaseCinfo
Definition: ChanBase.cpp:168
void setIk(const Eref &e, double Ic)
Definition: ChanBase.cpp:225
virtual void vSetIk(const Eref &e, double Ik)=0
virtual void vSetEk(const Eref &e, double Ek)=0
double getEk(const Eref &e) const
Definition: ChanBase.cpp:211
void setEk(const Eref &e, double Ek)
Definition: ChanBase.cpp:207
virtual double vGetGbar(const Eref &e) const =0
virtual double vGetGk(const Eref &e) const =0
virtual double vGetIk(const Eref &e) const =0
double getGk(const Eref &e) const
Definition: ChanBase.cpp:220
virtual void vSetGk(const Eref &e, double Gk)=0
double getModulation(const Eref &e) const
Definition: ChanBase.cpp:202
void setGk(const Eref &e, double Gk)
Definition: ChanBase.cpp:216
void reinit(const Eref &e, const ProcPtr info)
Definition: ChanBase.cpp:254
void setModulation(const Eref &e, double modulation)
Definition: ChanBase.cpp:196
void process(const Eref &e, const ProcPtr info)
Definition: ChanBase.cpp:248
static SrcFinfo1< double > * permeability()
Definition: ChanBase.cpp:14
virtual void vHandleVm(double Vm)=0
void handleVm(double Vm)
Definition: ChanBase.cpp:238
virtual void vReinit(const Eref &e, const ProcPtr info)=0
static SrcFinfo1< double > * IkOut()
Definition: ChanBase.cpp:28
virtual void vSetGbar(const Eref &e, double Gbar)=0
Definition: OpFunc.h:27
Definition: Eref.h:26
virtual void vSetModulation(const Eref &e, double modulation)=0
virtual double vGetModulation(const Eref &e) const =0
static SrcFinfo2< double, double > * channelOut()
Definition: ChanBase.cpp:21
void setGbar(const Eref &e, double Gbar)
Definition: ChanBase.cpp:185
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
double getIk(const Eref &e) const
Definition: ChanBase.cpp:229
double getGbar(const Eref &e) const
Definition: ChanBase.cpp:191
Definition: Cinfo.h:18
static const Cinfo * initCinfo()
Specify the Class Info static variable for initialization.
Definition: ChanBase.cpp:36
Definition: Finfo.h:12
virtual void vProcess(const Eref &e, const ProcPtr info)=0
virtual double vGetEk(const Eref &e) const =0