MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GapJunction.cpp
Go to the documentation of this file.
1 // GapJunction.cpp ---
2 //
3 // Filename: GapJunction.cpp
4 // Description: Implements Gap junction
5 // Author: Subhasis Ray
6 // Maintainer:
7 // Created: Tue Jul 2 11:40:13 2013 (+0530)
8 // Version:
9 // Last-Updated: Tue Jul 2 14:26:01 2013 (+0530)
10 // By: subha
11 // Update #: 77
12 // URL:
13 // Keywords:
14 // Compatibility:
15 //
16 //
17 
18 // Commentary:
19 //
20 //
21 //
22 //
23 
24 // Change log:
25 //
26 //
27 //
28 //
29 // This program is free software; you can redistribute it and/or
30 // modify it under the terms of the GNU General Public License as
31 // published by the Free Software Foundation; either version 3, or
32 // (at your option) any later version.
33 //
34 // This program is distributed in the hope that it will be useful,
35 // but WITHOUT ANY WARRANTY; without even the implied warranty of
36 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37 // General Public License for more details.
38 //
39 // You should have received a copy of the GNU General Public License
40 // along with this program; see the file COPYING. If not, write to
41 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42 // Floor, Boston, MA 02110-1301, USA.
43 //
44 //
45 
46 // Code:
47 
48 #include "header.h"
49 #include "GapJunction.h"
50 
52 {
54  "channel1Out",
55  "Sends Gk and Vm from one compartment to the other");
56  return &channel1Out;
57 }
58 
60 {
62  "channel2Out",
63  "Sends Gk and Vm from one compartment to the other");
64  return &channel2Out;
65 }
66 
68 {
69 
71  "Gk",
72  "Conductance of the gap junction",
75 
77  // Shared messages
79  static DestFinfo process(
80  "process",
81  "Handles 'process' call",
83 
84  static DestFinfo reinit(
85  "reinit",
86  "Handles 'reinit' call",
88 
89  static Finfo* processShared[] = {
90  &process, &reinit
91  };
92 
93  static SharedFinfo proc(
94  "proc",
95  "This is a shared message to receive Process messages "
96  "from the scheduler objects. The Process should be called "
97  "_second_ in each clock tick, after the Init message."
98  "The first entry in the shared msg is a MsgDest "
99  "for the Process operation. It has a single argument, "
100  "ProcInfo, which holds lots of information about current "
101  "time, thread, dt and so on. The second entry is a MsgDest "
102  "for the Reinit operation. It also uses ProcInfo. ",
103  processShared, sizeof( processShared ) / sizeof( Finfo* ));
104 
105  static DestFinfo Vm1(
106  "Vm1",
107  "Handles Vm message from compartment",
109 
110  static Finfo * channel1Shared[] = {
111  channel1Out(), &Vm1,
112  };
113 
114  static SharedFinfo channel1(
115  "channel1",
116  "This is a shared message to couple the conductance and Vm from\n"
117  "terminal 2 to the compartment at terminal 1. The first entry is source\n"
118  "sending out Gk and Vm2, the second entry is destination for Vm1.",
119  channel1Shared, sizeof(channel1Shared)/sizeof(Finfo*));
120 
121  static DestFinfo Vm2(
122  "Vm2",
123  "Handles Vm message from another compartment",
125 
126  static Finfo * channel2Shared[] = {
127  channel2Out(), &Vm2,
128  };
129 
130  static SharedFinfo channel2(
131  "channel2",
132  "This is a shared message to couple the conductance and Vm from\n"
133  "terminal 1 to the compartment at terminal 2. The first entry is source\n"
134  "sending out Gk and Vm1, the second entry is destination for Vm2.",
135  channel2Shared, sizeof(channel2Shared)/sizeof(Finfo*));
136 
137  static Finfo * gapJunctionFinfos[] =
138  {
139  &channel1,
140  &channel2,
141  &Gk,
142  &proc
143  };
144 
145  static string doc[] = {
146  "Name", "GapJunction",
147  "Author", "Subhasis Ray, 2013",
148  "Description", "Implementation of gap junction between two compartments. The shared\n"
149  "fields, 'channel1' and 'channel2' can be connected to the 'channel'\n"
150  "message of the compartments at either end of the gap junction. The\n"
151  "compartments will send their Vm to the gap junction and receive the\n"
152  "conductance 'Gk' of the gap junction and the Vm of the other\n"
153  "compartment."
154  };
155 
156  static Dinfo< GapJunction > dinfo;
157  static Cinfo gapJunctionCinfo(
158  "GapJunction",
160  gapJunctionFinfos,
161  sizeof(gapJunctionFinfos)/sizeof(Finfo*),
162  &dinfo,
163  doc,
164  sizeof(doc) / sizeof(string));
165  return &gapJunctionCinfo;
166 }
167 
169 
170 GapJunction::GapJunction():Vm1_(0.0), Vm2_(0.0), Gk_(1e-9)
171 {
172  ;
173 }
174 
176 {
177  ;
178 }
179 
180 void GapJunction::setGk( double g )
181 {
182  Gk_ = g;
183 }
184 
185 double GapJunction::getGk() const
186 {
187  return Gk_;
188 }
189 
190 void GapJunction::setVm1( double v )
191 {
192  Vm1_ = v;
193 }
194 
195 void GapJunction::setVm2( double v )
196 {
197  Vm2_ = v;
198 }
199 
200 void GapJunction::process( const Eref& e, ProcPtr p )
201 {
202  channel1Out()->send(e, Gk_, Vm2_);
203  channel2Out()->send(e, Gk_, Vm1_);
204 }
205 
207 {
208  Vm1_ = 0.0;
209  Vm2_ = 0.0;
210 }
211 
212 
213 
214 //
215 // GapJunction.cpp ends here
void reinit(const Eref &e, ProcPtr p)
double Vm1_
Definition: GapJunction.h:76
void process(const Eref &e, ProcPtr p)
double getGk() const
static SrcFinfo2< double, double > * channel2Out()
Definition: GapJunction.cpp:59
Definition: Dinfo.h:60
double Gk_
Definition: GapJunction.h:78
double Vm2_
Definition: GapJunction.h:77
void setGk(double g)
static const Cinfo * gapJunctionCinfo
static const Cinfo * initCinfo()
Definition: GapJunction.cpp:67
static SrcFinfo2< double, double > * channel1Out()
Definition: GapJunction.cpp:51
Definition: OpFunc.h:27
Definition: Eref.h:26
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
Definition: Cinfo.h:18
void setVm2(double Vm)
void setVm1(double Vm)
Definition: Finfo.h:12