18 #include "../biophysics/Compartment.h"
20 #include "../biophysics/CaConcBase.h"
22 #include "../biophysics/HHGate.h"
23 #include "../biophysics/ChanBase.h"
24 #include "../biophysics/ChanCommon.h"
25 #include "../biophysics/HHChannel.h"
26 #include "../biophysics/CaConc.h"
28 #include "../shell/Shell.h"
34 "Handles 'process' call: Solver advances by one time-step.",
40 "Handles 'reinit' call: Solver reads in model.",
44 static Finfo* processShared[] =
52 "Handles 'reinit' and 'process' calls from a clock.",
54 sizeof( processShared ) /
sizeof(
Finfo* )
59 "Use this field to specify path to a 'seed' compartment, that is, "
60 "any compartment within a neuron. The HSolve object uses this seed as "
61 "a handle to discover the rest of the neuronal model, which means all "
62 "the remaining compartments, channels, synapses, etc.",
69 "Specifies the path to a compartmental model to be taken over. "
70 "This can be the path to any container object that has the model "
71 "under it (found by performing a deep search). Alternatively, this "
72 "can also be the path to any compartment within the neuron. This "
73 "compartment will be used as a handle to discover the rest of the "
74 "model, which means all the remaining compartments, channels, "
82 "The time-step for this solver.",
89 "This flag determines how current flowing into a calcium pool "
90 "is computed. A value of 0 means that the membrane potential at the "
91 "beginning of the time-step is used for the calculation. This is how "
92 "GENESIS does its computations. A value of 1 means the membrane "
93 "potential at the middle of the time-step is used. This is the "
94 "correct way of integration, and is the default way.",
101 "Specifies number of divisions for lookup tables of voltage-sensitive "
109 "Specifies the lower bound for lookup tables of voltage-sensitive "
110 "channels. Default is to automatically decide based on the tables of "
111 "the channels that the solver reads in.",
118 "Specifies the upper bound for lookup tables of voltage-sensitive "
119 "channels. Default is to automatically decide based on the tables of "
120 "the channels that the solver reads in.",
127 "Specifies number of divisions for lookup tables of calcium-sensitive "
135 "Specifies the lower bound for lookup tables of calcium-sensitive "
136 "channels. Default is to automatically decide based on the tables of "
137 "the channels that the solver reads in.",
144 "Specifies the upper bound for lookup tables of calcium-sensitive "
145 "channels. Default is to automatically decide based on the tables of "
146 "the channels that the solver reads in.",
151 static Finfo* hsolveFinfos[] =
166 static string doc[] =
169 "Author",
"Niraj Dudani, 2007, NCBS",
170 "Description",
"HSolve: Hines solver, for solving "
171 "branching neuron models.",
179 sizeof( hsolveFinfos ) /
sizeof(
Finfo* ),
182 sizeof(doc)/
sizeof(
string)
219 vector< Id >::const_iterator i;
220 vector< ObjId > temp;
223 temp.push_back(
ObjId( *i, 0 ) );
225 CompartmentBase::zombify( i->eref().element(),
231 temp.push_back(
ObjId( *i, 0 ) );
239 temp.push_back(
ObjId( *i, 0 ) );
248 vector< Id >::const_iterator i;
251 if ( i->element() ) {
252 CompartmentBase::zombify( i->eref().element(),
253 Compartment::initCinfo(),
Id() );
257 if ( i->element() ) {
262 if ( i->element() ) {
285 cerr <<
"Error: HSolve::setSeed(): Seed object '" << seed.
path()
286 <<
"' is not derived from type 'Compartment'." << endl;
302 cerr <<
"Error: HSolve::setPath(): Must set 'dt' first.\n";
309 cerr <<
"Warning: HSolve::setPath(): No compartments found at or below '"
352 vector< vector< Id > > cstack( 1, vector< Id >( 1, base ) );
356 while ( !cstack.empty() )
357 if ( cstack.back().empty() )
361 if ( !cstack.empty() )
362 cstack.back().pop_back();
366 current = cstack.back().back();
375 cstack.push_back(
children( current ) );
396 cerr <<
"Error: HSolve: 'dt' must be positive.\n";
410 if ( caAdvance != 0 && caAdvance != 1 )
412 cerr <<
"Error: HSolve: caAdvance should be either 0 or 1.\n";
486 static set<string> classes;
489 classes.insert(
"CaConc");
490 classes.insert(
"ZombieCaConc");
491 classes.insert(
"HHChannel");
492 classes.insert(
"ZombieHHChannel");
493 classes.insert(
"Compartment");
494 classes.insert(
"SymCompartment");
495 classes.insert(
"ZombieCompartment");
530 Id create_testobject(vector<Id> & container,
string classname,
Id parent,
string name, vector<int> dims)
533 Id nid = shell->
doCreate( classname, parent, name, dims );
534 container.push_back(nid);
538 void clear_testobjects(vector<Id>& container)
541 while (!container.empty())
543 Id id = container.back();
545 container.pop_back();
550 void testHSolvePassiveSingleComp()
553 vector< int > dims( 1, 1 );
554 vector<Id> to_cleanup;
555 Id nid = create_testobject(to_cleanup,
"Neuron",
Id(),
"n", dims );
556 Id comptId = create_testobject(to_cleanup,
"Compartment", nid,
"compt", dims );
557 Id hsolve = create_testobject(to_cleanup,
"HSolve", nid,
"solver", dims);
559 to_cleanup.push_back(nid);
560 clear_testobjects(to_cleanup);
561 cout <<
"." << flush;
void setCaAdvance(int caAdvance)
virtual ObjId findOtherEnd(ObjId) const =0
static void deleteIncomingMessages(Element *orig, const string finfo)
static vector< Id > children(Id obj)
void process(const Eref &hsolve, ProcPtr p)
Element * element() const
Synonym for Id::operator()()
std::string path(const std::string &separator="/") const
static const std::set< string > & handledClasses()
static const Cinfo * initCinfo()
void reinit(const Eref &hsolve, ProcPtr p)
void setVMin(double vMin)
static void zombify(Element *orig, const Cinfo *zClass, Id hsolve)
static const Cinfo * initCinfo()
string getPath(const Eref &e) const
static void children(const Eref &e, vector< Id > &ret)
vector< Id > compartmentId_
static bool set(const ObjId &dest, const string &field, A arg)
void zombify(Eref hsolve) const
Id doCreate(string type, ObjId parent, string name, unsigned int numData, NodePolicy nodePolicy=MooseBlockBalance, unsigned int preferredNode=1)
void setup(Id seed, double dt)
void reinit(ProcPtr info)
void setCaMax(double caMax)
const std::string & name() const
static const Cinfo * initCinfo()
static const Cinfo * initCinfo()
static void deleteMsg(ObjId mid)
ObjId findCaller(FuncId fid) const
static const Cinfo * initCinfo()
static void zombify(Element *orig, const Cinfo *zClass, Id hsolve)
bool isA(const string &ancestor) const
const Cinfo * cinfo() const
void setPath(const Eref &e, string path)
static const Cinfo * initCinfo()
Interface to external channels.
void step(ProcPtr info)
Equivalent to process.
static const Msg * getMsg(ObjId m)
void setCaMin(double caMin)
static const Cinfo * initCinfo()
vector< Id > channelId_
Used for localIndex-ing.
static const Cinfo * hsolveCinfo
vector< Id > caConcId_
calcium from difshells
static Id deepSearchForCompartment(Id base)
void setVMax(double vMax)
const Finfo * findFinfo(const string &name) const