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

#include <Neuron.h>

+ Collaboration diagram for Neuron:

Public Member Functions

void buildElist (const Eref &e, const vector< string > &line, vector< ObjId > &elist, vector< double > &val)
 
void buildSegmentTree (const Eref &e)
 Fills up vector of segments. First entry is soma. More...
 
void evalExprForElist (const vector< ObjId > &elist, const string &expn, vector< double > &val) const
 
vector< string > getChannelDistribution (const Eref &e) const
 
double getCM () const
 
double getCompartmentLengthInLambdas () const
 
vector< ObjIdgetCompartments () const
 
vector< double > getElecDistFromSoma () const
 
double getEm () const
 
vector< ObjIdgetExprElist (const Eref &e, string line) const
 
vector< double > getExprVal (const Eref &e, string line) const
 
vector< double > getGeomDistFromSoma () const
 
unsigned int getNumBranches () const
 
unsigned int getNumCompartments () const
 
unsigned int getNumSpines () const
 
ObjId getParentCompartmentOfSpine (const Eref &e, ObjId compt) const
 
vector< string > getPassiveDistribution (const Eref &e) const
 
vector< double > getPathDistFromSoma () const
 
double getPhi () const
 
double getRA () const
 
double getRM () const
 
string getSourceFile () const
 
vector< string > getSpineDistribution (const Eref &e) const
 
vector< ObjIdgetSpineIdsFromCompartmentIds (const Eref &e, vector< ObjId > compt) const
 
vector< ObjIdgetSpinesFromExpression (const Eref &e, string line) const
 
vector< ObjIdgetSpinesOnCompartment (const Eref &e, ObjId compt) const
 
double getTheta () const
 
void installMechanism (const string &name, const vector< ObjId > &elist, const vector< double > &val, const vector< string > &line)
 
void installSpines (const vector< ObjId > &elist, const vector< double > &val, const vector< string > &line)
 
SpinelookupSpine (unsigned int index)
 
void makeSpacingDistrib (const vector< ObjId > &elist, const vector< double > &val, vector< unsigned int > &seglistIndex, vector< unsigned int > &elistIndex, vector< double > &pos, const vector< string > &line) const
 
 Neuron ()
 
 Neuron (const Neuron &other)
 
void parseMechSpec (const Eref &e)
 
void scaleBufAndRates (unsigned int spineNum, double lenScale, double diaScale) const
 
void scaleHeadDiffusion (unsigned int spineNum, double len, double dia) const
 Scale the diffusion parameters due to a change in the head dimensions. More...
 
void scaleShaftDiffusion (unsigned int spineNum, double len, double dia) const
 Scale the diffusion parameters due to a change in the shaft dimensions. More...
 
void setChannelDistribution (const Eref &e, vector< string > v)
 
void setCM (double v)
 
void setCompartmentLengthInLambdas (double v)
 
void setEm (double v)
 
void setNumSpines (unsigned int num)
 
void setPassiveDistribution (const Eref &e, vector< string > v)
 
void setPhi (double v)
 
void setRA (double v)
 
void setRM (double v)
 
void setSourceFile (string v)
 
void setSpineAndPsdDsolve (Id spineDsolve, Id psdDsolve)
 
void setSpineAndPsdMesh (Id spineMesh, Id psdMesh)
 Fills up vector of segments. First entry is soma. More...
 
void setSpineDistribution (const Eref &e, vector< string > v)
 
void setTheta (double v)
 
const vector< Id > & spineIds (unsigned int index) const
 
void updateSegmentLengths ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 

Private Attributes

vector< vector< Id > > allSpinesPerCompt_
 Id of each compt in each spine. More...
 
vector< SwcBranchbranches_
 
vector< string > channelDistribution_
 
double CM_
 
double compartmentLengthInLambdas_
 
double Em_
 
Id headDsolve_
 
double maxG_
 
double maxL_
 
double maxP_
 
vector< string > passiveDistribution_
 
double phi_
 
Id psdDsolve_
 Id of the Dsolve for the head compt. More...
 
vector< IdpsdStoich_
 Id of stoich associated with each PSD. Typically all the same. More...
 
double RA_
 
double RM_
 
vector< IdsegId_
 
map< Id, unsigned int > segIndex_
 Map to look up Seg index from Id of associated compt. More...
 
vector< SwcSegmentsegs_
 Id of compartment in each Seg entry, below. More...
 
Id soma_
 
string sourceFile_
 
vector< string > spineDistribution_
 
Spine spineEntry_
 Id of the Dsolve for the PSD compt. More...
 
vector< unsigned int > spineParentSegIndex_
 Look up seg index of parent compartment, from index of spine. More...
 
vector< vector< Id > > spines_
 
vector< IdspineStoich_
 Id of stoich associated with each spine. Typically all the same. More...
 
vector< unsigned int > spineToMeshOrdering_
 looks up spine/psd mesh index from FieldIndex of selected spine. More...
 
double theta_
 

Detailed Description

The Neuron class to hold the Compartment class elements.

Definition at line 18 of file Neuron.h.

Constructor & Destructor Documentation

Neuron::Neuron ( )

Definition at line 542 of file Neuron.cpp.

543  :
544  RM_( 1.0 ),
545  RA_( 1.0 ),
546  CM_( 0.01 ),
547  Em_( -0.065 ),
548  theta_( 0.0 ),
549  phi_( 0.0 ),
550  maxP_( 0.0 ),
551  maxG_( 0.0 ),
552  maxL_( 0.0 ),
553  sourceFile_( "" ),
555  spineEntry_( this )
556 {
557  ;
558 }
double Em_
Definition: Neuron.h:113
double RM_
Definition: Neuron.h:110
double compartmentLengthInLambdas_
Definition: Neuron.h:121
string sourceFile_
Definition: Neuron.h:120
double phi_
Definition: Neuron.h:115
double RA_
Definition: Neuron.h:111
double maxL_
Definition: Neuron.h:118
Spine spineEntry_
Id of the Dsolve for the PSD compt.
Definition: Neuron.h:150
double theta_
Definition: Neuron.h:114
double maxG_
Definition: Neuron.h:117
double maxP_
Definition: Neuron.h:116
double CM_
Definition: Neuron.h:112
Neuron::Neuron ( const Neuron other)

Definition at line 562 of file Neuron.cpp.

563  :
564  RM_( other.RM_ ),
565  RA_( other.RA_ ),
566  CM_( other.CM_ ),
567  Em_( other.Em_ ),
568  theta_( other.theta_ ),
569  phi_( other.phi_ ),
570  maxP_( other.maxP_ ),
571  maxG_( other.maxG_ ),
572  maxL_( other.maxL_ ),
573  sourceFile_( other.sourceFile_ ),
578  spineEntry_( this )
579 {
580  ;
581 }
double Em_
Definition: Neuron.h:113
double RM_
Definition: Neuron.h:110
double compartmentLengthInLambdas_
Definition: Neuron.h:121
string sourceFile_
Definition: Neuron.h:120
vector< string > channelDistribution_
Definition: Neuron.h:122
double phi_
Definition: Neuron.h:115
vector< string > passiveDistribution_
Definition: Neuron.h:123
double RA_
Definition: Neuron.h:111
double maxL_
Definition: Neuron.h:118
Spine spineEntry_
Id of the Dsolve for the PSD compt.
Definition: Neuron.h:150
double theta_
Definition: Neuron.h:114
double maxG_
Definition: Neuron.h:117
double maxP_
Definition: Neuron.h:116
double CM_
Definition: Neuron.h:112
vector< string > spineDistribution_
Definition: Neuron.h:124

Member Function Documentation

void Neuron::buildElist ( const Eref e,
const vector< string > &  line,
vector< ObjId > &  elist,
vector< double > &  val 
)

Definition at line 1116 of file Neuron.cpp.

References Eref::data(), Id::eref(), evalExprForElist(), Shell::getCwe(), Eref::objId(), path, Shell::setCwe(), and wildcardFind().

Referenced by setChannelDistribution(), setPassiveDistribution(), and setSpineDistribution().

1120 {
1121  Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
1122  const string& path = line[1];
1123  const string& expr = line[3];
1124  ObjId oldCwe = shell->getCwe();
1125  shell->setCwe( e.objId() );
1126  wildcardFind( path, elist );
1127  sort( elist.begin(), elist.end() );
1128  shell->setCwe( oldCwe );
1129  evalExprForElist( elist, expr, val );
1130 }
int wildcardFind(const string &path, vector< ObjId > &ret)
Definition: Wildcard.cpp:169
char * data() const
Definition: Eref.cpp:41
Definition: ObjId.h:20
void evalExprForElist(const vector< ObjId > &elist, const string &expn, vector< double > &val) const
Definition: Neuron.cpp:1478
Eref eref() const
Definition: Id.cpp:125
ObjId getCwe() const
Definition: Shell.cpp:615
ObjId objId() const
Definition: Eref.cpp:57
void setCwe(ObjId cwe)
Definition: Shell.cpp:610
Definition: Id.h:17
static char path[]
Definition: mfield.cpp:403
Definition: Shell.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::buildSegmentTree ( const Eref e)

Fills up vector of segments. First entry is soma.

Definition at line 1362 of file Neuron.cpp.

References Neutral::children(), fillSegIndex(), fillSegments(), Eref::id(), Id::path(), segId_, segIndex_, segs_, soma_, and updateSegmentLengths().

Referenced by initCinfo().

1363 {
1364  vector< Id > kids;
1365  Neutral::children( e, kids );
1366  sort( kids.begin(), kids.end() );
1367 
1368  soma_ = fillSegIndex( kids, segIndex_ );
1369  if ( kids.size() == 0 || soma_ == Id() )
1370  {
1371  cout << "Error: Neuron::buildSegmentTree( " << e.id().path() <<
1372  " ): \n Valid neuronal model not found.\n";
1373  return;
1374  }
1375  fillSegments( segs_, segIndex_, kids );
1376  int numPa = 0;
1377  for ( unsigned int i = 0; i < segs_.size(); ++i )
1378  {
1379  if ( segs_[i].parent() == ~0U )
1380  {
1381  numPa++;
1382  }
1383  else
1384  {
1385  segs_[ segs_[i].parent() ].addChild( i );
1386  }
1387  }
1388  for ( unsigned int i = 0; i < segs_.size(); ++i )
1389  {
1390  segs_[i].figureOutType();
1391  }
1392 
1393  if ( numPa != 1 )
1394  {
1395  cout << "Warning: Neuron.cpp: buildTree: numPa = " << numPa << endl;
1396  }
1397  segId_.clear();
1398  segId_.resize( segIndex_.size(), Id() );
1399  for ( map< Id, unsigned int >::const_iterator
1400  i = segIndex_.begin(); i != segIndex_.end(); ++i )
1401  {
1402  assert( i->second < segId_.size() );
1403  segId_[ i->second ] = i->first;
1404  }
1406 }
Id soma_
Definition: Neuron.h:119
Id id() const
Definition: Eref.cpp:62
static void fillSegments(vector< SwcSegment > &segs, const map< Id, unsigned int > &segIndex, const vector< Id > &kids)
Definition: Neuron.cpp:1275
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342
map< Id, unsigned int > segIndex_
Map to look up Seg index from Id of associated compt.
Definition: Neuron.h:127
vector< Id > segId_
Definition: Neuron.h:152
Id fillSegIndex(const vector< Id > &kids, map< Id, unsigned int > &segIndex)
Definition: Neuron.cpp:1241
Definition: Id.h:17
void updateSegmentLengths()
Definition: Neuron.cpp:1333
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::evalExprForElist ( const vector< ObjId > &  elist,
const string &  expn,
vector< double > &  val 
) const

Evaluates expn for every CompartmentBase entry in elist. Pushes value, length and dia for each elist entry into the 'val' vector.

Definition at line 1478 of file Neuron.cpp.

References nuParser::DIA, nuParser::EL, nuParser::eval(), nuParser::EXPR, nuParser::G, Field< A >::get(), nuParser::LEN, nuParser::MAXG, maxG_, nuParser::MAXL, maxL_, nuParser::MAXP, maxP_, nuParser::numVal, nuParser::OLDVAL, nuParser::P, segIndex_, segs_, nuParser::X, nuParser::Y, and nuParser::Z.

Referenced by buildElist(), getExprElist(), and getExprVal().

1480 {
1481  val.clear();
1482  val.resize( elist.size() * nuParser::numVal );
1483  // Build the function
1484  double len = 0; // Length of compt in metres
1485  double dia = 0; // Diameter of compt in metres
1486  unsigned int valIndex = 0;
1487  try
1488  {
1489  nuParser parser( expn );
1490 
1491  // Go through the elist checking for the channels. If not there,
1492  // build them.
1493  for ( vector< ObjId >::const_iterator
1494  i = elist.begin(); i != elist.end(); ++i )
1495  {
1496  if ( i->element()->cinfo()->isA( "CompartmentBase" ) )
1497  {
1498  map< Id, unsigned int >:: const_iterator j =
1499  segIndex_.find( *i );
1500  if ( j != segIndex_.end() )
1501  {
1502  dia = Field< double >::get( *i, "diameter" );
1503  len = Field< double >::get( *i, "length" );
1504  assert( j->second < segs_.size() );
1505  val[valIndex + nuParser::P] =
1506  segs_[j->second].getPathDistFromSoma();
1507  val[valIndex + nuParser::G] =
1508  segs_[j->second].getGeomDistFromSoma();
1509  val[valIndex + nuParser::EL] =
1510  segs_[j->second].getElecDistFromSoma();
1511  val[valIndex + nuParser::LEN] = len;
1512  val[valIndex + nuParser::DIA] = dia;
1513  val[valIndex + nuParser::MAXP] = maxP_;
1514  val[valIndex + nuParser::MAXG] = maxG_;
1515  val[valIndex + nuParser::MAXL] = maxL_;
1516  val[valIndex + nuParser::X] = segs_[j->second].vec().a0();
1517  val[valIndex + nuParser::Y] = segs_[j->second].vec().a1();
1518  val[valIndex + nuParser::Z] = segs_[j->second].vec().a2();
1519  // Can't assign oldVal on first arg
1520  val[valIndex + nuParser::OLDVAL] = 0.0;
1521 
1522  val[valIndex + nuParser::EXPR] = parser.eval(
1523  val.begin() + valIndex );
1524  }
1525  }
1526  valIndex += nuParser::numVal;
1527  }
1528  }
1529  catch ( mu::Parser::exception_type& err )
1530  {
1531  cout << err.GetMsg() << endl;
1532  }
1533 }
double maxL_
Definition: Neuron.h:118
map< Id, unsigned int > segIndex_
Map to look up Seg index from Id of associated compt.
Definition: Neuron.h:127
double maxG_
Definition: Neuron.h:117
double maxP_
Definition: Neuron.h:116
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284
static const unsigned int numVal
Definition: Neuron.cpp:88
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< string > Neuron::getChannelDistribution ( const Eref e) const

Definition at line 1158 of file Neuron.cpp.

References channelDistribution_.

Referenced by initCinfo().

1159 {
1160  return channelDistribution_;
1161 }
vector< string > channelDistribution_
Definition: Neuron.h:122

+ Here is the caller graph for this function:

double Neuron::getCM ( ) const

Definition at line 845 of file Neuron.cpp.

References CM_.

Referenced by initCinfo().

846 {
847  return CM_;
848 }
double CM_
Definition: Neuron.h:112

+ Here is the caller graph for this function:

double Neuron::getCompartmentLengthInLambdas ( ) const

Definition at line 899 of file Neuron.cpp.

References compartmentLengthInLambdas_.

Referenced by initCinfo().

900 {
902 }
double compartmentLengthInLambdas_
Definition: Neuron.h:121

+ Here is the caller graph for this function:

vector< ObjId > Neuron::getCompartments ( ) const

Definition at line 945 of file Neuron.cpp.

References segId_.

Referenced by initCinfo().

946 {
947  vector< ObjId > ret( segId_.size() );
948  for ( unsigned int i = 0; i < segId_.size(); ++i )
949  ret[i] = segId_[i];
950  return ret;
951 }
vector< Id > segId_
Definition: Neuron.h:152

+ Here is the caller graph for this function:

vector< double > Neuron::getElecDistFromSoma ( ) const

Definition at line 937 of file Neuron.cpp.

References segs_.

Referenced by initCinfo().

938 {
939  vector< double > ret( segs_.size(), 0.0 );
940  for ( unsigned int i = 0; i < segs_.size(); ++i )
941  ret[i] = segs_[i].getElecDistFromSoma();
942  return ret;
943 }
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153
vector< double > getElecDistFromSoma() const
Definition: Neuron.cpp:937

+ Here is the caller graph for this function:

double Neuron::getEm ( ) const

Definition at line 855 of file Neuron.cpp.

References Em_.

Referenced by initCinfo().

856 {
857  return Em_;
858 }
double Em_
Definition: Neuron.h:113

+ Here is the caller graph for this function:

vector< ObjId > Neuron::getExprElist ( const Eref e,
string  line 
) const

Digest the path and the math expression to obtain an elist of compartments that satisfy both criteria. The argument 'line' has path followed by the math expression, separated by a space.

Definition at line 959 of file Neuron.cpp.

References Eref::data(), Id::eref(), evalExprForElist(), Shell::getCwe(), nuParser::numVal, Eref::objId(), path, Shell::setCwe(), and wildcardFind().

Referenced by getSpinesFromExpression(), and initCinfo().

960 {
961  Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
962  vector< ObjId > ret;
963  vector< ObjId > elist;
964  vector< double > val;
965  unsigned long pos = line.find_first_of( " \t" );
966  string path = line.substr( 0, pos );
967  string expr = line.substr( pos );
968  ObjId oldCwe = shell->getCwe();
969  shell->setCwe( e.objId() );
970  wildcardFind( path, elist );
971  shell->setCwe( oldCwe );
972  if ( elist.size() == 0 )
973  return ret;
974  evalExprForElist( elist, expr, val );
975  ret.reserve( elist.size() );
976  for ( unsigned int i = 0; i < elist.size(); ++i )
977  {
978  if ( val[i * nuParser::numVal] > 0 )
979  ret.push_back( elist[i] );
980  }
981  return ret;
982 }
int wildcardFind(const string &path, vector< ObjId > &ret)
Definition: Wildcard.cpp:169
char * data() const
Definition: Eref.cpp:41
Definition: ObjId.h:20
void evalExprForElist(const vector< ObjId > &elist, const string &expn, vector< double > &val) const
Definition: Neuron.cpp:1478
Eref eref() const
Definition: Id.cpp:125
ObjId getCwe() const
Definition: Shell.cpp:615
ObjId objId() const
Definition: Eref.cpp:57
void setCwe(ObjId cwe)
Definition: Shell.cpp:610
Definition: Id.h:17
static const unsigned int numVal
Definition: Neuron.cpp:88
static char path[]
Definition: mfield.cpp:403
Definition: Shell.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< double > Neuron::getExprVal ( const Eref e,
string  line 
) const

Digest the path and the math expression to obtain all the values pertaining to the elements in the path. There are nuParser::numVal * elist.size() entries. The argument 'line' has path followed by the math expression, separated by a space.

Definition at line 991 of file Neuron.cpp.

References Eref::data(), Id::eref(), evalExprForElist(), Shell::getCwe(), Eref::objId(), path, Shell::setCwe(), and wildcardFind().

Referenced by initCinfo().

992 {
993  Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
994  vector< ObjId > elist;
995  vector< double > val;
996  unsigned long pos = line.find_first_of( " \t" );
997  string path = line.substr( 0, pos );
998  string expr = line.substr( pos );
999  ObjId oldCwe = shell->getCwe();
1000  shell->setCwe( e.objId() );
1001  wildcardFind( path, elist );
1002  shell->setCwe( oldCwe );
1003  if ( elist.size() == 0 )
1004  return val;
1005  evalExprForElist( elist, expr, val );
1006  return val;
1007 }
int wildcardFind(const string &path, vector< ObjId > &ret)
Definition: Wildcard.cpp:169
char * data() const
Definition: Eref.cpp:41
Definition: ObjId.h:20
void evalExprForElist(const vector< ObjId > &elist, const string &expn, vector< double > &val) const
Definition: Neuron.cpp:1478
Eref eref() const
Definition: Id.cpp:125
ObjId getCwe() const
Definition: Shell.cpp:615
ObjId objId() const
Definition: Eref.cpp:57
void setCwe(ObjId cwe)
Definition: Shell.cpp:610
Definition: Id.h:17
static char path[]
Definition: mfield.cpp:403
Definition: Shell.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< double > Neuron::getGeomDistFromSoma ( ) const

Definition at line 929 of file Neuron.cpp.

References segs_.

Referenced by initCinfo().

930 {
931  vector< double > ret( segs_.size(), 0.0 );
932  for ( unsigned int i = 0; i < segs_.size(); ++i )
933  ret[i] = segs_[i].getGeomDistFromSoma();
934  return ret;
935 }
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153
vector< double > getGeomDistFromSoma() const
Definition: Neuron.cpp:929

+ Here is the caller graph for this function:

unsigned int Neuron::getNumBranches ( ) const

Definition at line 916 of file Neuron.cpp.

References branches_.

Referenced by initCinfo().

917 {
918  return branches_.size();
919 }
vector< SwcBranch > branches_
Definition: Neuron.h:154

+ Here is the caller graph for this function:

unsigned int Neuron::getNumCompartments ( ) const

Definition at line 904 of file Neuron.cpp.

References segId_.

Referenced by initCinfo().

905 {
906  return segId_.size();
907 }
vector< Id > segId_
Definition: Neuron.h:152

+ Here is the caller graph for this function:

unsigned int Neuron::getNumSpines ( ) const

Definition at line 2039 of file Neuron.cpp.

References spines_.

Referenced by initCinfo().

2040 {
2041  return spines_.size();
2042 }
vector< vector< Id > > spines_
Definition: Neuron.h:130

+ Here is the caller graph for this function:

ObjId Neuron::getParentCompartmentOfSpine ( const Eref e,
ObjId  compt 
) const

Definition at line 1066 of file Neuron.cpp.

References allSpinesPerCompt_, ObjId::id, and segId_.

Referenced by initCinfo().

1068 {
1069  for ( unsigned int comptIndex = 0; comptIndex < allSpinesPerCompt_.size(); ++comptIndex )
1070  {
1071  const vector< Id >& v = allSpinesPerCompt_[comptIndex];
1072  for ( unsigned int j = 0; j < v.size(); j++ )
1073  if ( v[j] == compt.id )
1074  return segId_[ comptIndex ];
1075  }
1076  return ObjId();
1077 }
Id id
Definition: ObjId.h:98
vector< vector< Id > > allSpinesPerCompt_
Id of each compt in each spine.
Definition: Neuron.h:133
Definition: ObjId.h:20
vector< Id > segId_
Definition: Neuron.h:152

+ Here is the caller graph for this function:

vector< string > Neuron::getPassiveDistribution ( const Eref e) const

Definition at line 1183 of file Neuron.cpp.

References passiveDistribution_.

Referenced by initCinfo().

1184 {
1185  return passiveDistribution_;
1186 }
vector< string > passiveDistribution_
Definition: Neuron.h:123

+ Here is the caller graph for this function:

vector< double > Neuron::getPathDistFromSoma ( ) const

Definition at line 921 of file Neuron.cpp.

References segs_.

Referenced by initCinfo().

922 {
923  vector< double > ret( segs_.size(), 0.0 );
924  for ( unsigned int i = 0; i < segs_.size(); ++i )
925  ret[i] = segs_[i].getPathDistFromSoma();
926  return ret;
927 }
vector< double > getPathDistFromSoma() const
Definition: Neuron.cpp:921
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153

+ Here is the caller graph for this function:

double Neuron::getPhi ( ) const

Definition at line 877 of file Neuron.cpp.

References phi_.

Referenced by initCinfo().

878 {
879  return phi_;
880 }
double phi_
Definition: Neuron.h:115

+ Here is the caller graph for this function:

double Neuron::getRA ( ) const

Definition at line 833 of file Neuron.cpp.

References RA_.

Referenced by initCinfo().

834 {
835  return RA_;
836 }
double RA_
Definition: Neuron.h:111

+ Here is the caller graph for this function:

double Neuron::getRM ( ) const

Definition at line 821 of file Neuron.cpp.

References RM_.

Referenced by initCinfo().

822 {
823  return RM_;
824 }
double RM_
Definition: Neuron.h:110

+ Here is the caller graph for this function:

string Neuron::getSourceFile ( ) const

Definition at line 889 of file Neuron.cpp.

References sourceFile_.

Referenced by initCinfo().

890 {
891  return sourceFile_;
892 }
string sourceFile_
Definition: Neuron.h:120

+ Here is the caller graph for this function:

vector< string > Neuron::getSpineDistribution ( const Eref e) const

Definition at line 1205 of file Neuron.cpp.

References spineDistribution_.

Referenced by initCinfo().

1206 {
1207  return spineDistribution_;
1208 }
vector< string > spineDistribution_
Definition: Neuron.h:124

+ Here is the caller graph for this function:

vector< ObjId > Neuron::getSpineIdsFromCompartmentIds ( const Eref e,
vector< ObjId compt 
) const

Definition at line 1079 of file Neuron.cpp.

References Eref::dataIndex(), Eref::id(), lookupSpine(), spines_, and Id::value().

Referenced by initCinfo().

1081 {
1082  vector< ObjId > ret;
1083  map< Id, unsigned int > lookupSpine;
1084  Id spineBase = Id( e.id().value() + 1 );
1085  for ( unsigned int i = 0; i < spines_.size(); ++i )
1086  {
1087  for ( vector< Id >::const_iterator j = spines_[i].begin(); j != spines_[i].end(); ++j )
1088  {
1089  lookupSpine[ *j ] = i;
1090  }
1091  }
1092  // cout << "################## " << lookupSpine.size() << endl;
1093  for ( map< Id, unsigned int >::const_iterator k = lookupSpine.begin(); k != lookupSpine.end(); ++k )
1094  {
1095  // cout << "spine[" << k->second << "] has " << k->first.element()->getName() << endl;
1096  // cout << "spine[" << k->second << "] has " << k->first << endl;
1097 
1098  }
1099  for ( vector< ObjId >::const_iterator j = compt.begin(); j != compt.end(); ++j )
1100  {
1101  // cout << "compt: " << *j << " " << j->element()->getName() << endl;
1102  map< Id, unsigned int >::const_iterator k = lookupSpine.find( j->id );
1103  if ( k != lookupSpine.end() )
1104  {
1105  ret.push_back( ObjId( spineBase, e.dataIndex(), k->second ) );
1106  // cout << "spine[" << k->second << "] has " << j->element()->getName() << endl;
1107  }
1108  else
1109  {
1110  ret.push_back( ObjId() );
1111  }
1112  }
1113  return ret;
1114 }
Id id() const
Definition: Eref.cpp:62
unsigned int value() const
Definition: Id.cpp:197
unsigned int dataIndex() const
Definition: Eref.h:50
Spine * lookupSpine(unsigned int index)
Definition: Neuron.cpp:2028
Definition: ObjId.h:20
vector< vector< Id > > spines_
Definition: Neuron.h:130
Definition: Id.h:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< ObjId > Neuron::getSpinesFromExpression ( const Eref e,
string  line 
) const

Definition at line 1009 of file Neuron.cpp.

References allSpinesPerCompt_, getExprElist(), matchBeforeBrace(), path, segId_, and segIndex_.

Referenced by initCinfo().

1011 {
1012  unsigned long pos = line.find_first_of( " \t" );
1013  string path = line.substr( 0, pos );
1014  string expr = line.substr( pos );
1015 
1016  // Look for all compartments that fit the expression.
1017  vector< ObjId > temp = getExprElist( e, "# " + expr );
1018  // indexed by segIndex, includes all compts in all spines.
1019  /*
1020  vector< vector< Id > > allSpinesPerCompt( segId_.size() );
1021  for ( unsigned int i = 0; i < spines_.size(); ++i ) {
1022  assert( allSpinesPerCompt.size() > spineParentSegIndex_[i] );
1023  vector< Id >& s = allSpinesPerCompt[ spineParentSegIndex_[i] ];
1024  s.insert( s.end(), spines_[i].begin(), spines_[i].end() );
1025  }
1026  */
1027  vector< ObjId >ret;
1028  if ( allSpinesPerCompt_.size() == 0 )
1029  return ret;
1030  for ( vector< ObjId >::iterator
1031  i = temp.begin(); i != temp.end(); ++i )
1032  {
1033  map< Id, unsigned int >::const_iterator si =
1034  segIndex_.find( i->id );
1035  assert( si != segIndex_.end() );
1036  assert( si->second < segId_.size() );
1037  if ( allSpinesPerCompt_.size() > si->second )
1038  {
1039  const vector< Id >& s = allSpinesPerCompt_[ si->second ];
1040  for ( vector< Id >::const_iterator j = s.begin(); j != s.end(); ++j )
1041  {
1042  if ( matchBeforeBrace( *j, path ) )
1043  ret.push_back( *j );
1044  }
1045  }
1046  }
1047  return ret;
1048 }
vector< ObjId > getExprElist(const Eref &e, string line) const
Definition: Neuron.cpp:959
vector< vector< Id > > allSpinesPerCompt_
Id of each compt in each spine.
Definition: Neuron.h:133
map< Id, unsigned int > segIndex_
Map to look up Seg index from Id of associated compt.
Definition: Neuron.h:127
bool matchBeforeBrace(ObjId id, const string &wild)
Definition: Wildcard.cpp:432
vector< Id > segId_
Definition: Neuron.h:152
static char path[]
Definition: mfield.cpp:403

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< ObjId > Neuron::getSpinesOnCompartment ( const Eref e,
ObjId  compt 
) const

Definition at line 1050 of file Neuron.cpp.

References allSpinesPerCompt_, ObjId::id, and segIndex_.

Referenced by initCinfo().

1052 {
1053  vector< ObjId > ret;
1054  map< Id, unsigned int >::const_iterator pos =
1055  segIndex_.find( compt.id );
1056  if ( pos != segIndex_.end() )
1057  {
1058  assert( pos->second < allSpinesPerCompt_.size() );
1059  const vector< Id >& spines = allSpinesPerCompt_[pos->second];
1060  for ( unsigned int i = 0; i < spines.size(); ++i )
1061  ret.push_back( spines[i] );
1062  }
1063  return ret;
1064 }
Id id
Definition: ObjId.h:98
vector< vector< Id > > allSpinesPerCompt_
Id of each compt in each spine.
Definition: Neuron.h:133
map< Id, unsigned int > segIndex_
Map to look up Seg index from Id of associated compt.
Definition: Neuron.h:127

+ Here is the caller graph for this function:

double Neuron::getTheta ( ) const

Definition at line 866 of file Neuron.cpp.

References theta_.

Referenced by initCinfo().

867 {
868  return theta_;
869 }
double theta_
Definition: Neuron.h:114

+ Here is the caller graph for this function:

const Cinfo * Neuron::initCinfo ( )
static

Initializes the class info.

Definition at line 106 of file Neuron.cpp.

References buildSegmentTree(), getChannelDistribution(), getCM(), getCompartmentLengthInLambdas(), getCompartments(), getElecDistFromSoma(), getEm(), getExprElist(), getExprVal(), getGeomDistFromSoma(), getNumBranches(), getNumCompartments(), getNumSpines(), getParentCompartmentOfSpine(), getPassiveDistribution(), getPathDistFromSoma(), getPhi(), getRA(), getRM(), getSourceFile(), getSpineDistribution(), getSpineIdsFromCompartmentIds(), getSpinesFromExpression(), getSpinesOnCompartment(), getTheta(), Spine::initCinfo(), Neutral::initCinfo(), lookupSpine(), neuronCinfo, setChannelDistribution(), setCM(), setCompartmentLengthInLambdas(), setEm(), setNumSpines(), setPassiveDistribution(), setPhi(), setRA(), setRM(), setSourceFile(), setSpineAndPsdDsolve(), setSpineAndPsdMesh(), setSpineDistribution(), and setTheta().

107 {
109  // ValueFinfos
111  static ValueFinfo< Neuron, double > RM( "RM",
112  "Membrane resistivity, in ohm.m^2. Default value is 1.0.",
113  &Neuron::setRM,
115  );
116  static ValueFinfo< Neuron, double > RA( "RA",
117  "Axial resistivity of cytoplasm, in ohm.m. Default value is 1.0.",
118  &Neuron::setRA,
120  );
121  static ValueFinfo< Neuron, double > CM( "CM",
122  "Membrane Capacitance, in F/m^2. Default value is 0.01",
123  &Neuron::setCM,
125  );
126  static ValueFinfo< Neuron, double > Em( "Em",
127  "Resting membrane potential of compartments, in Volts. "
128  "Default value is -0.065.",
129  &Neuron::setEm,
131  );
132  static ValueFinfo< Neuron, double > theta( "theta",
133  "Angle to rotate cell geometry, around long axis of neuron. "
134  "Think Longitude. Units are radians. "
135  "Default value is zero, which means no rotation. ",
138  );
139  static ValueFinfo< Neuron, double > phi( "phi",
140  "Angle to rotate cell geometry, around elevation of neuron. "
141  "Think Latitude. Units are radians. "
142  "Default value is zero, which means no rotation. ",
145  );
146 
147  static ValueFinfo< Neuron, string > sourceFile( "sourceFile",
148  "Name of source file from which to load a model. "
149  "Accepts swc and dotp formats at present. "
150  "Both these formats require that the appropriate channel "
151  "definitions should have been loaded into /library. ",
154  );
155 
156  static ValueFinfo< Neuron, double > compartmentLengthInLambdas(
157  "compartmentLengthInLambdas",
158  "Units: meters (SI). \n"
159  "Electrotonic length to use for the largest compartment in the "
160  "model. Used to define subdivision of branches into compartments. "
161  "For example, if we set *compartmentLengthInLambdas* to 0.1, "
162  "and *lambda* (electrotonic length) is 250 microns, then it "
163  "sets the compartment length to 25 microns. Thus a dendritic "
164  "branch of 500 microns is subdivided into 20 commpartments. "
165  "If the branch is shorter than *compartmentLengthInLambdas*, "
166  "then it is not subdivided. "
167  "If *compartmentLengthInLambdas* is set to 0 then the original "
168  "compartmental structure of the model is preserved. "
169  " Note that this routine does NOT merge branches, even if "
170  "*compartmentLengthInLambdas* is bigger than the branch. "
171  "While all this subdivision is being done, the Neuron class "
172  "preserves as detailed a geometry as it can, so it can rebuild "
173  "the more detailed version if needed. "
174  "Default value of *compartmentLengthInLambdas* is 0. ",
177  );
178 
180  channelDistribution(
181  "channelDistribution",
182  "Specification for distribution of channels, CaConcens and "
183  "any other model components that are defined as prototypes and "
184  "have to be placed on the electrical compartments.\n"
185  "Arguments: proto path field expr [field expr]...\n"
186  " Each entry is terminated with an empty string. "
187  "The prototype is any object created in */library*, "
188  "If a channel matching the prototype name already exists, then "
189  "all subsequent operations are applied to the extant channel and "
190  "a new one is not created. "
191  "The paired arguments are as follows: \n"
192  "The *field* argument specifies the name of the parameter "
193  "that is to be assigned by the expression.\n"
194  "The *expression* argument is a mathematical expression in "
195  "the muparser framework, which permits most operations including "
196  "trig and transcendental ones. Of course it also handles simple "
197  "numerical values like 1.0, 1e-10 and so on. "
198  "Available arguments for muParser are:\n"
199  " p, g, L, len, dia, maxP, maxG, maxL \n"
200  " p: path distance from soma, measured along dendrite, in metres.\n"
201  " g: geometrical distance from soma, in metres.\n"
202  " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n"
203  " len: length of compartment, in metres.\n"
204  " dia: for diameter of compartment, in metres.\n"
205  " maxP: Maximum value of *p* for this neuron. \n"
206  " maxG: Maximum value of *g* for this neuron. \n"
207  " maxL: Maximum value of *L* for this neuron.\n"
208  "The expression for the first field must evaluate to > 0 "
209  "for the channel to be installed. For example, for "
210  "channels, if Field == Gbar, and func( r, L, len, dia) < 0, \n"
211  "then the channel is not installed. This feature is typically "
212  "used with the sign() or Heaviside H() function to limit range: "
213  "for example: H(1 - L) will only put channels closer than "
214  "one length constant from the soma, and zero elsewhere. \n"
215  "Available fields are: \n"
216  "Channels: Gbar (install), Ek \n"
217  "CaConcen: shellDia (install), shellFrac (install), tau, min\n"
218  "Unless otherwise noted, all fields are scaled appropriately by "
219  "the dimensions of their compartment. Thus the channel "
220  "maximal conductance Gbar is automatically scaled by the area "
221  "of the compartment, and the user does not need to insert this "
222  "scaling into the calculations.\n"
223  "All parameters are expressed in SI units. Conductance, for "
224  "example, is Siemens/sq metre. "
225  "\n\n"
226  "Some example function forms might be for a channel Gbar: \n"
227  " p < 10e-6 ? 400 : 0.0 \n"
228  " equivalently, \n"
229  " H(10e-6 - p) * 400 \n"
230  " equivalently, \n"
231  " ( sign(10e-6 - p) + 1) * 200 \n"
232  "Each of these forms instruct the function to "
233  "set channel Gbar to 400 S/m^2 only within 10 microns path "
234  "distance of soma\n"
235  "\n"
236  " L < 1.0 ? 100 * exp( -L ) : 0.0 \n"
237  " ->Set channel Gbar to an exponentially falling function of "
238  "electrotonic distance from soma, provided L is under "
239  "1.0 lambdas. \n",
242  );
243 
245  passiveDistribution(
246  "passiveDistribution",
247  "Specification for distribution of passive properties of cell.\n"
248  "Arguments: . path field expr [field expr]...\n"
249  "Note that the arguments list starts with a period. "
250  " Each entry is terminated with an empty string. "
251  "The paired arguments are as follows: \n"
252  "The *field* argument specifies the name of the parameter "
253  "that is to be assigned by the expression.\n"
254  "The *expression* argument is a mathematical expression in "
255  "the muparser framework, which permits most operations including "
256  "trig and transcendental ones. Of course it also handles simple "
257  "numerical values like 1.0, 1e-10 and so on. "
258  "Available arguments for muParser are:\n"
259  " p, g, L, len, dia, maxP, maxG, maxL \n"
260  " p: path distance from soma, measured along dendrite, in metres.\n"
261  " g: geometrical distance from soma, in metres.\n"
262  " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n"
263  " len: length of compartment, in metres.\n"
264  " dia: for diameter of compartment, in metres.\n"
265  " maxP: Maximum value of *p* for this neuron. \n"
266  " maxG: Maximum value of *g* for this neuron. \n"
267  " maxL: Maximum value of *L* for this neuron.\n"
268  "Available fields are: \n"
269  "RM, RA, CM, Rm, Ra, Cm, Em, initVm \n"
270  "The first three fields are scaled appropriately by "
271  "the dimensions of their compartment. Thus the membrane "
272  "resistivity RM (ohms.m^2) is automatically scaled by the area "
273  "of the compartment, and the user does not need to insert this "
274  "scaling into the calculations to compute Rm."
275  "Using the Rm field lets the user directly assign the "
276  "membrane resistance (in ohms), presumably using len and dia.\n"
277  "Similarly, RA (ohms.m) and CM (Farads/m^2) are specific units "
278  "and the actual values for each compartment are assigned by "
279  "scaling by length and diameter. Ra (ohms) and Cm (Farads) "
280  "require explicit evaluation of the expression. "
281  "All parameters are expressed in SI units. Conductance, for "
282  "example, is Siemens/sq metre.\n"
283  "Note that time these calculations do NOT currently include spines\n",
286  );
287 
288  static ElementValueFinfo< Neuron, vector< string > >spineDistribution(
289  "spineDistribution",
290  "Specification for distribution of spines on dendrite. \n"
291  "Arguments: proto path spacing expr [field expr]...\n"
292  " Each entry is terminated with an empty string. "
293  "The *prototype* is any spine object created in */library*, \n"
294  "The *path* is the wildcard path of compartments on which to "
295  "place the spine.\n"
296  "The *spacing* is the spacing of spines, in metres. \n"
297  "The *expression* argument is a mathematical expression in "
298  "the muparser framework, which permits most operations including "
299  "trig and transcendental ones. Of course it also handles simple "
300  "numerical values like 1.0, 1e-10 and so on. "
301  "The paired arguments are as follows: \n"
302  "The *field* argument specifies the name of the parameter "
303  "that is to be assigned by the expression.\n"
304  "The *expression* argument is a mathematical expression as above. "
305  "Available arguments for muParser are:\n"
306  " p, g, L, len, dia, maxP, maxG, maxL \n"
307  " p: path distance from soma, measured along dendrite, in metres.\n"
308  " g: geometrical distance from soma, in metres.\n"
309  " L: electrotonic distance (# of lambdas) from soma, along dend. No units.\n"
310  " len: length of compartment, in metres.\n"
311  " dia: for diameter of compartment, in metres.\n"
312  " maxP: Maximum value of *p* for this neuron. \n"
313  " maxG: Maximum value of *g* for this neuron. \n"
314  " maxL: Maximum value of *L* for this neuron.\n"
315  "The expression for the *spacing* field must evaluate to > 0 for "
316  "the spine to be installed. For example, if the expresssion is\n"
317  " H(1 - L) \n"
318  "then the systemwill only put spines closer than "
319  "one length constant from the soma, and zero elsewhere. \n"
320  "Available spine parameters are: \n"
321  "spacing, minSpacing, size, sizeDistrib "
322  "angle, angleDistrib \n",
325  );
326 
327 
328  static ReadOnlyValueFinfo< Neuron, unsigned int > numCompartments(
329  "numCompartments",
330  "Number of electrical compartments in model. ",
332  );
333 
335  "numSpines",
336  "Number of dendritic spines in model. ",
338  );
339 
341  "numBranches",
342  "Number of branches in dendrites. ",
344  );
345 
346  static ReadOnlyValueFinfo< Neuron, vector< double > > pathDistFromSoma(
347  "pathDistanceFromSoma",
348  "geometrical path distance of each segment from soma, measured by "
349  "threading along the dendrite.",
351  );
352 
353  static ReadOnlyValueFinfo< Neuron, vector< double > > geomDistFromSoma(
354  "geometricalDistanceFromSoma",
355  "geometrical distance of each segment from soma.",
357  );
358 
359  static ReadOnlyValueFinfo< Neuron, vector< double > > elecDistFromSoma(
360  "electrotonicDistanceFromSoma",
361  "geometrical distance of each segment from soma, as measured along "
362  "the dendrite.",
364  );
365  static ReadOnlyValueFinfo< Neuron, vector< ObjId > > compartments(
366  "compartments",
367  "Vector of ObjIds of electrical compartments. Order matches order "
368  "of segments, and also matches the order of the electrotonic and "
369  "geometricalDistanceFromSoma vectors. ",
371  );
372 
374  compartmentsFromExpression(
375  "compartmentsFromExpression",
376  "Vector of ObjIds of electrical compartments that match the "
377  "'path expression' pair in the argument string.",
379  );
380 
382  valuesFromExpression(
383  "valuesFromExpression",
384  "Vector of values computed for each electrical compartment that "
385  "matches the 'path expression' pair in the argument string."
386  "This has 13 times the number of entries as # of compartments."
387  "For each compartment the entries are: \n"
388  "val, p, g, L, len, dia, maxP, maxG, maxL, x, y, z, 0",
390  );
391 
393  spinesFromExpression(
394  "spinesFromExpression",
395  //"Vector of ObjIds of spines/heads sitting on the electrical "
396  //"compartments that match the 'path expression' pair in the "
397  //"argument string.",
398  "Vector of ObjIds of compartments comprising spines/heads "
399  "that match the 'path expression' pair in the "
400  "argument string.",
402  );
403 
405  spinesOnCompartment(
406  "spinesOnCompartment",
407  "Vector of ObjIds of spines shafts/heads sitting on the specified "
408  "electrical compartment. If each spine has a shaft and a head,"
409  "and there are 10 spines on the compartment, there will be 20 "
410  "entries in the returned vector, ordered "
411  "shaft0, head0, shaft1, head1, ... ",
413  );
414 
416  parentCompartmentOfSpine(
417  "parentCompartmentOfSpine",
418  "Returns parent compartment of specified spine compartment."
419  "Both the spine head or its shaft will return the same parent.",
421  );
422 
424  spineIdsFromCompartmentIds(
425  "spineIdsFromCompartmentIds",
426  "Vector of ObjIds of spine entries (FieldElements on this Neuron, "
427  "used for scaling) that map to the the specified "
428  "electrical compartments. If a bad compartment Id is given, the"
429  "corresponding spine entry is the root Id.",
431  );
432 
434  // DestFinfos
436  static DestFinfo buildSegmentTree( "buildSegmentTree",
437  "Build the reference segment tree structure using the child "
438  "compartments of the current Neuron. Fills in all the coords and "
439  "length constant information into the segments, for later use "
440  "when we build reduced compartment trees and channel "
441  "distributions. Should only be called once, since subsequent use "
442  "on a reduced model will lose the original full cell geometry. ",
444  );
445  static DestFinfo setSpineAndPsdMesh( "setSpineAndPsdMesh",
446  "Assigns the spine and psd mesh to the Neuron. This is used "
447  "to build up a mapping from Spine entries on the Neuron to "
448  "chem spines and PSDs, so that volume change operations from "
449  "the Spine can propagate to the chem systems.",
451  );
452  static DestFinfo setSpineAndPsdDsolve( "setSpineAndPsdDsolve",
453  "Assigns the Dsolves used by spine and PSD to the Neuron. "
454  "This is used "
455  "to handle the rescaling of diffusion rates when spines are "
456  "resized. ",
458  );
459 
460  /*
461  static DestFinfo rotateInSpace( "rotateInSpace",
462  theta, phi
463  static DestFinfo transformInSpace( "transformInSpace",
464  transfMatrix(4x4)
465  static DestFinfo saveAsNeuroML( "saveAsNeuroML", fname )
466  static DestFinfo saveAsDotP( "saveAsDotP", fname )
467  static DestFinfo saveAsSwc( "saveAsSwc", fname )
468  */
470  // FieldElement
472  static FieldElementFinfo< Neuron, Spine > spineFinfo(
473  "spine",
474  "Field Element for spines. Used to handle dynamic "
475  "geometry changes in spines. ",
480  false
481  );
482 
484  static Finfo* neuronFinfos[] =
485  {
486  &RM, // ValueFinfo
487  &RA, // ValueFinfo
488  &CM, // ValueFinfo
489  &Em, // ValueFinfo
490  &theta, // ValueFinfo
491  &phi, // ValueFinfo
492  &sourceFile, // ValueFinfo
493  &compartmentLengthInLambdas, // ValueFinfo
494  &numCompartments, // ReadOnlyValueFinfo
495  &numSpines, // ReadOnlyValueFinfo
496  &numBranches, // ReadOnlyValueFinfo
497  &pathDistFromSoma, // ReadOnlyValueFinfo
498  &geomDistFromSoma, // ReadOnlyValueFinfo
499  &elecDistFromSoma, // ReadOnlyValueFinfo
500  &compartments, // ReadOnlyValueFinfo
501  &channelDistribution, // ValueFinfo
502  &passiveDistribution, // ValueFinfo
503  &spineDistribution, // ValueFinfo
504  // &mechSpec, // ValueFinfo
505  // &spineSpecification, // ValueFinfo
506  &compartmentsFromExpression, // ReadOnlyLookupValueFinfo
507  &valuesFromExpression, // ReadOnlyLookupValueFinfo
508  &spinesFromExpression, // ReadOnlyLookupValueFinfo
509  &spinesOnCompartment, // ReadOnlyLookupValueFinfo
510  &parentCompartmentOfSpine, // ReadOnlyLookupValueFinfo
511  &spineIdsFromCompartmentIds, // ReadOnlyLookupValueFinfo
512  &buildSegmentTree, // DestFinfo
513  &setSpineAndPsdMesh, // DestFinfo
514  &setSpineAndPsdDsolve, // DestFinfo
515  &spineFinfo, // FieldElementFinfo
516  };
517  static string doc[] =
518  {
519  "Name", "Neuron",
520  "Author", "C H Chaitanya, Upi Bhalla",
521  "Description", "Neuron - Manager for neurons. "
522  "Handles high-level specification of distribution of "
523  "spines, channels and passive properties. Also manages "
524  "spine resizing through a Spine FieldElement. ",
525  };
526  static Dinfo<Neuron> dinfo;
527  static Cinfo neuronCinfo(
528  "Neuron",
530  neuronFinfos, sizeof( neuronFinfos ) / sizeof( Finfo* ),
531  &dinfo,
532  doc,
533  sizeof(doc)/sizeof(string)
534  );
535 
536  return &neuronCinfo;
537 }
unsigned int getNumCompartments() const
Definition: Neuron.cpp:904
void setPassiveDistribution(const Eref &e, vector< string > v)
Definition: Neuron.cpp:1163
void setCM(double v)
Definition: Neuron.cpp:838
void setSpineAndPsdDsolve(Id spineDsolve, Id psdDsolve)
Definition: Neuron.cpp:1462
void setRA(double v)
Definition: Neuron.cpp:826
vector< double > getPathDistFromSoma() const
Definition: Neuron.cpp:921
Definition: Dinfo.h:60
unsigned int getNumBranches() const
Definition: Neuron.cpp:916
vector< ObjId > getExprElist(const Eref &e, string line) const
Definition: Neuron.cpp:959
void setSourceFile(string v)
Definition: Neuron.cpp:883
Spine * lookupSpine(unsigned int index)
Definition: Neuron.cpp:2028
Definition: OpFunc.h:40
vector< string > getChannelDistribution(const Eref &e) const
Definition: Neuron.cpp:1158
double getRM() const
Definition: Neuron.cpp:821
double getCompartmentLengthInLambdas() const
Definition: Neuron.cpp:899
double getPhi() const
Definition: Neuron.cpp:877
void setPhi(double v)
Definition: Neuron.cpp:872
double getRA() const
Definition: Neuron.cpp:833
void setSpineAndPsdMesh(Id spineMesh, Id psdMesh)
Fills up vector of segments. First entry is soma.
Definition: Neuron.cpp:1410
double getEm() const
Definition: Neuron.cpp:855
double getCM() const
Definition: Neuron.cpp:845
static const Cinfo * initCinfo()
Definition: Spine.cpp:17
Definition: EpFunc.h:49
vector< ObjId > getSpinesFromExpression(const Eref &e, string line) const
Definition: Neuron.cpp:1009
void setTheta(double v)
Definition: Neuron.cpp:861
string getSourceFile() const
Definition: Neuron.cpp:889
vector< double > getExprVal(const Eref &e, string line) const
Definition: Neuron.cpp:991
vector< string > getSpineDistribution(const Eref &e) const
Definition: Neuron.cpp:1205
vector< string > getPassiveDistribution(const Eref &e) const
Definition: Neuron.cpp:1183
double getTheta() const
Definition: Neuron.cpp:866
ObjId getParentCompartmentOfSpine(const Eref &e, ObjId compt) const
Definition: Neuron.cpp:1066
void setSpineDistribution(const Eref &e, vector< string > v)
Definition: Neuron.cpp:1188
void setChannelDistribution(const Eref &e, vector< string > v)
Definition: Neuron.cpp:1132
vector< ObjId > getSpineIdsFromCompartmentIds(const Eref &e, vector< ObjId > compt) const
Definition: Neuron.cpp:1079
vector< ObjId > getCompartments() const
Definition: Neuron.cpp:945
void setCompartmentLengthInLambdas(double v)
Definition: Neuron.cpp:895
void setNumSpines(unsigned int num)
Definition: Neuron.cpp:2033
void buildSegmentTree(const Eref &e)
Fills up vector of segments. First entry is soma.
Definition: Neuron.cpp:1362
unsigned int getNumSpines() const
Definition: Neuron.cpp:2039
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
vector< ObjId > getSpinesOnCompartment(const Eref &e, ObjId compt) const
Definition: Neuron.cpp:1050
void setRM(double v)
Definition: Neuron.cpp:814
static const Cinfo * neuronCinfo
Definition: Neuron.cpp:539
Definition: Cinfo.h:18
void setEm(double v)
Definition: Neuron.cpp:851
vector< double > getGeomDistFromSoma() const
Definition: Neuron.cpp:929
Definition: Finfo.h:12
vector< double > getElecDistFromSoma() const
Definition: Neuron.cpp:937

+ Here is the call graph for this function:

void Neuron::installMechanism ( const string &  name,
const vector< ObjId > &  elist,
const vector< double > &  val,
const vector< string > &  line 
)
void Neuron::installSpines ( const vector< ObjId > &  elist,
const vector< double > &  val,
const vector< string > &  line 
)

Now fill in allSpinesPerCompt_ vector. First clear it out.

Definition at line 1974 of file Neuron.cpp.

References addSpine(), allSpinesPerCompt_, coordSystem(), makeAngleDistrib(), makeSizeDistrib(), makeSpacingDistrib(), psdStoich_, segId_, soma_, spineParentSegIndex_, spines_, spineStoich_, and spineToMeshOrdering_.

Referenced by setSpineDistribution().

1976 {
1977  Id spineProto( "/library/spine" );
1978 
1979  if ( spineProto == Id() )
1980  {
1981  cout << "Warning: Neuron::installSpines: Unable to find prototype spine: /library/spine\n";
1982  return;
1983  }
1984  // Look up elist index from pos index, since there may be many
1985  // spines on each segment.
1986  vector< unsigned int > elistIndex;
1987  vector< double > pos; // spacing of the new spines along compt.
1988  vector< double > theta; // Angle of spines
1989  vector< double > size; // Size scaling of spines
1990  pos.reserve( elist.size() );
1991  elistIndex.reserve( elist.size() );
1992 
1993  makeSpacingDistrib( elist, val,
1994  spineParentSegIndex_, elistIndex, pos, line);
1995  makeAngleDistrib( elist, val, elistIndex, theta, line );
1996  makeSizeDistrib( elist, val, elistIndex, size, line );
1997  for ( unsigned int k = 0; k < spineParentSegIndex_.size(); ++k )
1998  {
1999  unsigned int i = spineParentSegIndex_[k];
2000  Vec x, y, z;
2001  coordSystem( soma_, segId_[i], x, y, z );
2002  spines_.push_back(
2003  addSpine( segId_[i], spineProto, pos[k], theta[k],
2004  x, y, z, size[k], k )
2005  );
2006  }
2007  spineToMeshOrdering_.clear();
2008  spineToMeshOrdering_.resize( spines_.size(), 0 );
2009  spineStoich_.clear();
2010  spineStoich_.resize( spines_.size() );
2011  psdStoich_.clear();
2012  psdStoich_.resize( spines_.size() );
2013 
2015  allSpinesPerCompt_.clear();
2016  allSpinesPerCompt_.resize(segId_.size() );
2017  for ( unsigned int i = 0; i < spines_.size(); ++i )
2018  {
2019  assert( allSpinesPerCompt_.size() > spineParentSegIndex_[i] );
2020  vector< Id >& s = allSpinesPerCompt_[ spineParentSegIndex_[i] ];
2021  s.insert( s.end(), spines_[i].begin(), spines_[i].end() );
2022  }
2023 }
Id soma_
Definition: Neuron.h:119
vector< unsigned int > spineToMeshOrdering_
looks up spine/psd mesh index from FieldIndex of selected spine.
Definition: Neuron.h:140
void makeSpacingDistrib(const vector< ObjId > &elist, const vector< double > &val, vector< unsigned int > &seglistIndex, vector< unsigned int > &elistIndex, vector< double > &pos, const vector< string > &line) const
Definition: Neuron.cpp:1841
vector< vector< Id > > allSpinesPerCompt_
Id of each compt in each spine.
Definition: Neuron.h:133
vector< Id > psdStoich_
Id of stoich associated with each PSD. Typically all the same.
Definition: Neuron.h:138
Definition: Vec.h:13
static void makeSizeDistrib(const vector< ObjId > &elist, const vector< double > &val, vector< unsigned int > &elistIndex, vector< double > &size, const vector< string > &line)
Definition: Neuron.cpp:1932
static double coordSystem(Id soma, Id dend, Vec &x, Vec &y, Vec &z)
Definition: Neuron.cpp:1546
vector< vector< Id > > spines_
Definition: Neuron.h:130
vector< Id > segId_
Definition: Neuron.h:152
static void makeAngleDistrib(const vector< ObjId > &elist, const vector< double > &val, vector< unsigned int > &elistIndex, vector< double > &theta, const vector< string > &line)
Definition: Neuron.cpp:1888
vector< unsigned int > spineParentSegIndex_
Look up seg index of parent compartment, from index of spine.
Definition: Neuron.h:129
Definition: Id.h:17
vector< Id > spineStoich_
Id of stoich associated with each spine. Typically all the same.
Definition: Neuron.h:136
static vector< Id > addSpine(Id parentCompt, Id spineProto, double pos, double angle, Vec &x, Vec &y, Vec &z, double size, unsigned int k)
Definition: Neuron.cpp:1649

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Spine * Neuron::lookupSpine ( unsigned int  index)

Definition at line 2028 of file Neuron.cpp.

References spineEntry_.

Referenced by getSpineIdsFromCompartmentIds(), and initCinfo().

2029 {
2030  return &spineEntry_;
2031 }
Spine spineEntry_
Id of the Dsolve for the PSD compt.
Definition: Neuron.h:150

+ Here is the caller graph for this function:

void Neuron::makeSpacingDistrib ( const vector< ObjId > &  elist,
const vector< double > &  val,
vector< unsigned int > &  seglistIndex,
vector< unsigned int > &  elistIndex,
vector< double > &  pos,
const vector< string > &  line 
) const

Definition at line 1841 of file Neuron.cpp.

References addPos(), nuParser::eval(), nuParser::EXPR, findArg(), nuParser::numVal, segIndex_, and segs_.

Referenced by installSpines().

1847 {
1848  string distribExpr = findArg( line, "spacingDistrib" );
1849  pos.resize( 0 );
1850  elistIndex.resize( 0 );
1851 
1852  try
1853  {
1854  nuParser parser( distribExpr );
1855 
1856  for ( unsigned int i = 0; i < elist.size(); ++i )
1857  {
1858  unsigned int j = i * nuParser::numVal;
1859  if ( val[ j + nuParser::EXPR ] > 0 )
1860  {
1861  double spacing = val[ j + nuParser::EXPR ];
1862  double spacingDistrib = parser.eval( val.begin() + j );
1863  if ( spacingDistrib > spacing || spacingDistrib < 0 )
1864  {
1865  cout << "Warning: Neuron::makeSpacingDistrib: " <<
1866  "0 < " << spacingDistrib << " < " << spacing <<
1867  " fails on " << elist[i].path() << ". Using 0.\n";
1868  spacingDistrib = 0.0;
1869  }
1870  map< Id, unsigned int>::const_iterator
1871  lookupDend = segIndex_.find( elist[i] );
1872  if ( lookupDend != segIndex_.end() )
1873  {
1874  double dendLength = segs_[lookupDend->second].length();
1875  addPos( lookupDend->second, i,
1876  spacing, spacingDistrib, dendLength,
1877  seglistIndex, elistIndex, pos );
1878  }
1879  }
1880  }
1881  }
1882  catch ( mu::Parser::exception_type& err )
1883  {
1884  cout << err.GetMsg() << endl;
1885  }
1886 }
map< Id, unsigned int > segIndex_
Map to look up Seg index from Id of associated compt.
Definition: Neuron.h:127
string findArg(const vector< string > &line, const string &field)
Definition: Neuron.cpp:1716
static void addPos(unsigned int segIndex, unsigned int eIndex, double spacing, double minSpacing, double dendLength, vector< unsigned int > &seglistIndex, vector< unsigned int > &elistIndex, vector< double > &pos)
Add entries into the pos vector for a given compartment i.
Definition: Neuron.cpp:1784
static const unsigned int numVal
Definition: Neuron.cpp:88
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::parseMechSpec ( const Eref e)
void Neuron::scaleBufAndRates ( unsigned int  spineNum,
double  lenScale,
double  diaScale 
) const

Definition at line 2055 of file Neuron.cpp.

References doubleEq(), psdStoich_, SetGet2< A1, A2 >::set(), spineStoich_, and spineToMeshOrdering_.

Referenced by Spine::setHeadDiameter(), Spine::setHeadLength(), and Spine::setHeadVolume().

2057 {
2058  double volScale = lenScale * diaScale * diaScale;
2059  if ( doubleEq( volScale, 1.0 ) )
2060  return;
2061  if ( spineStoich_.size() == 0 )
2062  // Perhaps no chem stuff in model, but user could have forgotten
2063  // to assign psd and spine meshes.
2064  return;
2065 
2066  if ( spineNum > spineStoich_.size() )
2067  {
2068  cout << "Error: Neuron::scaleBufAndRates: spineNum too big: " <<
2069  spineNum << " >= " << spineStoich_.size() << endl;
2070  return;
2071  }
2072  Id ss = spineStoich_[ spineNum ];
2073  if ( ss == Id() )
2074  {
2075  // The chem system for the spine may not have been defined.
2076  // Later figure out how to deal with cases where there is a psd
2077  // but no spine.
2078  return;
2079  }
2080  Id ps = psdStoich_[ spineNum ];
2081  if ( ps == Id() )
2082  {
2083  // The chem system for the spine may not have been defined.
2084  return;
2085  }
2086  SetGet2< unsigned int, double >::set( ss, "scaleBufsAndRates",
2087  spineToMeshOrdering_[spineNum], volScale );
2088  volScale = diaScale * diaScale;
2089  SetGet2< unsigned int, double >::set( ps, "scaleBufsAndRates",
2090  spineToMeshOrdering_[spineNum], volScale );
2091 }
vector< unsigned int > spineToMeshOrdering_
looks up spine/psd mesh index from FieldIndex of selected spine.
Definition: Neuron.h:140
vector< Id > psdStoich_
Id of stoich associated with each PSD. Typically all the same.
Definition: Neuron.h:138
bool doubleEq(double x, double y)
Definition: doubleEq.cpp:16
Definition: Id.h:17
vector< Id > spineStoich_
Id of stoich associated with each spine. Typically all the same.
Definition: Neuron.h:136
static bool set(const ObjId &dest, const string &field, A1 arg1, A2 arg2)
Definition: SetGet.h:365

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::scaleHeadDiffusion ( unsigned int  spineNum,
double  len,
double  dia 
) const

Scale the diffusion parameters due to a change in the head dimensions.

Definition at line 2106 of file Neuron.cpp.

References Field< A >::get(), headDsolve_, PI, psdDsolve_, SetGet2< A1, A2 >::set(), LookupField< L, A >::set(), and spineToMeshOrdering_.

Referenced by Spine::setHeadDiameter(), Spine::setHeadLength(), and Spine::setHeadVolume().

2108 {
2109  double vol = len * dia * dia * PI * 0.25;
2110  // Note that the diffusion scale for the PSD uses half the length
2111  // of the head compartment. I'm explicitly putting this in below.
2112  double diffScale = dia * dia * 0.25 * PI / (len/2.0);
2113  unsigned int meshIndex = spineToMeshOrdering_[ spineNum ];
2114  Id headCompt = Field< Id >::get( headDsolve_, "compartment" );
2115  LookupField< unsigned int, double >::set( headCompt, "oneVoxelVolume",
2116  meshIndex, vol );
2117  Id psdCompt = Field< Id >::get( psdDsolve_, "compartment" );
2118  double thick = Field< double >::get( psdCompt, "thickness" );
2119  double psdVol = thick * dia * dia * PI * 0.25;
2120  LookupField< unsigned int, double >::set( psdCompt, "oneVoxelVolume",
2121  meshIndex, psdVol );
2123  headDsolve_, "setDiffVol1", meshIndex, vol );
2125  psdDsolve_, "setDiffVol2", meshIndex, vol );
2127  psdDsolve_, "setDiffVol1", meshIndex, psdVol );
2129  psdDsolve_, "setDiffScale", meshIndex, diffScale );
2130 }
vector< unsigned int > spineToMeshOrdering_
looks up spine/psd mesh index from FieldIndex of selected spine.
Definition: Neuron.h:140
static bool set(const ObjId &dest, const string &field, L index, A arg)
Definition: SetGet.h:467
Id headDsolve_
Definition: Neuron.h:142
Id psdDsolve_
Id of the Dsolve for the head compt.
Definition: Neuron.h:143
const double PI
Definition: consts.cpp:12
Definition: Id.h:17
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284
static bool set(const ObjId &dest, const string &field, A1 arg1, A2 arg2)
Definition: SetGet.h:365

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::scaleShaftDiffusion ( unsigned int  spineNum,
double  len,
double  dia 
) const

Scale the diffusion parameters due to a change in the shaft dimensions.

Definition at line 2094 of file Neuron.cpp.

References headDsolve_, PI, SetGet2< A1, A2 >::set(), and spineToMeshOrdering_.

Referenced by Spine::setShaftDiameter(), and Spine::setShaftLength().

2096 {
2097  double diffScale = dia * dia * 0.25 * PI / len;
2099  // Note that the buildNeuroMeshJunctions function is called
2100  // on the dendDsolve with the args smdsolve, pmdsolve.
2101  headDsolve_, "setDiffScale",
2102  spineToMeshOrdering_[ spineNum ], diffScale );
2103 }
vector< unsigned int > spineToMeshOrdering_
looks up spine/psd mesh index from FieldIndex of selected spine.
Definition: Neuron.h:140
Id headDsolve_
Definition: Neuron.h:142
const double PI
Definition: consts.cpp:12
static bool set(const ObjId &dest, const string &field, A1 arg1, A2 arg2)
Definition: SetGet.h:365

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::setChannelDistribution ( const Eref e,
vector< string >  v 
)

Definition at line 1132 of file Neuron.cpp.

References buildElist(), buildFromProto(), channelDistribution_, parseDistrib(), and setMechParams().

Referenced by initCinfo().

1133 {
1134  // Here we should clear the extant channels, if any.
1135  vector< vector< string > > lines;
1136  if ( parseDistrib( lines, v ) )
1137  {
1139  for ( unsigned int i = 0; i < lines.size(); ++i )
1140  {
1141  vector< string >& temp = lines[i];
1142  vector< ObjId > elist;
1143  vector< double > val;
1144  buildElist( e, temp, elist, val );
1145 
1146  vector< ObjId > mech( elist.size() );
1147  if ( buildFromProto( temp[0], elist, val, mech ) )
1148  {
1149  for ( unsigned int j = 2; j < temp.size(); j += 2 )
1150  {
1151  setMechParams( mech, elist, val, temp[j], temp[j+1] );
1152  }
1153  }
1154  }
1155  }
1156 }
static void setMechParams(const vector< ObjId > &mech, const vector< ObjId > &elist, const vector< double > &val, const string &field, const string &expr)
Definition: Neuron.cpp:784
bool parseDistrib(vector< vector< string > > &lines, const vector< string > &distrib)
Definition: Neuron.cpp:587
vector< string > channelDistribution_
Definition: Neuron.h:122
void buildElist(const Eref &e, const vector< string > &line, vector< ObjId > &elist, vector< double > &val)
Definition: Neuron.cpp:1116
static bool buildFromProto(const string &name, const vector< ObjId > &elist, const vector< double > &val, vector< ObjId > &mech)
Definition: Neuron.cpp:647

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::setCM ( double  v)

Definition at line 838 of file Neuron.cpp.

References CM_.

Referenced by initCinfo().

839 {
840  if ( v > 0.0 )
841  CM_ = v;
842  else
843  cout << "Warning:: Neuron::setCM: value must be +ve, is " << v << endl;
844 }
double CM_
Definition: Neuron.h:112

+ Here is the caller graph for this function:

void Neuron::setCompartmentLengthInLambdas ( double  v)

Definition at line 895 of file Neuron.cpp.

References compartmentLengthInLambdas_.

Referenced by initCinfo().

896 {
898 }
double compartmentLengthInLambdas_
Definition: Neuron.h:121

+ Here is the caller graph for this function:

void Neuron::setEm ( double  v)

Definition at line 851 of file Neuron.cpp.

References Em_.

Referenced by initCinfo().

852 {
853  Em_ = v;
854 }
double Em_
Definition: Neuron.h:113

+ Here is the caller graph for this function:

void Neuron::setNumSpines ( unsigned int  num)

Ignore it. the number of spines is set when we build the tree.

Definition at line 2033 of file Neuron.cpp.

Referenced by initCinfo().

2034 {
2036  ;
2037 }

+ Here is the caller graph for this function:

void Neuron::setPassiveDistribution ( const Eref e,
vector< string >  v 
)

Definition at line 1163 of file Neuron.cpp.

References buildElist(), parseDistrib(), passiveDistribution_, and setCompartmentParams().

Referenced by initCinfo().

1164 {
1165  vector< vector< string > > lines;
1166  if ( parseDistrib( lines, v ) )
1167  {
1169  for ( unsigned int i = 0; i < lines.size(); ++i )
1170  {
1171  vector< string >& temp = lines[i];
1172  vector< ObjId > elist;
1173  vector< double > val;
1174  buildElist( e, temp, elist, val );
1175  for ( unsigned int j = 2; j < temp.size(); j += 2 )
1176  {
1177  setCompartmentParams( elist, val, temp[j], temp[j+1] );
1178  }
1179  }
1180  }
1181 }
bool parseDistrib(vector< vector< string > > &lines, const vector< string > &distrib)
Definition: Neuron.cpp:587
vector< string > passiveDistribution_
Definition: Neuron.h:123
void buildElist(const Eref &e, const vector< string > &line, vector< ObjId > &elist, vector< double > &val)
Definition: Neuron.cpp:1116
static void setCompartmentParams(const vector< ObjId > &elist, const vector< double > &val, const string &field, const string &expr)
Definition: Neuron.cpp:758

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::setPhi ( double  v)

Definition at line 872 of file Neuron.cpp.

References phi_.

Referenced by initCinfo().

873 {
874  phi_ = v;
875  // Do stuff here for rotating it.
876 }
double phi_
Definition: Neuron.h:115

+ Here is the caller graph for this function:

void Neuron::setRA ( double  v)

Definition at line 826 of file Neuron.cpp.

References RA_.

Referenced by initCinfo().

827 {
828  if ( v > 0.0 )
829  RA_ = v;
830  else
831  cout << "Warning:: Neuron::setRA: value must be +ve, is " << v << endl;
832 }
double RA_
Definition: Neuron.h:111

+ Here is the caller graph for this function:

void Neuron::setRM ( double  v)

Definition at line 814 of file Neuron.cpp.

References RM_.

Referenced by initCinfo().

815 {
816  if ( v > 0.0 )
817  RM_ = v;
818  else
819  cout << "Warning:: Neuron::setRM: value must be +ve, is " << v << endl;
820 }
double RM_
Definition: Neuron.h:110

+ Here is the caller graph for this function:

void Neuron::setSourceFile ( string  v)

Definition at line 883 of file Neuron.cpp.

References sourceFile_.

Referenced by initCinfo().

884 {
885  sourceFile_ = v;
886  // Stuff here for loading it.
887 }
string sourceFile_
Definition: Neuron.h:120

+ Here is the caller graph for this function:

void Neuron::setSpineAndPsdDsolve ( Id  spineDsolve,
Id  psdDsolve 
)

Definition at line 1462 of file Neuron.cpp.

References headDsolve_, and psdDsolve_.

Referenced by initCinfo().

1463 {
1464  headDsolve_ = spineDsolve;
1465  psdDsolve_ = psdDsolve;
1466 }
Id headDsolve_
Definition: Neuron.h:142
Id psdDsolve_
Id of the Dsolve for the head compt.
Definition: Neuron.h:143

+ Here is the caller graph for this function:

void Neuron::setSpineAndPsdMesh ( Id  spineMesh,
Id  psdMesh 
)

Fills up vector of segments. First entry is soma.

Definition at line 1410 of file Neuron.cpp.

References Neutral::child(), Element::cinfo(), Id::element(), Id::eref(), Cinfo::isA(), Id::path(), psdStoich_, spines_, spineStoich_, and spineToMeshOrdering_.

Referenced by initCinfo().

1411 {
1412  if ( !spineMesh.element()->cinfo()->isA( "SpineMesh" ) )
1413  {
1414  cout << "Error: Neuron::setSpineAndPsdMesh: '" <<
1415  spineMesh.path() << "' is not a SpineMesh\n";
1416  return;
1417  }
1418  if ( !psdMesh.element()->cinfo()->isA( "PsdMesh" ) )
1419  {
1420  cout << "Error: Neuron::setSpineAndPsdMesh: '" <<
1421  psdMesh.path() << "' is not a PsdMesh\n";
1422  return;
1423  }
1424  Id spineStoich = Neutral::child( spineMesh.eref(), "stoich" );
1425  Id psdStoich = Neutral::child( psdMesh.eref(), "stoich" );
1426  if ( spineStoich == Id() || psdStoich == Id() )
1427  {
1428  cout << "Error: Neuron::setSpineAndPsdMesh: Stoich child not found\n";
1429  return;
1430  }
1431 
1432  vector< Id > spineList = Field< vector< Id > >::get(
1433  spineMesh, "elecComptList" );
1434  vector< Id > psdList = Field< vector< Id > >::get(
1435  psdMesh, "elecComptList" );
1436  assert( spineList.size()== psdList.size() );
1437  map< Id, unsigned int > spineMap; // spineMap[ SpineOnNeuron ] = index
1438  for ( unsigned int i = 0; i < spines_.size(); ++i )
1439  {
1440  assert( spines_[i].size() > 1 );
1441  spineMap[ spines_[i][1] ] = i;
1442  }
1443  // We don't want to clear this because we can use a single vector
1444  // to overlay a number of spine meshes, since each will be a distinct
1445  // subset of the full list of spines. None is used twice.
1446  // spineToMeshOrdering_.clear();
1447  for( unsigned int i = 0; i < spineList.size(); ++i )
1448  {
1449  map< Id, unsigned int >::iterator j = spineMap.find( spineList[i]);
1450  if ( j == spineMap.end() )
1451  {
1452  cout << "Error: Neuron::setSpineAndPsdMesh: spine '" <<
1453  spineList[i].path() << "' not found on Neuron\n";
1454  return;
1455  }
1456  spineToMeshOrdering_[ j->second ] = i;
1457  spineStoich_[ j->second ] = spineStoich;
1458  psdStoich_[ j->second ] = psdStoich;
1459  }
1460 }
vector< unsigned int > spineToMeshOrdering_
looks up spine/psd mesh index from FieldIndex of selected spine.
Definition: Neuron.h:140
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
Definition: SetGet.h:236
static Id child(const Eref &e, const string &name)
Definition: Neutral.cpp:665
Eref eref() const
Definition: Id.cpp:125
vector< Id > psdStoich_
Id of stoich associated with each PSD. Typically all the same.
Definition: Neuron.h:138
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
vector< vector< Id > > spines_
Definition: Neuron.h:130
const Cinfo * cinfo() const
Definition: Element.cpp:66
Definition: Id.h:17
vector< Id > spineStoich_
Id of stoich associated with each spine. Typically all the same.
Definition: Neuron.h:136

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::setSpineDistribution ( const Eref e,
vector< string >  v 
)

Definition at line 1188 of file Neuron.cpp.

References buildElist(), installSpines(), parseDistrib(), and spineDistribution_.

Referenced by initCinfo().

1189 {
1190  // Here we should clear the extant spines, if any.
1191  vector< vector< string > > lines;
1192  if ( parseDistrib( lines, v ) )
1193  {
1194  spineDistribution_ = v;
1195  for ( unsigned int i = 0; i < lines.size(); ++i )
1196  {
1197  vector< ObjId > elist;
1198  vector< double > val;
1199  buildElist( e, lines[i], elist, val );
1200  installSpines( elist, val, lines[i] );
1201  }
1202  }
1203 }
bool parseDistrib(vector< vector< string > > &lines, const vector< string > &distrib)
Definition: Neuron.cpp:587
void installSpines(const vector< ObjId > &elist, const vector< double > &val, const vector< string > &line)
Definition: Neuron.cpp:1974
void buildElist(const Eref &e, const vector< string > &line, vector< ObjId > &elist, vector< double > &val)
Definition: Neuron.cpp:1116
vector< string > spineDistribution_
Definition: Neuron.h:124

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neuron::setTheta ( double  v)

Definition at line 861 of file Neuron.cpp.

References theta_.

Referenced by initCinfo().

862 {
863  theta_ = v;
864  // Do stuff here for rotating it.
865 }
double theta_
Definition: Neuron.h:114

+ Here is the caller graph for this function:

const vector< Id > & Neuron::spineIds ( unsigned int  index) const

Definition at line 2047 of file Neuron.cpp.

References spines_.

Referenced by Spine::getHeadDiameter(), Spine::getHeadLength(), Spine::getShaftDiameter(), Spine::getShaftLength(), Spine::setHeadDiameter(), Spine::setHeadLength(), Spine::setHeadVolume(), Spine::setShaftDiameter(), and Spine::setShaftLength().

2048 {
2049  static vector< Id > fail;
2050  if ( index < spines_.size() )
2051  return spines_[index];
2052  return fail;
2053 }
vector< vector< Id > > spines_
Definition: Neuron.h:130

+ Here is the caller graph for this function:

void Neuron::updateSegmentLengths ( )

Definition at line 1333 of file Neuron.cpp.

References Field< A >::get(), maxG_, maxL_, maxP_, segId_, segs_, soma_, and traverseCumulativeDistance().

Referenced by buildSegmentTree().

1334 {
1335  double len = Field< double >::get( soma_, "length" );
1336  double dia = Field< double >::get( soma_, "diameter" );
1337  if ( len < dia )
1338  len = dia;
1339  double Rm = Field< double >::get( soma_, "Rm" );
1340  double Ra = Field< double >::get( soma_, "Ra" );
1341  double L = sqrt( Ra / Rm );
1342 
1343  for ( unsigned int i = 0; i < segs_.size(); ++i )
1344  {
1345  segs_[i].setGeometricalDistanceFromSoma( segs_[0] );
1346  }
1347 
1348  traverseCumulativeDistance( segs_[0], segs_, segId_, len, L, 0, 0 );
1349  maxL_ = maxG_ = maxP_ = 0.0;
1350  for ( unsigned int i = 0; i < segs_.size(); ++i )
1351  {
1352  double p = segs_[i].getPathDistFromSoma();
1353  if ( maxP_ < p ) maxP_ = p;
1354  double g = segs_[i].getGeomDistFromSoma();
1355  if ( maxG_ < g ) maxG_ = g;
1356  double L = segs_[i].getElecDistFromSoma();
1357  if ( maxL_ < L ) maxL_ = L;
1358  }
1359 }
Id soma_
Definition: Neuron.h:119
double maxL_
Definition: Neuron.h:118
static void traverseCumulativeDistance(SwcSegment &self, vector< SwcSegment > &segs, const vector< Id > &lookupId, double len, double L, double pSoma, double eSoma)
Recursive function to fill in cumulative distances from soma.
Definition: Neuron.cpp:1311
double maxG_
Definition: Neuron.h:117
double maxP_
Definition: Neuron.h:116
vector< Id > segId_
Definition: Neuron.h:152
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284
vector< SwcSegment > segs_
Id of compartment in each Seg entry, below.
Definition: Neuron.h:153

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

vector< vector< Id > > Neuron::allSpinesPerCompt_
private

Id of each compt in each spine.

Ids of all spines on each compt, looked up by segIndex of compt.

Definition at line 133 of file Neuron.h.

Referenced by getParentCompartmentOfSpine(), getSpinesFromExpression(), getSpinesOnCompartment(), and installSpines().

vector< SwcBranch > Neuron::branches_
private

Definition at line 154 of file Neuron.h.

Referenced by getNumBranches().

vector< string > Neuron::channelDistribution_
private

Definition at line 122 of file Neuron.h.

Referenced by getChannelDistribution(), and setChannelDistribution().

double Neuron::CM_
private

Definition at line 112 of file Neuron.h.

Referenced by getCM(), and setCM().

double Neuron::compartmentLengthInLambdas_
private

Definition at line 121 of file Neuron.h.

Referenced by getCompartmentLengthInLambdas(), and setCompartmentLengthInLambdas().

double Neuron::Em_
private

Definition at line 113 of file Neuron.h.

Referenced by getEm(), and setEm().

Id Neuron::headDsolve_
private

Definition at line 142 of file Neuron.h.

Referenced by scaleHeadDiffusion(), scaleShaftDiffusion(), and setSpineAndPsdDsolve().

double Neuron::maxG_
private

Definition at line 117 of file Neuron.h.

Referenced by evalExprForElist(), and updateSegmentLengths().

double Neuron::maxL_
private

Definition at line 118 of file Neuron.h.

Referenced by evalExprForElist(), and updateSegmentLengths().

double Neuron::maxP_
private

Definition at line 116 of file Neuron.h.

Referenced by evalExprForElist(), and updateSegmentLengths().

vector< string > Neuron::passiveDistribution_
private

Definition at line 123 of file Neuron.h.

Referenced by getPassiveDistribution(), and setPassiveDistribution().

double Neuron::phi_
private

Definition at line 115 of file Neuron.h.

Referenced by getPhi(), and setPhi().

Id Neuron::psdDsolve_
private

Id of the Dsolve for the head compt.

Definition at line 143 of file Neuron.h.

Referenced by scaleHeadDiffusion(), and setSpineAndPsdDsolve().

vector< Id > Neuron::psdStoich_
private

Id of stoich associated with each PSD. Typically all the same.

Definition at line 138 of file Neuron.h.

Referenced by installSpines(), scaleBufAndRates(), and setSpineAndPsdMesh().

double Neuron::RA_
private

Definition at line 111 of file Neuron.h.

Referenced by getRA(), and setRA().

double Neuron::RM_
private

Definition at line 110 of file Neuron.h.

Referenced by getRM(), and setRM().

map< Id, unsigned int > Neuron::segIndex_
private

Map to look up Seg index from Id of associated compt.

Definition at line 127 of file Neuron.h.

Referenced by buildSegmentTree(), evalExprForElist(), getSpinesFromExpression(), getSpinesOnCompartment(), and makeSpacingDistrib().

vector< SwcSegment > Neuron::segs_
private

Id of compartment in each Seg entry, below.

Definition at line 153 of file Neuron.h.

Referenced by buildSegmentTree(), evalExprForElist(), getElecDistFromSoma(), getGeomDistFromSoma(), getPathDistFromSoma(), makeSpacingDistrib(), and updateSegmentLengths().

Id Neuron::soma_
private

Definition at line 119 of file Neuron.h.

Referenced by buildSegmentTree(), installSpines(), and updateSegmentLengths().

string Neuron::sourceFile_
private

Definition at line 120 of file Neuron.h.

Referenced by getSourceFile(), and setSourceFile().

vector< string > Neuron::spineDistribution_
private

Definition at line 124 of file Neuron.h.

Referenced by getSpineDistribution(), and setSpineDistribution().

Spine Neuron::spineEntry_
private

Id of the Dsolve for the PSD compt.

Holder for spine operations. Contains pointer to current Neuron.

Definition at line 150 of file Neuron.h.

Referenced by lookupSpine().

vector< unsigned int > Neuron::spineParentSegIndex_
private

Look up seg index of parent compartment, from index of spine.

Definition at line 129 of file Neuron.h.

Referenced by installSpines().

vector< vector< Id > > Neuron::spines_
private
vector< Id > Neuron::spineStoich_
private

Id of stoich associated with each spine. Typically all the same.

Definition at line 136 of file Neuron.h.

Referenced by installSpines(), scaleBufAndRates(), and setSpineAndPsdMesh().

vector< unsigned int > Neuron::spineToMeshOrdering_
private

looks up spine/psd mesh index from FieldIndex of selected spine.

Definition at line 140 of file Neuron.h.

Referenced by installSpines(), scaleBufAndRates(), scaleHeadDiffusion(), scaleShaftDiffusion(), and setSpineAndPsdMesh().

double Neuron::theta_
private

Definition at line 114 of file Neuron.h.

Referenced by getTheta(), and setTheta().


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