-
Notifications
You must be signed in to change notification settings - Fork 0
/
HSolveStruct.h
172 lines (148 loc) · 4.15 KB
/
HSolveStruct.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** copyright (C) 2003-2007 Upinder S. Bhalla, Niraj Dudani and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#ifndef _HSOLVE_STRUCT_H
#define _HSOLVE_STRUCT_H
typedef double ( *PFDD )( double, double );
struct CompartmentStruct
{
double CmByDt;
double EmByRm;
};
/**
* InjectStruct stores two different kinds of injected currents - one is a
* "basal" injection, which the user sets at the start of the simulation,
* and remains constant as long as the simulation is running. The user
* could potentially run the simulation for N time steps, stop, change
* the value, and then resume, however.
* The second kind is a "varying" injection, meaning that it comes
* from some other part of moose via a message. So this thing has an
* associated destFinfo. injectVarying is set to zero at every time
* step.
*/
struct InjectStruct
{
InjectStruct()
:
injectVarying( 0.0 ),
injectBasal( 0.0 )
{ ; }
double injectVarying;
double injectBasal;
};
/**
* Channel-specific current struct. Used as the structure for the vector
* current_ (in HSolveActive).
*/
struct CurrentStruct
{
double Gk;
double Ek;
};
/** Structure for a channel. */
struct ChannelStruct
{
public:
double Gbar_;
PFDD takeXpower_; // Some clever method of actually applying the
PFDD takeYpower_; // power on the fraction of gates.
PFDD takeZpower_;
double Xpower_; // Actual powers for each gate.
double Ypower_;
double Zpower_;
/**
* Extra values for GPU execution
*/
vector<double> Xparams;
vector<double> Yparams;
vector<double> Zparams;
/**
* Instantaneously change conductance - conductance follows no kinetics
* It's like tau = 0 => conductance change directly mirrors voltage
* step.
*/
int instant_;
/**
* Sets the powers and accordingly sets the takePower_ functions.
*/
void setPowers( double Xpower, double Ypower, double Zpower );
/**
* Finds the fraction for each gate by raising the "state" to the
* appropriate power. current.Gk is then set to Gbar_ times the
* calculated fraction. Note, "current" is a parameter.
*/
void process( double*& state, CurrentStruct& current );
private:
static PFDD selectPower( double power );
/** The aforementioned clever stuff. */
static double power1( double x, double p ) {
return x;
}
static double power2( double x, double p ) {
return x * x;
}
static double power3( double x, double p ) {
return x * x * x;
}
static double power4( double x, double p ) {
return power2( x * x, p );
}
static double powerN( double x, double p );
};
/**
* Contains information about the spikegens that the HSolve object needs to
* talk with
*/
struct SpikeGenStruct
{
SpikeGenStruct( double* Vm, Eref e )
:
Vm_( Vm ),
e_( e )
{ ; }
double* Vm_;
Eref e_;
/** Finds the spikegen object using e_ and calls reinit on the spikegen */
void reinit( ProcPtr info );
void send( ProcPtr info );
};
struct SynChanStruct
{
// Index of parent compartment
unsigned int compt_;
Id elm_;
};
struct CaConcStruct
{
double c_; ///> Dynamic calcium concentration, over CaBasal_
double CaBasal_; ///> Reference calcium concentration
double factor1_; ///> Both these factors are functions of tau, B and dt.
double factor2_;
double ceiling_; ///> Ceiling and floor for lookup tables
double floor_;
CaConcStruct();
CaConcStruct(
double Ca,
double CaBasal,
double tau,
double B,
double ceiling,
double floor,
double dt );
void setCa( double Ca ); // c_ = Ca - CaBasal_
/** change CaBasal_ and update c_ accordingly. */
void setCaBasal( double CaBasal );
/** Sets the factors using the appropriate functions. */
void setTauB( double tau, double B, double dt );
/**
* Compute Ca concentration from factors and activation value.
* Also takes care of Ca concetration exceeding min and max values.
*/
double process( double activation );
};
#endif // _HSOLVE_STRUCT_H