00001 /********************************************************************** 00002 ** This program is part of 'MOOSE', the 00003 ** Messaging Object Oriented Simulation Environment. 00004 ** copyright (C) 2003-2007 Upinder S. Bhalla, Niraj Dudani and NCBS 00005 ** It is made available under the terms of the 00006 ** GNU Lesser General Public License version 2.1 00007 ** See the file COPYING.LIB for the full notice. 00008 **********************************************************************/ 00009 00010 #ifndef _HSOLVE_ACTIVE_H 00011 #define _HSOLVE_ACTIVE_H 00012 00013 #include "../basecode/header.h" 00014 #include <set> 00015 #include <limits> // Max and min 'double' values needed for lookup table init. 00016 #include "../biophysics/CaConcBase.h" 00017 #include "../biophysics/HHGate.h" 00018 #include "../biophysics/ChanBase.h" 00019 #include "../biophysics/ChanCommon.h" 00020 #include "../biophysics/HHChannelBase.h" 00021 #include "../biophysics/HHChannel.h" 00022 #include "../biophysics/SpikeGen.h" 00023 #include "HSolveUtils.h" 00024 #include "HSolveStruct.h" 00025 #include "HinesMatrix.h" 00026 #include "HSolvePassive.h" 00027 #include "RateLookup.h" 00028 00029 class HSolveActive: public HSolvePassive 00030 { 00031 typedef vector< CurrentStruct >::iterator currentVecIter; 00032 00033 public: 00034 HSolveActive(); 00035 00036 void setup( Id seed, double dt ); 00037 void step( ProcPtr info ); 00038 void reinit( ProcPtr info ); 00039 00040 protected: 00053 int caAdvance_; 00054 00063 double vMin_; 00064 double vMax_; 00065 int vDiv_; 00066 double caMin_; 00067 double caMax_; 00068 int caDiv_; 00069 00073 vector< CurrentStruct > current_; 00074 vector< double > state_; 00075 //~ vector< int > instant_; 00076 vector< ChannelStruct > channel_; 00077 00078 vector< SpikeGenStruct > spikegen_; 00079 vector< SynChanStruct > synchan_; 00080 vector< CaConcStruct > caConc_; 00081 vector< double > ca_; 00082 vector< double > caActivation_; 00083 00084 vector< double* > caTarget_; 00085 00086 00087 LookupTable vTable_; 00088 LookupTable caTable_; 00089 vector< bool > gCaDepend_; 00090 00091 vector< unsigned int > caCount_; 00092 00093 vector< int > caDependIndex_; 00094 00095 vector< LookupColumn > column_; 00096 00097 vector< LookupRow > caRowCompt_; 00104 vector< LookupRow* > caRow_; 00109 vector< int > channelCount_; 00110 00111 vector< currentVecIter > currentBoundary_; 00112 00113 00114 vector< unsigned int > chan2compt_; 00115 00116 00117 vector< unsigned int > chan2state_; 00118 00119 vector< double > externalCurrent_; 00120 00121 00122 vector< Id > caConcId_; 00123 vector< Id > channelId_; 00124 vector< Id > gateId_; 00125 //~ vector< vector< Id > > externalChannelId_; 00126 vector< unsigned int > outVm_; 00130 vector< unsigned int > outCa_; 00135 private: 00139 void readHHChannels(); 00140 void readGates(); 00141 void readCalcium(); 00142 void readSynapses(); 00143 void readExternalChannels(); 00144 void createLookupTables(); 00145 void manageOutgoingMessages(); 00146 00147 void cleanup(); 00148 00152 void reinitSpikeGens( ProcPtr info ); 00153 void reinitCompartments(); 00154 void reinitCalcium(); 00155 void reinitChannels(); 00156 00160 void calculateChannelCurrents(); 00161 void updateMatrix(); 00162 void forwardEliminate(); 00163 void backwardSubstitute(); 00164 void advanceCalcium(); 00165 void advanceChannels( double dt ); 00166 void advanceSynChans( ProcPtr info ); 00167 void sendSpikes( ProcPtr info ); 00168 void sendValues( ProcPtr info ); 00169 00170 static const int INSTANT_X; 00171 static const int INSTANT_Y; 00172 static const int INSTANT_Z; 00173 }; 00174 00175 #endif // _HSOLVE_ACTIVE_H