MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NeuroNode.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2012 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #include "header.h"
11 #include "SparseMatrix.h"
12 #include "Boundary.h"
13 #include "MeshEntry.h"
14 #include "VoxelJunction.h"
15 #include "ChemCompt.h"
16 #include "MeshCompt.h"
17 #include "CubeMesh.h"
18 #include "../utility/Vec.h"
19 #include "../utility/strutil.h"
20 #include "CylBase.h"
21 #include "NeuroNode.h"
22 
29  unsigned int parent, const vector< unsigned int >& children,
30  unsigned int startFid, Id elecCompt, bool isSphere
31  )
32  :
33  CylBase( cb ),
34  parent_( parent ),
35  children_( children ),
36  startFid_( startFid ),
37  elecCompt_( elecCompt ),
38  isSphere_( isSphere )
39 {;}
40 
42  :
43  parent_( ~0 ),
44  startFid_( 0 ),
45  elecCompt_( elecCompt ),
46  isSphere_( false )
47 {
48  double dia = Field< double >::get( elecCompt, "diameter" );
49  setDia( dia );
50  double length = Field< double >::get( elecCompt, "length" );
51  setLength( length );
52  double x = Field< double >::get( elecCompt, "x" );
53  double y = Field< double >::get( elecCompt, "y" );
54  double z = Field< double >::get( elecCompt, "z" );
55  setX( x );
56  setY( y );
57  setZ( z );
58 }
59 
60 
62  :
63  parent_( ~0 ),
64  startFid_( 0 ),
65  elecCompt_( Id() ),
66  isSphere_( false )
67 {;}
68 
69 unsigned int NeuroNode::parent() const
70 {
71  return parent_;
72 }
73 
74 unsigned int NeuroNode::startFid() const
75 {
76  return startFid_;
77 }
78 
80 {
81  return elecCompt_;
82 }
84 {
85  return ( getNumDivs() == 0 );
86 }
87 bool NeuroNode::isSphere() const
88 {
89  return isSphere_;
90 }
92 {
93  return ( startFid_ == 0 );
94 }
95 
96 const vector< unsigned int >& NeuroNode::children() const
97 {
98  return children_;
99 }
100 
101 void NeuroNode::addChild( unsigned int child )
102 {
103  children_.push_back( child );
104 }
105 
107 {
108  children_.resize( 0 );
109 }
110 
111 void NeuroNode::setParent( unsigned int parent )
112 {
113  parent_ = parent;
114 }
115 
116 void NeuroNode::setStartFid( unsigned int fid )
117 {
118  startFid_ = fid;
119 }
120 
121 double NeuroNode::calculateLength( const CylBase& parent )
122 {
123  if ( &parent == this ) // Do nothing
124  return getLength();
125  double dx = parent.getX() - getX();
126  double dy = parent.getY() - getY();
127  double dz = parent.getZ() - getZ();
128  double ret = sqrt( dx * dx + dy * dy + dz * dz );
129  setLength( ret );
130  return ret;
131 }
132 
133 /*
134  * This was put in to help debugging. Deprecated.
135 static void bruteForceFind( const vector< NeuroNode >& nodes, Id id )
136 {
137  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
138  if ( nodes[i].elecCompt() == id ) {
139  cout << "bruteForceFind: nodes[" << i << "] has " <<
140  id.path() << endl;
141  }
142  }
143 }
144 */
145 
151 static vector< Id > findAllConnectedCompartments( Id compt )
152 {
153  static const Finfo* axialOut = Cinfo::find( "CompartmentBase" )->findFinfo( "axialOut" );
154  static const Finfo* raxialOut = Cinfo::find( "CompartmentBase" )->findFinfo( "raxialOut" );
155  static const Finfo* distalOut = Cinfo::find( "SymCompartment" )->findFinfo( "distalOut" );
156  static const Finfo* proximalOut = Cinfo::find( "SymCompartment" )->findFinfo( "proximalOut" );
157  static const Finfo* cylinderOut = Cinfo::find( "SymCompartment" )->findFinfo( "cylinderOut" );
158  static const Finfo* sumRaxialOut = Cinfo::find( "SymCompartment" )->findFinfo( "sumRaxialOut" );
159  assert( axialOut );
160  assert( raxialOut );
161  assert( distalOut );
162  assert( proximalOut );
163  assert( cylinderOut );
164  assert( sumRaxialOut );
165 
166  const Cinfo* cinfo = compt.element()->cinfo();
167  vector< Id > all;
168  if ( cinfo->isA( "SymCompartment" ) ) { // Check derived first.
169  vector< Id > ret;
170  compt.element()->getNeighbors( ret, distalOut );
171  all.insert( all.end(), ret.begin(), ret.end() );
172  compt.element()->getNeighbors( ret, proximalOut );
173  all.insert( all.end(), ret.begin(), ret.end() );
174  compt.element()->getNeighbors( ret, cylinderOut );
175  all.insert( all.end(), ret.begin(), ret.end() );
176  compt.element()->getNeighbors( ret, sumRaxialOut );
177  all.insert( all.end(), ret.begin(), ret.end() );
178  }
179  // In addition, check if the bog standard messaging applies.
180  assert( cinfo->isA( "CompartmentBase" ) );
181  vector< Id > ret;
182  compt.element()->getNeighbors( ret, axialOut );
183  all.insert( all.end(), ret.begin(), ret.end() );
184  compt.element()->getNeighbors( ret, raxialOut );
185  all.insert( all.end(), ret.begin(), ret.end() );
186 
187  sort( all.begin(), all.end() );
188  all.erase( unique( all.begin(), all.end() ), all.end() ); //@#$%&* C++
189  // Now we have a list of all compartments connected to the current one.
190  return all;
191 }
192 
199  const map< Id, unsigned int >& nodeMap,
200  const vector< NeuroNode >& nodes )
201 {
202  vector< Id > all = findAllConnectedCompartments( elecCompt_ );
203  // Now we have a list of all compartments connected to the current one.
204  // Convert to node indices.
205  children_.resize( all.size() );
206  // Note that the nodeMap only includes compts on list, which may be a
207  // subset of compts in entire model. So we only want to explore those.
208  for ( unsigned int i = 0; i < all.size(); ++i ) {
209  map< Id, unsigned int >::const_iterator k = nodeMap.find( all[i] );
210  if ( k != nodeMap.end() ) {
211  children_[i] = k->second;
212  } else {
213  cout << "Warning: NeuroNode::findConnectedCompartments: could not find compartment " << all[i].path() << endl;
214  // bruteForceFind( nodes, all[i] );
215  }
216  }
217 }
218 
219 
228  vector< NeuroNode >& nodes )
229 {
230  vector< NeuroNode > temp;
231  vector< unsigned int > nodeMap( nodes.size() );
232 
233  unsigned int j = 0;
234  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
235  if ( nodes[i].children_.size() > 0 ) {
236  temp.push_back( nodes[i] );
237  nodeMap[i] = j;
238  ++j;
239  } else {
240  nodeMap[i] = ~0;
241  }
242  }
243  for ( unsigned int i = 0; i < temp.size(); ++i ) {
244  vector< unsigned int >& c = temp[i].children_;
245  for ( vector< unsigned int >::iterator
246  j = c.begin(); j != c.end(); ++j ) {
247  assert( nodeMap[ *j ] != ~0U );
248  *j = nodeMap[ *j ];
249  }
250  }
251  unsigned int numRemoved = nodes.size() - temp.size();
252  nodes = temp;
253  return numRemoved;
254 }
255 
270 unsigned int NeuroNode::findStartNode( const vector< NeuroNode >& nodes )
271 {
272  double maxDia = 0.0;
273  unsigned int somaIndex = ~0;
274  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
275  const char* name = nodes[i].elecCompt_.element()->getName().c_str();
276  if ( moose::strncasecmp( name, "soma", 4 ) == 0 ) {
277  if ( maxDia < nodes[i].getDia() ) {
278  maxDia = nodes[i].getDia();
279  somaIndex = i;
280  }
281  }
282  }
283  if ( somaIndex == ~0U ) { // Didn't find any compartment called soma
284  for ( unsigned int i =0; i < nodes.size(); ++i ) {
285  if ( maxDia < nodes[i].getDia() ) {
286  maxDia = nodes[i].getDia();
287  somaIndex = i;
288  }
289  }
290  }
291  assert( somaIndex != ~0U );
292  return somaIndex;
293 }
294 
298 void diagnoseTree( const vector< NeuroNode >& tree,
299  const vector< NeuroNode >& nodes )
300 {
301  map< Id , const NeuroNode* > m;
302  for ( vector< NeuroNode >::const_iterator
303  i = tree.begin(); i != tree.end(); ++i ) {
304  m[ i->elecCompt() ] = &( *i );
305  }
306  unsigned int j = 0;
307  for ( vector< NeuroNode >::const_iterator
308  i = nodes.begin(); i != nodes.end(); ++i ) {
309  if ( m.find( i->elecCompt() ) == m.end() ) {
310  Id pa;
311  if ( i->parent() != ~0U && i->parent() < nodes.size() )
312  pa = nodes[ i->parent() ].elecCompt();
313  cout << "diagnoseTree:" << j++ << " " << i->elecCompt().path() <<
314  ", pa = " << i->parent() << ", " << pa.path() << endl;
315  }
316  }
317 }
318 
332 void NeuroNode::traverse( vector< NeuroNode >& nodes, unsigned int start )
333 {
334  vector< unsigned int > seen( nodes.size(), ~0 );
335  vector< NeuroNode > tree;
336  tree.reserve( nodes.size() );
337  seen[ start ] = 0;
338  tree.push_back( nodes[ start ] );
339  tree.back().parent_ = ~0;
340  nodes[start].innerTraverse( tree, nodes, seen );
341 
342  if ( tree.size() < nodes.size() ) {
343  cout << "Warning: NeuroNode::traverse() unable to traverse all nodes:\n";
344  cout << "Traversed= " << tree.size() << " < total numNodes = " << nodes.size() << endl;
345  cout << "This situation may arise if the CellPortion has disjoint compartments\n";
346  diagnoseTree( tree, nodes );
347  }
348  nodes = tree;
349 }
350 
352  vector< NeuroNode >& tree,
353  const vector< NeuroNode >& nodes,
354  vector< unsigned int >& seen
355  ) const
356 {
357  unsigned int pa = tree.size() - 1;
358  tree.back().children_.clear();
359 
360  for ( vector< unsigned int >::const_iterator i =
361  children_.begin(); i != children_.end(); ++i ) {
362  assert( *i < nodes.size() );
363 
364  // Check that it is an unseen node, ie, not a parent.
365  if ( seen[ *i ] == ~0U ) {
366  seen[ *i ] = tree.size();
367  tree[pa].children_.push_back( tree.size() );
368  tree.push_back( nodes[ *i ] );
369  tree.back().parent_ = pa;
370  nodes[*i].innerTraverse( tree, nodes, seen );
371  }
372  }
373  assert( tree.size() <= nodes.size() );
374 }
375 
377 {
378  if ( i.element()->cinfo()->isA( "CompartmentBase" ) ) {
379  string name = i.element()->getName();
380  if ( name.find( "shaft" ) == string::npos &&
381  name.find( "neck" ) == string::npos &&
382  name.find( "spine" ) == string::npos &&
383  name.find( "head" ) == string::npos )
384  {
385  return true;
386  }
387  }
388  return false;
389 }
390 
391 static bool checkForSpine( unsigned int dendIndex, Id compt,
392  vector< Id >& shaftId, vector< Id >& headId,
393  vector< unsigned int >& spineParent )
394 {
395  const string& name = compt.element()->getName();
396  if ( name.find( "shaft" ) != string::npos ||
397  name.find( "neck" ) != string::npos ) {
398  spineParent.push_back( dendIndex );
399  shaftId.push_back( compt );
400  vector< Id > conn = findAllConnectedCompartments( compt );
401  bool foundHead = false;
402  for ( vector< Id >::iterator i =
403  conn.begin(); i != conn.end(); ++i ) {
404  const string& n2 = i->element()->getName();
405  if ( n2.find( "spine" ) != string::npos ||
406  n2.find( "head" ) != string::npos ) {
407  headId.push_back( *i );
408  foundHead = true;
409  break;
410  }
411  }
412  if (!foundHead) {
413  headId.push_back( Id() );
414  }
415  return true;
416  }
417  return false;
418 }
419 
429 static void spinyTraverse( unsigned int dendIndex,
430  vector< Id >& dend, const unordered_map< Id, unsigned int >& dendMap,
431  vector< int >& seen, unsigned int numSeen,
432  vector< Id >& shaftId, vector< Id >& headId,
433  vector< int >& dendParent, vector< unsigned int >& spineParent
434  )
435 {
436  vector< Id > conn = findAllConnectedCompartments( dend[dendIndex] );
437  seen[ dendIndex ] = numSeen;
438  for ( vector< Id >::iterator i = conn.begin(); i != conn.end(); ++i ) {
439  unordered_map< Id, unsigned int >::const_iterator idLookup =
440  dendMap.find( *i );
441  if ( idLookup != dendMap.end() ) {
442  if ( !seen[ idLookup->second ] ) {
443  dendParent[ idLookup->second ] = dendIndex;
444  spinyTraverse( idLookup->second, dend, dendMap,
445  seen, numSeen,
446  shaftId, headId, dendParent, spineParent );
447  }
448  } else {
449  checkForSpine( dendIndex, *i, shaftId, headId, spineParent );
450  }
451  }
452 }
453 
454 // Takes all 3 arrays, gets an array of indices that sorts them by shaftId,
455 // and then uses it to sort them all.
456 // Based on a post by quantdev on StackOverflow.
457 static void sortByShaftIds( vector< Id >& shaftId, vector< Id >& headId,
458  vector< unsigned int >& spineParent )
459 {
460  size_t sortedIndex(0);
461  vector<int> y(shaftId.size());
462  generate(begin(y), end(y), [&]{ return sortedIndex++; });
463  sort( begin(y), end(y),
464  [&](int i1, int i2) { return shaftId[i1] < shaftId[i2]; } );
465 
466  assert( sortedIndex == shaftId.size() );
467  assert( sortedIndex == headId.size() );
468  assert( sortedIndex == spineParent.size() );
469 
470  auto a = shaftId;
471  auto b = headId;
472  auto c = spineParent;
473  for ( size_t i = 0; i < sortedIndex; ++i) {
474  shaftId[i] = a[y[i]];
475  headId[i] = b[y[i]];
476  spineParent[i] = c[y[i]];
477  }
478 }
479 
492  vector< ObjId >& elist, vector< NeuroNode >& nodes,
493  vector< Id >& shaftId, vector< Id >& headId,
494  vector< unsigned int >& spineParent )
495 {
496  nodes.clear();
497  sort( elist.begin(), elist.end() );
498  unordered_map< Id, unsigned int > dendMap;
499  vector< Id > dend;
500  for ( vector< ObjId >::iterator
501  i = elist.begin(); i != elist.end(); ++i ) {
502  if ( isPartOfDend( *i ) ) {
503  dendMap[ *i ] = dend.size();
504  //cout << "st: dendMap[" << *i << "] = " << dend.size() << endl;
505  dend.push_back( *i );
506  }
507  }
508  vector< int > seen( dend.size(), 0 );
509  vector< int > dendParent( dend.size(), -1 );
510  int numSeen = 0;
511  for ( unsigned int i = 0; i < dend.size(); ++i ) {
512  if ( !seen[i] )
513  spinyTraverse( i, dend, dendMap, seen, ++numSeen,
514  shaftId, headId,
515  dendParent, spineParent );
516  }
517  // Here I sort by shaftIds. I have 4 parallel arrays, so I get the
518  // Index order of the whole lot that will sort the shaftIds.
519  sortByShaftIds( shaftId, headId, spineParent );
520  if ( numSeen == 0 )
521  return;
522  for ( unsigned int i = 0; i < dend.size(); ++i )
523  nodes.push_back( NeuroNode( dend[i] ) );
524  for ( unsigned int i = 0; i < dend.size(); ++i )
525  nodes[i].setParentAndChildren( i, dendParent[i], nodes, dendMap );
526 
527  if ( numSeen > 1 ) {
528  cout << "Warning: NeuroNode::buildSpinyTree: There are " <<
529  numSeen << " distinct subgroups on the given path\n";
530  }
531 }
532 
533 void NeuroNode::setParentAndChildren( unsigned int index, int dendParent,
534  vector< NeuroNode >& nodes, const unordered_map< Id, unsigned int >& dendMap )
535 {
536  if (dendParent < 0 || static_cast< unsigned int >(dendParent) >= nodes.size() )
537  return;
538  parent_ = dendParent;
539  const unordered_map< Id, unsigned int >::const_iterator dendLookup =
540  dendMap.find( nodes[dendParent].elecCompt_ );
541  if ( dendLookup != dendMap.end() ) {
542  assert( dendLookup->second < nodes.size() );
543  nodes[ dendLookup->second ].addChild( index );
544  }
545 }
546 
547 
559  vector< NeuroNode >& nodes, vector< ObjId > elist )
560 {
561  nodes.clear();
562  map< Id, unsigned int > nodeMap;
563  for ( vector< ObjId >::iterator
564  i = elist.begin(); i != elist.end(); ++i ) {
565  if ( i->element()->cinfo()->isA( "CompartmentBase" ) )
566  nodes.push_back( NeuroNode( *i ) );
567  }
568  if ( nodes.size() <= 1 )
569  return;
570  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
571  if ( nodeMap.find( nodes[i].elecCompt() ) != nodeMap.end() ) {
572  cout << "Warning: NeuroNode.buildTree(): Node[" << i <<
573  "] refers to existing compartment: " <<
574  nodes[i].elecCompt().path() << endl;
575  }
576  nodeMap[ nodes[i].elecCompt() ] = i;
577  }
578  assert( nodeMap.size() == nodes.size() );
579  for ( unsigned int i = 0; i < nodes.size(); ++i )
580  nodes[i].findConnectedCompartments( nodeMap, nodes );
581  unsigned int numRemoved = removeDisconnectedNodes( nodes );
582  if ( numRemoved > 0 ) {
583  cout << "Warning: NeuroNode::buildTree: Removed " <<
584  numRemoved << " nodes because they were not connected\n";
585  }
586  unsigned int start = findStartNode( nodes );
587  traverse( nodes, start );
588 }
589 
590 // Utility function to clean up node indices for parents and children.
591 void reassignNodeIndices( vector< NeuroNode >& temp,
592  const vector< unsigned int >& nodeToTempMap )
593 {
594  for ( vector< NeuroNode >::iterator
595  i = temp.begin(); i != temp.end(); ++i ) {
596  unsigned int pa = i->parent();
597  if ( pa != ~0U ) {
598  assert( nodeToTempMap[ pa ] != ~0U );
599  i->setParent( nodeToTempMap[ pa ] );
600  }
601 
602  vector< unsigned int > kids = i->children();
603  i->clearChildren();
604  for ( unsigned int j = 0; j < kids.size(); ++j ) {
605  unsigned int newKid = nodeToTempMap[ kids[j] ];
606  if ( newKid != ~0U ) // Some may be spine shafts, no longer here
607  i->addChild( newKid );
608  }
609  }
610 }
611 
620 void NeuroNode::filterSpines( vector< NeuroNode >& nodes,
621  vector< Id >& shaftId, vector< Id >& headId,
622  vector< unsigned int >& parent )
623 {
624  headId.clear();
625  shaftId.clear();
626  parent.clear();
627  vector< NeuroNode > temp;
628  temp.reserve( nodes.size() );
629  vector< unsigned int > nodeToTempMap( nodes.size(), ~0U );
630  vector< unsigned int > shaft;
631  vector< unsigned int > reverseShaft( nodes.size(), ~0U );
632  vector< unsigned int > head;
633  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
634  const NeuroNode& n = nodes[i];
635  string name = n.elecCompt_.element()->getName();
636  for ( string::iterator j = name.begin(); j != name.end(); ++j )
637  *j = tolower(*j);
638 
639  if ( name.find( "shaft" ) != string::npos ||
640  name.find( "neck" ) != string::npos ) {
641  reverseShaft[i] = shaft.size();
642  shaft.push_back( i );
643  // Remove from nodes vector by simply not copying.
644  } else if ( name.find( "spine" ) != string::npos ||
645  name.find( "head" ) != string::npos ) {
646  head.push_back( i );
647  // Remove from nodes vector by simply not copying.
648  } else {
649  nodeToTempMap[i] = temp.size();
650  temp.push_back( n );
651  }
652 
653  /*
654  const char* name = n.elecCompt_.element()->getName().c_str();
655  if ( strncasecmp( name, "shaft", 5 ) == 0 ||
656  strncasecmp( name, "neck", 4 ) == 0 ||
657  strncasecmp( name, "spine_neck", 10 ) == 0 ||
658  strncasecmp( name, "spine_shaft", 11 ) == 0 ||
659  strncasecmp( name, "stalk", 5 ) == 0 ) {
660  reverseShaft[i] = shaft.size();
661  shaft.push_back( i );
662  // Remove from nodes vector by simply not copying.
663  } else if ( strncasecmp( name, "spine", 5 ) == 0 ||
664  strncasecmp( name, "head", 4 ) == 0 ) {
665  head.push_back( i );
666  // Remove from nodes vector by simply not copying.
667  } else {
668  nodeToTempMap[i] = temp.size();
669  temp.push_back( n );
670  }
671  */
672  }
673  // Now go through finding spine shafts.
674  for ( unsigned int i = 0; i < head.size(); ++i ) {
675  const NeuroNode& n = nodes[ head[i] ];
676  headId.push_back( n.elecCompt() );
677  assert( reverseShaft[ n.parent() ] != ~0U );
678  const NeuroNode& pa = nodes[ n.parent() ];
679  shaftId.push_back( pa.elecCompt() );
680  assert( nodeToTempMap[ pa.parent() ] != ~0U );
681  parent.push_back( nodeToTempMap[ pa.parent() ] );
682  }
683  assert( shaftId.size() == headId.size() );
684 
685  reassignNodeIndices( temp, nodeToTempMap );
686  nodes = temp;
687 }
static SrcFinfo2< double, double > * cylinderOut()
Id elecCompt() const
Definition: NeuroNode.cpp:79
static SrcFinfo2< double, double > * proximalOut()
double getLength() const
Definition: CylBase.cpp:98
bool isPartOfDend(ObjId i)
Definition: NeuroNode.cpp:376
static void buildSpinyTree(vector< ObjId > &elist, vector< NeuroNode > &nodes, vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:491
void setParent(unsigned int parent)
Definition: NeuroNode.cpp:111
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
void setX(double v)
Definition: CylBase.cpp:53
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
static void traverse(vector< NeuroNode > &nodes, unsigned int start)
Definition: NeuroNode.cpp:332
static void filterSpines(vector< NeuroNode > &nodes, vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &parent)
Definition: NeuroNode.cpp:620
double getX() const
Definition: CylBase.cpp:58
static void buildTree(vector< NeuroNode > &nodes, vector< ObjId > elist)
Definition: NeuroNode.cpp:558
int strncasecmp(const string &a, const string &b, size_t n)
Compares the two strings a and b for first n characters, ignoring the case of the characters...
Definition: strutil.cpp:148
static const Cinfo * find(const std::string &name)
Definition: Cinfo.cpp:200
const SrcFinfo2< double, double > * raxialOut
Definition: Compartment.cpp:66
static void spinyTraverse(unsigned int dendIndex, vector< Id > &dend, const unordered_map< Id, unsigned int > &dendMap, vector< int > &seen, unsigned int numSeen, vector< Id > &shaftId, vector< Id > &headId, vector< int > &dendParent, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:429
Definition: ObjId.h:20
static unsigned int findStartNode(const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:270
unsigned int startFid() const
Definition: NeuroNode.cpp:74
void setLength(double v)
Definition: CylBase.cpp:93
double getY() const
Definition: CylBase.cpp:68
void diagnoseTree(const vector< NeuroNode > &tree, const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:298
void reassignNodeIndices(vector< NeuroNode > &temp, const vector< unsigned int > &nodeToTempMap)
Definition: NeuroNode.cpp:591
static void sortByShaftIds(vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:457
const vector< unsigned int > & children() const
Definition: NeuroNode.cpp:96
static bool checkForSpine(unsigned int dendIndex, Id compt, vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:391
void innerTraverse(vector< NeuroNode > &tree, const vector< NeuroNode > &nodes, vector< unsigned int > &seen) const
Definition: NeuroNode.cpp:351
unsigned int parent_
Definition: NeuroNode.h:197
void setZ(double v)
Definition: CylBase.cpp:73
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66
bool isStartNode() const
Definition: NeuroNode.cpp:91
bool isSphere() const
Definition: NeuroNode.cpp:87
static SrcFinfo2< double, double > * distalOut()
unsigned int startFid_
Definition: NeuroNode.h:208
double calculateLength(const CylBase &parent)
Definition: NeuroNode.cpp:121
void setY(double v)
Definition: CylBase.cpp:63
Element * element() const
Definition: ObjId.cpp:124
bool isSphere_
Definition: NeuroNode.h:218
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
double getDia() const
Definition: CylBase.cpp:88
static char name[]
Definition: mfield.cpp:401
double getZ() const
Definition: CylBase.cpp:78
void setDia(double v)
Definition: CylBase.cpp:83
unsigned int parent() const
Definition: NeuroNode.cpp:69
void findConnectedCompartments(const map< Id, unsigned int > &nodeMap, const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:198
bool isDummyNode() const
Definition: NeuroNode.cpp:83
Definition: Id.h:17
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
static vector< Id > findAllConnectedCompartments(Id compt)
Definition: NeuroNode.cpp:151
const SrcFinfo1< double > * axialOut
Definition: Compartment.cpp:62
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284
unsigned int getNumDivs() const
Definition: CylBase.cpp:108
void setStartFid(unsigned int f)
Definition: NeuroNode.cpp:116
const string & getName() const
Definition: Element.cpp:56
void setParentAndChildren(unsigned int index, int dendParent, vector< NeuroNode > &nodes, const unordered_map< Id, unsigned int > &dendMap)
Definition: NeuroNode.cpp:533
static unsigned int removeDisconnectedNodes(vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:227
Definition: Cinfo.h:18
vector< unsigned int > children_
Definition: NeuroNode.h:202
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
void clearChildren()
Definition: NeuroNode.cpp:106
Definition: Finfo.h:12
static SrcFinfo1< double > * sumRaxialOut()
void addChild(unsigned int child)
Definition: NeuroNode.cpp:101