MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Cell Class Reference

#include <Cell.h>

+ Collaboration diagram for Cell:

Classes

struct  MethodInfo
 

Public Member Functions

 Cell ()
 
string getDescription () const
 
int getImplicit () const
 
string getMethod () const
 
Id getSetup () const
 
unsigned int getSolverClock () const
 
string getSolverName () const
 
int getVariableDt () const
 
void processDummy (const Eref &e, ProcPtr p)
 
void reinit (const Eref &e, ProcPtr p)
 
void setMethod (string value)
 
void setSolverClock (unsigned int value)
 
void setSolverName (string value)
 
void setupf (Id cell)
 

Static Public Member Functions

static void addMethod (const string &name, const string &description, int isVariableDt, int isImplicit)
 
static const CinfoinitCinfo ()
 

Private Member Functions

void setupSolver (Id cell, Id seed) const
 

Static Private Member Functions

static vector< Idchildren (Id obj)
 
static Id findCompt (Id cell)
 

Private Attributes

string method_
 
Shellshell_
 
unsigned int solverClock_
 
string solverName_
 

Static Private Attributes

static map< string, MethodInfomethodMap_
 

Detailed Description

Definition at line 13 of file Cell.h.

Constructor & Destructor Documentation

Cell::Cell ( )

Definition at line 159 of file Cell.cpp.

References setMethod().

160  :
161  solverClock_( 2 ),
162  solverName_( "_integ" ),
163  shell_( reinterpret_cast< Shell* >( Id().eref().data() ) )
164 {
165  setMethod( "hsolve" );
166 }
Shell * shell_
Definition: Cell.h:74
unsigned int solverClock_
Definition: Cell.h:72
string solverName_
Definition: Cell.h:73
Definition: Id.h:17
void setMethod(string value)
Definition: Cell.cpp:316

+ Here is the call graph for this function:

Member Function Documentation

void Cell::addMethod ( const string &  name,
const string &  description,
int  isVariableDt,
int  isImplicit 
)
static

Definition at line 168 of file Cell.cpp.

References methodMap_, and name.

Referenced by initCinfo().

173 {
174  methodMap_[ name ] = MethodInfo( description, isVariableDt, isImplicit );
175 }
static map< string, MethodInfo > methodMap_
Definition: Cell.h:79
static char name[]
Definition: mfield.cpp:401

+ Here is the caller graph for this function:

vector< Id > Cell::children ( Id  obj)
staticprivate

Definition at line 237 of file Cell.cpp.

References Neutral::children(), and Id::eref().

Referenced by findCompt().

238 {
239  //~ return Field< vector< Id > >::get( obj, "children" );
240  //~ return Field< vector< Id > >::fastGet( obj.eref(), "children" );
241  //~ return localGet< Neutral, vector< Id > >( obj.eref(), "children" );
242 
243  vector< Id > c;
244  Neutral::children( obj.eref(), c );
245  return c;
246 }
Eref eref() const
Definition: Id.cpp:125
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Id Cell::findCompt ( Id  cell)
staticprivate

This function performs a depth-first search of the tree under the current cell. First compartment found is returned as the seed.

Definition at line 252 of file Cell.cpp.

References children(), compartmentCinfo, and Cinfo::find().

Referenced by reinit(), and setupf().

253 {
254  /* 'curr' is the current element under consideration. 'cstack' is a list
255  * of all elements (and their immediate siblings) found on the path from
256  * the root element (the Cell) to the current element.
257  */
258  vector< vector< Id > > cstack;
259  Id seed;
260 
261  const Cinfo* compartmentCinfo = Cinfo::find( "Compartment" );
262 
263  cstack.push_back( children( cell ) );
264  while ( !cstack.empty() )
265  {
266  const vector< Id >& child = cstack.back();
267 
268  if ( child.empty() )
269  {
270  cstack.pop_back();
271  if ( !cstack.empty() )
272  cstack.back().pop_back();
273  }
274  else
275  {
276  dump("TODO", "TODO: Commented out code. ");
277  Id curr = child.back();
278 
279 #if 0 /* ----- #if 0 : If0Label_1 ----- */
280 
281  //~ string className = Field< string >::get( curr, "class" );
282  if ( curr()->cinfo() == compartmentCinfo )
283  {
284  seed = curr;
285  break;
286  }
287 #endif /* ----- #if 0 : If0Label_1 ----- */
288 
289 
290  cstack.push_back( children( curr ) );
291  }
292  }
293 
294  return seed;
295 }
static const Cinfo * find(const std::string &name)
Definition: Cinfo.cpp:200
static const Cinfo * compartmentCinfo
Definition: Compartment.cpp:53
static vector< Id > children(Id obj)
Definition: Cell.cpp:237
Definition: Id.h:17
Definition: Cinfo.h:18

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string Cell::getDescription ( ) const

Definition at line 368 of file Cell.cpp.

References method_, and methodMap_.

Referenced by initCinfo().

369 {
370  return methodMap_[ method_ ].description;
371 }
static map< string, MethodInfo > methodMap_
Definition: Cell.h:79
string method_
Definition: Cell.h:71

+ Here is the caller graph for this function:

int Cell::getImplicit ( ) const

Definition at line 363 of file Cell.cpp.

References method_, and methodMap_.

Referenced by initCinfo().

364 {
365  return methodMap_[ method_ ].isImplicit;
366 }
static map< string, MethodInfo > methodMap_
Definition: Cell.h:79
string method_
Definition: Cell.h:71

+ Here is the caller graph for this function:

string Cell::getMethod ( ) const

Definition at line 333 of file Cell.cpp.

References method_.

Referenced by initCinfo().

334 {
335  return method_;
336 }
string method_
Definition: Cell.h:71

+ Here is the caller graph for this function:

Id Cell::getSetup ( ) const

Definition at line 210 of file Cell.cpp.

Referenced by initCinfo().

211 {
212  return Id();
213 }
Definition: Id.h:17

+ Here is the caller graph for this function:

unsigned int Cell::getSolverClock ( ) const

Definition at line 343 of file Cell.cpp.

References solverClock_.

Referenced by initCinfo().

344 {
345  return solverClock_;
346 }
unsigned int solverClock_
Definition: Cell.h:72

+ Here is the caller graph for this function:

string Cell::getSolverName ( ) const

Definition at line 353 of file Cell.cpp.

References solverName_.

Referenced by initCinfo().

354 {
355  return solverName_;
356 }
string solverName_
Definition: Cell.h:73

+ Here is the caller graph for this function:

int Cell::getVariableDt ( ) const

Definition at line 358 of file Cell.cpp.

References method_, and methodMap_.

Referenced by initCinfo().

359 {
360  return methodMap_[ method_ ].isVariableDt;
361 }
static map< string, MethodInfo > methodMap_
Definition: Cell.h:79
string method_
Definition: Cell.h:71

+ Here is the caller graph for this function:

const Cinfo * Cell::initCinfo ( )
static

Definition at line 23 of file Cell.cpp.

References addMethod(), cellCinfo, getDescription(), getImplicit(), getMethod(), getSetup(), getSolverClock(), getSolverName(), getVariableDt(), Neutral::initCinfo(), processDummy(), reinit(), setMethod(), setSolverClock(), setSolverName(), and setupf().

24 {
25  static DestFinfo process(
26  "process",
27  "Cell does not process at simulation time--"
28  "it only sets up the solver at reset.",
30  );
31 
32  static DestFinfo reinit(
33  "reinit",
34  "Handles 'reinit' call: This triggers setting up the solver.",
36  //~ new EpFunc0< Cell >( &Cell::reinit )
37  );
38 
39  static Finfo* processShared[] =
40  {
41  &process,
42  &reinit
43  };
44 
45  static SharedFinfo proc(
46  "proc",
47  "This shared message exists only to receive a 'reinit' call, which is "
48  "taken as a trigger to create and set up HSolve.",
49  processShared,
50  sizeof( processShared ) / sizeof( Finfo* )
51  );
52 
53  static DestFinfo setup1(
54  "setup1",
55  "Setup.",
57  );
58 
59  static ValueFinfo< Cell, Id > setup2(
60  "setupv",
61  "Setupv.",
62  &Cell::setupf,
64  );
65 
66  static ValueFinfo< Cell, string > method(
67  "method",
68  "Specifies the integration method to be used for the neuron managed "
69  "by this Cell object.",
72  );
73 
74  static ValueFinfo< Cell, unsigned int > solverClock(
75  "solverClock",
76  "Specifies which clock to use for the HSolve, if it is used.",
79  );
80 
81  static ValueFinfo< Cell, string > solverName(
82  "solverName",
83  "Specifies name for the solver object.",
86  );
87 
88  static ReadOnlyValueFinfo< Cell, int > variableDt(
89  "variableDt",
90  "Read-only field which tells if the current method is a variable "
91  "time-step method.",
93  );
94 
95  static ReadOnlyValueFinfo< Cell, int > implicit(
96  "implicit",
97  "Read-only field which tells if the current method is an implicit "
98  "method.",
100  );
101 
102  static ReadOnlyValueFinfo< Cell, string > description(
103  "description",
104  "Read-only field giving a short description of the currently selected "
105  "integration method.",
107  );
108 
109  static Finfo* cellFinfos[] =
110  {
111  &method, // Value
112  &solverClock, // Value
113  &solverName, // Value
114  &setup2,
115  &variableDt, // ReadOnlyValue
116  &implicit, // ReadOnlyValue
117  &description, // ReadOnlyValue
118  &setup1,
119  &proc, // Shared
120  };
121 
122  static string doc[] =
123  {
124  "Name", "Cell",
125  "Author", "Niraj Dudani, 2012, NCBS",
126  "Description", "Container for a neuron's components. "
127  "Also manages automatic solver setup. "
128  "In case of solver setup, assumes that all the "
129  "compartments under this Cell belong to a single "
130  "neuron. If more than 1 group of axially "
131  "connected compartments are present, then only "
132  "one of them will be taken over by the solver.",
133  };
134 
135  static Cinfo cellCinfo(
136  "Cell",
138  cellFinfos,
139  sizeof( cellFinfos ) / sizeof( Finfo* ),
140  new Dinfo< Cell >()
141  );
142 
143  Cell::addMethod( "ee",
144  "Exponential Euler.",
145  0, 0 );
146  Cell::addMethod( "hsolve",
147  "Hines' algorithm.",
148  0, 1 );
149 
150  return &cellCinfo;
151 }
void reinit(const Eref &e, ProcPtr p)
Definition: Cell.cpp:186
void setupf(Id cell)
Definition: Cell.cpp:214
Definition: Dinfo.h:60
int getVariableDt() const
Definition: Cell.cpp:358
void setSolverName(string value)
Definition: Cell.cpp:348
string getMethod() const
Definition: Cell.cpp:333
Definition: OpFunc.h:27
static void addMethod(const string &name, const string &description, int isVariableDt, int isImplicit)
Definition: Cell.cpp:168
static const Cinfo * cellCinfo
Definition: Cell.cpp:153
string getSolverName() const
Definition: Cell.cpp:353
unsigned int getSolverClock() const
Definition: Cell.cpp:343
int getImplicit() const
Definition: Cell.cpp:363
void setSolverClock(unsigned int value)
Definition: Cell.cpp:338
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
void processDummy(const Eref &e, ProcPtr p)
Definition: Cell.cpp:181
Id getSetup() const
Definition: Cell.cpp:210
Definition: Cinfo.h:18
void setMethod(string value)
Definition: Cell.cpp:316
Definition: Finfo.h:12
string getDescription() const
Definition: Cell.cpp:368

+ Here is the call graph for this function:

void Cell::processDummy ( const Eref e,
ProcPtr  p 
)

Definition at line 181 of file Cell.cpp.

Referenced by initCinfo().

182 {
183  ;
184 }

+ Here is the caller graph for this function:

void Cell::reinit ( const Eref e,
ProcPtr  p 
)

Definition at line 186 of file Cell.cpp.

References findCompt(), Eref::id(), method_, and setupSolver().

Referenced by initCinfo().

188 {
189  cout << ".. Cell::reinit()" << endl;
190  //~ if ( q->protectedAddToStructuralQ() )
191  //~ return;
192 
193  // Delete existing solver
194  //~ string solverPath = cell.id().path() + "/" + solverName_;
195  //~ Id solver( solverPath );
196  //~ if ( solver.path() == solverPath )
197  //~ solver.destroy();
198 
199  if ( method_ == "ee" )
200  return;
201 
202  // Find any compartment that is a descendant of this cell
203  Id seed = findCompt( cell.id() );
204  if ( seed == Id() ) // No compartment found.
205  return;
206 
207  setupSolver( cell.id(), seed );
208 }
void setupSolver(Id cell, Id seed) const
Definition: Cell.cpp:297
Definition: Id.h:17
string method_
Definition: Cell.h:71
static Id findCompt(Id cell)
Definition: Cell.cpp:252

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Cell::setMethod ( string  value)

Definition at line 316 of file Cell.cpp.

References method_, methodMap_, and value.

Referenced by Cell(), and initCinfo().

317 {
318  map< string, MethodInfo >::iterator i = methodMap_.find( value );
319 
320  if ( i != methodMap_.end() )
321  {
322  method_ = value;
323  }
324  else
325  {
326  method_ = "hsolve";
327  cerr << "Warning: Cell::setMethod(): method '" << value
328  << "' not known. Using '" << method_ << "'.\n";
329  setMethod( method_ );
330  }
331 }
uint32_t value
Definition: moosemodule.h:42
static map< string, MethodInfo > methodMap_
Definition: Cell.h:79
string method_
Definition: Cell.h:71
void setMethod(string value)
Definition: Cell.cpp:316

+ Here is the caller graph for this function:

void Cell::setSolverClock ( unsigned int  value)

Definition at line 338 of file Cell.cpp.

References solverClock_, and value.

Referenced by initCinfo().

339 {
341 }
uint32_t value
Definition: moosemodule.h:42
unsigned int solverClock_
Definition: Cell.h:72

+ Here is the caller graph for this function:

void Cell::setSolverName ( string  value)

Definition at line 348 of file Cell.cpp.

References solverName_, and value.

Referenced by initCinfo().

349 {
350  solverName_ = value;
351 }
uint32_t value
Definition: moosemodule.h:42
string solverName_
Definition: Cell.h:73

+ Here is the caller graph for this function:

void Cell::setupf ( Id  cell)

Definition at line 214 of file Cell.cpp.

References Id::destroy(), findCompt(), method_, Id::path(), setupSolver(), and solverName_.

Referenced by initCinfo().

215 {
216  cout << "Cell::setup()" << endl;
217  cout << ".... cell path: " << cell.path() << endl;
218  //~ return;
219 
220  // Delete existing solver
221  string solverPath = cell.path() + "/" + solverName_;
222  Id solver( solverPath );
223  if ( solver.path() == solverPath )
224  solver.destroy();
225 
226  if ( method_ == "ee" )
227  return;
228 
229  // Find any compartment that is a descendant of this cell
230  Id seed = findCompt( cell );
231  if ( seed == Id() ) // No compartment found.
232  return;
233 
234  setupSolver( cell, seed );
235 }
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
string solverName_
Definition: Cell.h:73
void setupSolver(Id cell, Id seed) const
Definition: Cell.cpp:297
Definition: Id.h:17
string method_
Definition: Cell.h:71
static Id findCompt(Id cell)
Definition: Cell.cpp:252

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Cell::setupSolver ( Id  cell,
Id  seed 
) const
private

Definition at line 297 of file Cell.cpp.

References Eref::data(), Id::eref(), Shell::innerCreate(), MooseBlockBalance, Id::nextId(), HSolve::setSeed(), shell_, and solverName_.

Referenced by reinit(), and setupf().

298 {
299  Id solver = Id::nextId();
300  dump("FIXME"
301  , "Using 0 for parentMsgIndex in function call Shell::innerCreate"
302  "0 in first and third argument to NodeBalance. "
303  "I am not sure if I should be doing this here in this function."
304  " -- Dilawar"
305  );
306  NodeBalance nb(0, MooseBlockBalance, 0);
307  shell_->innerCreate("HSolve", cell, solver, solverName_, nb, 0);
308  HSolve* data = reinterpret_cast< HSolve* >( solver.eref().data() );
309  data->setSeed( seed );
310 }
char * data() const
Definition: Eref.cpp:41
Shell * shell_
Definition: Cell.h:74
Eref eref() const
Definition: Id.cpp:125
string solverName_
Definition: Cell.h:73
static Id nextId()
Definition: Id.cpp:132
Definition: HSolve.h:16
void setSeed(Id seed)
Definition: HSolve.cpp:281
Definition: Id.h:17
void innerCreate(string type, ObjId parent, Id newElm, string name, const NodeBalance &nb, unsigned int parentMsgIndex)
Definition: Shell.cpp:690

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

string Cell::method_
private

Definition at line 71 of file Cell.h.

Referenced by getDescription(), getImplicit(), getMethod(), getVariableDt(), reinit(), setMethod(), and setupf().

map< string, Cell::MethodInfo > Cell::methodMap_
staticprivate

Definition at line 79 of file Cell.h.

Referenced by addMethod(), getDescription(), getImplicit(), getVariableDt(), and setMethod().

Shell* Cell::shell_
private

Definition at line 74 of file Cell.h.

Referenced by setupSolver().

unsigned int Cell::solverClock_
private

Definition at line 72 of file Cell.h.

Referenced by getSolverClock(), and setSolverClock().

string Cell::solverName_
private

Definition at line 73 of file Cell.h.

Referenced by getSolverName(), setSolverName(), setupf(), and setupSolver().


The documentation for this class was generated from the following files: