00001 #ifndef _HHChannel2D_h
00002 #define _HHChannel2D_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00021
00022
00023 typedef double ( *PFDD )( double, double );
00024 class HHChannel2D: public ChanCommon
00025 {
00026 #ifdef DO_UNIT_TESTS
00027 friend void testHHChannel2D();
00028 #endif // DO_UNIT_TESTS
00029
00030 public:
00031 HHChannel2D();
00032
00034
00036 void setUseConcentration( int value );
00037 int getUseConcentration( );
00038 void setXindex( string index );
00039 string getXindex() const;
00040 void setYindex( string index );
00041 string getYindex() const;
00042 void setZindex( string index );
00043 string getZindex() const;
00044
00045 void setXpower( const Eref& e, double Xpower );
00046 double getXpower( const Eref& e) const;
00047 void setYpower( const Eref& e, double Ypower );
00048 double getYpower( const Eref& e ) const;
00049 void setZpower( const Eref& e, double Zpower );
00050 double getZpower( const Eref& e ) const;
00051 void setInstant( int Instant );
00052 int getInstant() const;
00053 void setX( double X );
00054 double getX() const;
00055 void setY( double Y );
00056 double getY() const;
00057 void setZ( double Z );
00058 double getZ() const;
00059
00061 HHGate2D* getXgate( unsigned int i );
00063 HHGate2D* getYgate( unsigned int i );
00065 HHGate2D* getZgate( unsigned int i );
00067 void setNumGates( unsigned int num );
00068
00073 unsigned int getNumXgates() const;
00075 unsigned int getNumYgates() const;
00077 unsigned int getNumZgates() const;
00078
00080
00082
00094 void vProcess( const Eref& e, ProcPtr p );
00095
00103 void vReinit( const Eref& e, ProcPtr p );
00110 void conc1( double conc );
00111 void conc2( double conc );
00112
00113 double ( *takeXpower_ )( double, double );
00114 double ( *takeYpower_ )( double, double );
00115 double ( *takeZpower_ )( double, double );
00116
00124 void createGate( const Eref& e, string gateType );
00125
00127 void innerCreateGate(
00128 const string& gateName,
00129 HHGate2D** gatePtr, Id chanId, Id gateId );
00130
00132 bool checkOriginal( Id chanId ) const;
00133
00140 void destroyGate( const Eref& e, string gateType );
00141
00145 void innerDestroyGate( const string& gateName,
00146 HHGate2D** gatePtr, Id chanId );
00147
00151 bool setGatePower( const Eref& e, double power,
00152 double* assignee, const string& gateType );
00153
00154 static PFDD selectPower( double power);
00155
00156 static const Cinfo* initCinfo();
00157
00158 private:
00159 int dependency( string index, unsigned int dim );
00160 double depValue( int dependency );
00161 double integrate( double state, double dt, double A, double B );
00162
00163 double Xpower_;
00164 double Ypower_;
00165 double Zpower_;
00166
00168 int instant_;
00169 double X_;
00170 double Y_;
00171 double Z_;
00172
00176 bool xInited_, yInited_, zInited_;
00177
00178 double g_;
00179
00180 double conc1_;
00181 double conc2_;
00182
00183 string Xindex_;
00184 string Yindex_;
00185 string Zindex_;
00186
00187 int Xdep0_;
00188 int Xdep1_;
00189 int Ydep0_;
00190 int Ydep1_;
00191 int Zdep0_;
00192 int Zdep1_;
00193
00199 HHGate2D* xGate_;
00200 HHGate2D* yGate_;
00201 HHGate2D* zGate_;
00202
00203 static const double EPSILON;
00204 static const int INSTANT_X;
00205 static const int INSTANT_Y;
00206 static const int INSTANT_Z;
00207
00208 static double power1( double x, double p ) {
00209 return x;
00210 }
00211 static double power2( double x, double p ) {
00212 return x * x;
00213 }
00214 static double power3( double x, double p ) {
00215 return x * x * x;
00216 }
00217 static double power4( double x, double p ) {
00218 return power2( x * x, p );
00219 }
00220 static double powerN( double x, double p );
00221 };
00222
00223
00224 #endif // _HHChannel2D_h