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

#include <SpineMesh.h>

+ Inheritance diagram for SpineMesh:
+ Collaboration diagram for SpineMesh:

Public Member Functions

void buildStencil ()
 
double extendedMeshEntryVolume (unsigned int fid) const
 Vol of all mesh Entries including abutting diff-coupled voxels. More...
 
vector< double > getCoordinates (unsigned int fid) const
 Virtual function to return coords of mesh Entry. More...
 
vector< double > getDiffusionArea (unsigned int fid) const
 Virtual function to return diffusion X-section area. More...
 
vector< double > getDiffusionScaling (unsigned int fid) const
 Virtual function to return scale factor for diffusion. 1 here. More...
 
vector< IdgetElecComptMap () const
 
vector< unsigned int > getEndVoxelInCompt () const
 Returns index of end voxel mapping to elec compt, just first+1. More...
 
unsigned int getMeshDimensions (unsigned int fid) const
 Virtual function to return dimensions of specified entry. More...
 
double getMeshEntryVolume (unsigned int fid) const
 Virtual function to return volume of mesh Entry. More...
 
unsigned int getMeshType (unsigned int fid) const
 Virtual function to return MeshType of specified entry. More...
 
vector< unsigned int > getNeuronVoxel () const
 
vector< unsigned int > getParentVoxel () const
 
vector< unsigned int > getStartVoxelInCompt () const
 Returns index of first voxel mapping to elec compt. More...
 
const vector< double > & getVoxelArea () const
 
const vector< double > & getVoxelLength () const
 
void handleSpineList (const Eref &e, vector< Id > shaft, vector< Id > head, vector< unsigned int > parentVoxel)
 
void indexToSpace (unsigned int index, double &x, double &y, double &z) const
 
void innerBuildDefaultMesh (const Eref &e, double volume, unsigned int numEntries)
 Virtual func to make a mesh with specified Volume and numEntries. More...
 
unsigned int innerGetDimensions () const
 Returns # of dimensions, always 3 here. Inherited pure virt func. More...
 
unsigned int innerGetNumEntries () const
 
void innerHandleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads)
 
void innerSetNumEntries (unsigned int n)
 Inherited virtual func. More...
 
void matchCubeMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const
 
void matchMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const
 
void matchNeuroMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const
 
void matchSpineMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const
 
double nearest (double x, double y, double z, unsigned int &index) const
 
void setMeshEntryVolume (unsigned int fid, double volume)
 Virtual function to assign volume of mesh Entry. More...
 
 SpineMesh ()
 
 SpineMesh (const SpineMesh &other)
 
const vector< SpineEntry > & spines () const
 
void transmitChange (const Eref &e)
 
void updateCoords ()
 
double vGetEntireVolume () const
 Inherited virtual func. More...
 
const vector< double > & vGetVoxelMidpoint () const
 Virtual func so that derived classes can return voxel midpoint. More...
 
const vector< double > & vGetVoxelVolume () const
 Virtual func so that derived classes can pass voxel volume back. More...
 
bool vSetVolumeNotRates (double volume)
 Inherited virtual func. More...
 
 ~SpineMesh ()
 
- Public Member Functions inherited from MeshCompt
void addRow (unsigned int index, const vector< double > &entry, const vector< unsigned int > &colIndex)
 
void clearExtendedMeshEntryVolume ()
 Inherited virtual function to clear the vector of MeshEntryVolume. More...
 
void extendStencil (const ChemCompt *other, const vector< VoxelJunction > &vj)
 Add boundary voxels to stencil for cross-solver junctions. More...
 
vector< unsigned int > getNeighbors (unsigned int fid) const
 Looks up stencil to return vector of indices of coupled voxels. More...
 
const SparseMatrix< double > & getStencil () const
 Returns entire sparse matrix of mesh. Used by diffusion solver. More...
 
unsigned int getStencilRow (unsigned int meshIndex, const double **entry, const unsigned int **colIndex) const
 
vector< double > innerGetStencilRate (unsigned int row) const
 
void innerResetStencil ()
 virtual func implemented here. More...
 
 MeshCompt ()
 
void setStencilSize (unsigned int numRows, unsigned int numCols)
 
 ~MeshCompt ()
 
- Public Member Functions inherited from ChemCompt
void buildDefaultMesh (const Eref &e, double volume, unsigned int numEntries)
 
void buildJunction (ChemCompt *other, vector< VoxelJunction > &ret)
 
 ChemCompt ()
 
void flipRet (vector< VoxelJunction > &ret) const
 Utility function for swapping first and second in VoxelJunctions. More...
 
void getChildConcs (const Eref &e, vector< double > &childConcs) const
 
unsigned int getDimensions () const
 
double getEntireVolume (const Eref &e) const
 
bool getIsMembraneBound () const
 
string getMethod () const
 
unsigned int getNumEntries () const
 
double getOneVoxelVolume (const Eref &e, unsigned int voxel) const
 
vector< unsigned int > getStencilIndex (unsigned int row) const
 
vector< double > getStencilRate (unsigned int row) const
 
vector< double > getVoxelMidpoint () const
 Returns vector of all voxel midpoints in compartment. More...
 
vector< double > getVoxelVolume () const
 Returns vector of all voxel volumes in compartment. More...
 
void handleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads)
 
MeshEntrylookupEntry (unsigned int index)
 
void resetStencil ()
 
unsigned int setChildConcs (const Eref &e, const vector< double > &childConcs, unsigned int start) const
 
void setEntireVolume (const Eref &e, double volume)
 
void setIsMembraneBound (bool v)
 
void setMethod (string method)
 
void setNumEntries (unsigned int num)
 
void setOneVoxelVolume (const Eref &e, unsigned int voxel, double volume)
 
void setVolumeNotRates (double volume)
 
virtual ~ChemCompt ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 
- Static Public Member Functions inherited from ChemCompt
static double distance (double x, double y, double z)
 
static const CinfoinitCinfo ()
 
static SrcFinfo1< vector
< double > > * 
voxelVolOut ()
 

Private Attributes

vector< double > area_
 
vector< double > length_
 Pre-calculation of length of each MeshEntry. More...
 
vector< SpineEntryspines_
 
double surfaceGranularity_
 
vector< double > vs_
 

Detailed Description

The SpineMesh sets up the diffusion geometries for dendritic spines. It is filled by a message from a NeuroMesh that contains information about the matching voxel on the NeuroMesh, and the compartment Ids for the spine shaft and head. The SpineMesh can further generate a PSD mesh with the info for the PSD geometries. This assumes that the each spine is a single voxel: single diffusive compartment, well-stirred. The shaft is treated as zero volume diffusion barrier to the dendrite. The PSD is a separate compt with its own diffusion coupling to the spine head.

Definition at line 26 of file SpineMesh.h.

Constructor & Destructor Documentation

SpineMesh::SpineMesh ( )

Definition at line 154 of file SpineMesh.cpp.

155  :
156  spines_( 1 ),
157  surfaceGranularity_( 0.1 ),
158  vs_( 1, 1.0e-18 ),
159  area_( 1, 1.0e-12 ),
160  length_( 1, 1.0e-6 )
161 {;}
vector< double > area_
Definition: SpineMesh.h:203
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
vector< double > length_
Pre-calculation of length of each MeshEntry.
Definition: SpineMesh.h:206
vector< double > vs_
Definition: SpineMesh.h:197
double surfaceGranularity_
Definition: SpineMesh.h:190
SpineMesh::SpineMesh ( const SpineMesh other)

Definition at line 163 of file SpineMesh.cpp.

164  :
165  spines_( other.spines_ ),
167 {;}
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
double surfaceGranularity_
Definition: SpineMesh.h:190
SpineMesh::~SpineMesh ( )

Definition at line 169 of file SpineMesh.cpp.

170 {
171  ;
172 }

Member Function Documentation

void SpineMesh::buildStencil ( )

Definition at line 475 of file SpineMesh.cpp.

References MeshCompt::innerResetStencil(), MeshCompt::setStencilSize(), and spines_.

Referenced by updateCoords().

476 {
477 // stencil_[0] = new NeuroStencil( nodes_, nodeIndex_, vs_, area_);
478  setStencilSize( spines_.size(), spines_.size() );
480 }
void innerResetStencil()
virtual func implemented here.
Definition: MeshCompt.cpp:49
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
void setStencilSize(unsigned int numRows, unsigned int numCols)
Definition: MeshCompt.cpp:106

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double SpineMesh::extendedMeshEntryVolume ( unsigned int  fid) const
virtual

Vol of all mesh Entries including abutting diff-coupled voxels.

Virtual function to return volume of mesh Entry, including for diffusively coupled voxels from other solvers.

Reimplemented from MeshCompt.

Definition at line 348 of file SpineMesh.cpp.

References MeshCompt::extendedMeshEntryVolume(), getMeshEntryVolume(), and spines_.

349 {
350  if ( fid < spines_.size() ) {
351  return getMeshEntryVolume( fid );
352  } else {
353  return MeshCompt::extendedMeshEntryVolume( fid - spines_.size() );
354  }
355 }
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: SpineMesh.cpp:307
double extendedMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry, including.
Definition: MeshCompt.cpp:36
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the call graph for this function:

vector< double > SpineMesh::getCoordinates ( unsigned int  fid) const
virtual

Virtual function to return coords of mesh Entry.

Virtual function to return coords of mesh Entry. For SpineMesh, coords are x1y1z1 x2y2z2 x3y3z3 r0 r1

Implements ChemCompt.

Definition at line 325 of file SpineMesh.cpp.

326 {
327  vector< double > ret;
328  return ret;
329 }
vector< double > SpineMesh::getDiffusionArea ( unsigned int  fid) const
virtual

Virtual function to return diffusion X-section area.

Virtual function to return diffusion X-section area for each neighbor.

Implements ChemCompt.

Definition at line 332 of file SpineMesh.cpp.

333 {
334  vector< double > ret;
335  return ret;
336 }
vector< double > SpineMesh::getDiffusionScaling ( unsigned int  fid) const
virtual

Virtual function to return scale factor for diffusion. 1 here.

Virtual function to return scale factor for diffusion. I think all dendite tips need to return just one entry of 1.

Implements ChemCompt.

Definition at line 341 of file SpineMesh.cpp.

342 {
343  return vector< double >( 2, 1.0 );
344 }
vector< Id > SpineMesh::getElecComptMap ( ) const

Returns vector of Ids of electrical compts that map to respective voxels in SpineMesh

Definition at line 204 of file SpineMesh.cpp.

References spines_.

Referenced by initCinfo().

205 {
206  vector< Id > ret( spines_.size() );
207  for ( unsigned int i = 0; i < spines_.size(); ++i )
208  ret[i] = spines_[i].headId();
209  return ret;
210 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

vector< unsigned int > SpineMesh::getEndVoxelInCompt ( ) const

Returns index of end voxel mapping to elec compt, just first+1.

Definition at line 220 of file SpineMesh.cpp.

References spines_.

Referenced by initCinfo().

221 {
222  vector< unsigned int > ret( spines_.size() );
223  for ( unsigned int i = 0; i < ret.size(); ++i )
224  ret[i] = i+1;
225  return ret;
226 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

unsigned int SpineMesh::getMeshDimensions ( unsigned int  fid) const
virtual

Virtual function to return dimensions of specified entry.

Implements ChemCompt.

Definition at line 301 of file SpineMesh.cpp.

302 {
303  return 3;
304 }
double SpineMesh::getMeshEntryVolume ( unsigned int  fid) const
virtual

Virtual function to return volume of mesh Entry.

Implements ChemCompt.

Definition at line 307 of file SpineMesh.cpp.

References spines_.

Referenced by extendedMeshEntryVolume(), handleSpineList(), and PsdMesh::matchSpineMeshEntries().

308 {
309  if ( spines_.size() == 0 )
310  return 1.0;
311  assert( fid < spines_.size() );
312  return spines_[ fid % spines_.size() ].volume();
313 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

unsigned int SpineMesh::getMeshType ( unsigned int  fid) const
virtual

Virtual function to return MeshType of specified entry.

Implements ChemCompt.

Definition at line 294 of file SpineMesh.cpp.

References CYL, and spines_.

295 {
296  assert( fid < spines_.size() );
297  return CYL;
298 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
Definition: MeshEntry.h:20
vector< unsigned int > SpineMesh::getNeuronVoxel ( ) const

Returns index of voxel on NeuroMesh to which this spine is connected.

Definition at line 196 of file SpineMesh.cpp.

References spines_.

Referenced by initCinfo().

197 {
198  vector< unsigned int > ret( spines_.size(), -1U );
199  for ( unsigned int i = 0; i < spines_.size(); ++i )
200  ret[i] = spines_[i].parent();
201  return ret;
202 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

vector< unsigned int > SpineMesh::getParentVoxel ( ) const
virtual

This function returns the diffusively connected parent voxel within the current (spine) mesh. Since each spine is treated as an independed voxel, there is no such voxel, so we return -1U for each spine. Note that there is a separate function that returns the parentVoxel referred to the NeuroMesh that this spine sits on.

Implements MeshCompt.

Definition at line 185 of file SpineMesh.cpp.

References spines_.

Referenced by initCinfo().

186 {
187  vector< unsigned int > ret( spines_.size(), -1U );
188  // for ( unsigned int i = 0; i < spines_.size(); ++i )
189  // ret[i] = spines_[i].parent(); // Wrong, returns voxel on NeuroMesh
190  return ret;
191 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

vector< unsigned int > SpineMesh::getStartVoxelInCompt ( ) const

Returns index of first voxel mapping to elec compt.

Definition at line 212 of file SpineMesh.cpp.

References spines_.

Referenced by initCinfo().

213 {
214  vector< unsigned int > ret( spines_.size() );
215  for ( unsigned int i = 0; i < ret.size(); ++i )
216  ret[i] = i;
217  return ret;
218 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

const vector< double > & SpineMesh::getVoxelArea ( ) const
virtual

Implements MeshCompt.

Definition at line 403 of file SpineMesh.cpp.

References area_.

404 {
405  return area_;
406 }
vector< double > area_
Definition: SpineMesh.h:203
const vector< double > & SpineMesh::getVoxelLength ( ) const
virtual

Implements MeshCompt.

Definition at line 408 of file SpineMesh.cpp.

References length_.

409 {
410  return length_;
411 }
vector< double > length_
Pre-calculation of length of each MeshEntry.
Definition: SpineMesh.h:206
void SpineMesh::handleSpineList ( const Eref e,
vector< Id shaft,
vector< Id head,
vector< unsigned int >  parentVoxel 
)

Definition at line 246 of file SpineMesh.cpp.

References area_, getMeshEntryVolume(), Eref::id(), length_, ChemCompt::lookupEntry(), spines_, MeshEntry::triggerRemesh(), updateCoords(), Id::value(), and vs_.

Referenced by initCinfo().

249 {
250  double oldVol = getMeshEntryVolume( 0 );
251  assert( head.size() == parentVoxel.size() );
252  assert( head.size() == shaft.size() );
253  spines_.resize( head.size() );
254  vs_.resize( head.size() );
255  area_.resize( head.size() );
256  length_.resize( head.size() );
257 
258  vector< double > ret;
259  vector< double > psdCoords;
260  vector< unsigned int > index( head.size(), 0 );
261  for ( unsigned int i = 0; i < head.size(); ++i ) {
262  spines_[i] = SpineEntry( shaft[i], head[i], parentVoxel[i] );
263  // cout << i << " " << head[i] << ", pa = " << parentVoxel[i] << endl;
264  // ret = spines_[i].psdCoords();
265  // assert( ret.size() == 8 );
266  // psdCoords.insert( psdCoords.end(), ret.begin(), ret.end() );
267  // index[i] = i;
268  vs_[i] = spines_[i].volume();
269  area_[i] = spines_[i].rootArea();
270  length_[i] = spines_[i].diffusionLength();
271  }
272 
273  updateCoords();
274  Id meshEntry( e.id().value() + 1 );
275 
276  vector< unsigned int > localIndices( head.size() );
277  vector< double > vols( head.size() );
278  for ( unsigned int i = 0; i < head.size(); ++i ) {
279  localIndices[i] = i;
280  vols[i] = spines_[i].volume();
281  }
282  vector< vector< unsigned int > > outgoingEntries;
283  vector< vector< unsigned int > > incomingEntries;
284  // meshSplit()->send( e, oldVol, vols, localIndices, outgoingEntries, incomingEntries );
285  lookupEntry( 0 )->triggerRemesh( meshEntry.eref(),
286  oldVol, 0, localIndices, vols );
287 }
Id id() const
Definition: Eref.cpp:62
vector< double > area_
Definition: SpineMesh.h:203
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: SpineMesh.cpp:307
unsigned int value() const
Definition: Id.cpp:197
MeshEntry * lookupEntry(unsigned int index)
Definition: ChemCompt.cpp:379
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
void updateCoords()
Definition: SpineMesh.cpp:235
vector< double > length_
Pre-calculation of length of each MeshEntry.
Definition: SpineMesh.h:206
vector< double > vs_
Definition: SpineMesh.h:197
void triggerRemesh(const Eref &e, double oldvol, unsigned int startEntry, const vector< unsigned int > &localIndices, const vector< double > &vols)
Definition: MeshEntry.cpp:267
Definition: Id.h:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpineMesh::indexToSpace ( unsigned int  index,
double &  x,
double &  y,
double &  z 
) const
virtual

Converts specified index to xyz coords of middle of voxel Values out of range return original xyz

Implements ChemCompt.

Definition at line 508 of file SpineMesh.cpp.

References innerGetNumEntries(), and spines_.

510 {
511  if ( index >= innerGetNumEntries() )
512  return;
513  spines_[ index ].mid( x, y, z );
514 }
unsigned int innerGetNumEntries() const
Definition: SpineMesh.cpp:443
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the call graph for this function:

const Cinfo * SpineMesh::initCinfo ( )
static

Definition at line 48 of file SpineMesh.cpp.

References getElecComptMap(), getEndVoxelInCompt(), getNeuronVoxel(), getParentVoxel(), getStartVoxelInCompt(), handleSpineList(), ChemCompt::initCinfo(), and spineMeshCinfo.

49 {
51  // Field Definitions
54  parentVoxel
55  (
56  "parentVoxel",
57  "Vector of indices of proximal voxels within this mesh."
58  "Spines are at present modeled with just one compartment,"
59  "so each entry in this vector is always set to EMPTY == -1U",
61  );
62 
64  neuronVoxel
65  (
66  "neuronVoxel",
67  "Vector of indices of voxels on parent NeuroMesh, from which "
68  "the respective spines emerge.",
70  );
71 
72  static ReadOnlyValueFinfo< SpineMesh, vector< Id > > elecComptMap(
73  "elecComptMap",
74  "Vector of Ids of electrical compartments that map to each "
75  "voxel. This is necessary because the order of the IDs may "
76  "differ from the ordering of the voxels. Note that there "
77  "is always just one voxel per spine head. ",
79  );
80  static ReadOnlyValueFinfo< SpineMesh, vector< Id > > elecComptList(
81  "elecComptList",
82  "Vector of Ids of all electrical compartments in this "
83  "SpineMesh. Ordering is as per the tree structure built in "
84  "the NeuroMesh, and may differ from Id order. Ordering "
85  "matches that used for startVoxelInCompt and endVoxelInCompt",
87  );
89  "startVoxelInCompt",
90  "Index of first voxel that maps to each electrical "
91  "compartment. This is a trivial function in the SpineMesh, as"
92  "we have a single voxel per spine. So just a vector of "
93  "its own indices.",
95  );
97  "endVoxelInCompt",
98  "Index of end voxel that maps to each electrical "
99  "compartment. Since there is just one voxel per electrical "
100  "compartment in the spine, this is just a vector of index+1",
102  );
103 
105  // MsgDest Definitions
107 
108  static DestFinfo spineList( "spineList",
109  "Specifies the list of electrical compartments for the spine,"
110  "and the associated parent voxel"
111  "Arguments: shaft compartments, "
112  "head compartments, parent voxel index ",
113  new EpFunc3< SpineMesh, vector< Id >, vector< Id >,
114  vector< unsigned int > >(
116  );
117 
119  // Field Elements
121 
122  static Finfo* spineMeshFinfos[] = {
123  &parentVoxel, // ReadOnlyValueFinfo
124  &neuronVoxel, // ReadOnlyValueFinfo
125  &elecComptMap, // ReadOnlyValueFinfo
126  &elecComptList, // ReadOnlyValueFinfo
127  &startVoxelInCompt, // ReadOnlyValueFinfo
128  &endVoxelInCompt, // ReadOnlyValueFinfo
129  &spineList, // DestFinfo
130  // psdListOut(), // SrcFinfo
131  };
132 
133  static Dinfo< SpineMesh > dinfo;
134  static Cinfo spineMeshCinfo (
135  "SpineMesh",
137  spineMeshFinfos,
138  sizeof( spineMeshFinfos ) / sizeof ( Finfo* ),
139  &dinfo
140  );
141 
142  return &spineMeshCinfo;
143 }
static const Cinfo * initCinfo()
Definition: ChemCompt.cpp:25
static const Cinfo * spineMeshCinfo
Definition: SpineMesh.cpp:149
vector< unsigned int > getStartVoxelInCompt() const
Returns index of first voxel mapping to elec compt.
Definition: SpineMesh.cpp:212
Definition: Dinfo.h:60
Definition: EpFunc.h:95
vector< Id > getElecComptMap() const
Definition: SpineMesh.cpp:204
vector< unsigned int > getNeuronVoxel() const
Definition: SpineMesh.cpp:196
vector< unsigned int > getEndVoxelInCompt() const
Returns index of end voxel mapping to elec compt, just first+1.
Definition: SpineMesh.cpp:220
Definition: Cinfo.h:18
vector< unsigned int > getParentVoxel() const
Definition: SpineMesh.cpp:185
Definition: Finfo.h:12
void handleSpineList(const Eref &e, vector< Id > shaft, vector< Id > head, vector< unsigned int > parentVoxel)
Definition: SpineMesh.cpp:246

+ Here is the call graph for this function:

void SpineMesh::innerBuildDefaultMesh ( const Eref e,
double  volume,
unsigned int  numEntries 
)
virtual

Virtual func to make a mesh with specified Volume and numEntries.

Not allowed.

Implements ChemCompt.

Definition at line 460 of file SpineMesh.cpp.

462 {
463  cout << "Warning: SpineMesh::innerBuildDefaultMesh: attempt to build a default spine: not permitted\n";
464 }
unsigned int SpineMesh::innerGetDimensions ( ) const
virtual

Returns # of dimensions, always 3 here. Inherited pure virt func.

Implements ChemCompt.

Definition at line 240 of file SpineMesh.cpp.

241 {
242  return 3;
243 }
unsigned int SpineMesh::innerGetNumEntries ( ) const
virtual

Inherited virtual func. Returns number of MeshEntry in array

Implements ChemCompt.

Definition at line 443 of file SpineMesh.cpp.

References spines_.

Referenced by indexToSpace().

444 {
445  return spines_.size();
446 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the caller graph for this function:

void SpineMesh::innerHandleNodeInfo ( const Eref e,
unsigned int  numNodes,
unsigned int  numThreads 
)
virtual

Implements ChemCompt.

Definition at line 374 of file SpineMesh.cpp.

377 {
378 
379 
380 }
void SpineMesh::innerSetNumEntries ( unsigned int  n)
virtual

Inherited virtual func.

Inherited virtual func. Assigns number of MeshEntries. Doesn't do anything, we have to set spine # from geometry.

Implements ChemCompt.

Definition at line 452 of file SpineMesh.cpp.

453 {
454 }
void SpineMesh::matchCubeMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const

Definition at line 557 of file SpineMesh.cpp.

References SpineEntry::matchCubeMeshEntriesToHead(), spines_, and surfaceGranularity_.

Referenced by matchMeshEntries().

559 {
560  for( unsigned int i = 0; i < spines_.size(); ++i ) {
561  const SpineEntry& se = spines_[i];
562  se.matchCubeMeshEntriesToHead( other, i, surfaceGranularity_, ret );
563  }
564 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
double surfaceGranularity_
Definition: SpineMesh.h:190
void matchCubeMeshEntriesToHead(const ChemCompt *compt, unsigned int myIndex, double granularity, vector< VoxelJunction > &ret) const
Returns Id of head electrical compartment.
Definition: SpineEntry.cpp:145

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpineMesh::matchMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const
virtual

Returns the meshIndices (NOT spatial indices) of all adjacent mesh entry pairs on ether side of the (self, other) junction. meshIndices are the indices that look up entries in the vector of pools. spatialIndices are (iz * ny + iy) * nx + ix, that is, a linear conversion of cartesian spatial indices. So, for two touching cubes, the return vector is the paired meshIndices on either side of the plane of contact. If one mesh has a finer mesh than the other, or if there are more than one contact points from self to other (for example, at a corner), then we just have multiple pairs using the same meshIndex of the repeated voxel.

Implements ChemCompt.

Definition at line 486 of file SpineMesh.cpp.

References ChemCompt::flipRet(), matchCubeMeshEntries(), matchNeuroMeshEntries(), and PsdMesh::matchSpineMeshEntries().

488 {
489  const CubeMesh* cm = dynamic_cast< const CubeMesh* >( other );
490  if ( cm ) {
491  matchCubeMeshEntries( other, ret );
492  return;
493  }
494  const NeuroMesh* nm = dynamic_cast< const NeuroMesh* >( other );
495  if ( nm ) {
496  matchNeuroMeshEntries( other, ret );
497  return;
498  }
499  const PsdMesh* pm = dynamic_cast< const PsdMesh* >( other );
500  if ( pm ) {
501  pm->matchSpineMeshEntries( this, ret );
502  flipRet( ret );
503  return;
504  }
505  cout << "Warning: SpineMesh::matchMeshEntries: unknown class\n";
506 }
void matchSpineMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: PsdMesh.cpp:493
void matchNeuroMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: SpineMesh.cpp:543
void flipRet(vector< VoxelJunction > &ret) const
Utility function for swapping first and second in VoxelJunctions.
Definition: ChemCompt.cpp:406
void matchCubeMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: SpineMesh.cpp:557

+ Here is the call graph for this function:

void SpineMesh::matchNeuroMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const

Definition at line 543 of file SpineMesh.cpp.

References NeuroMesh::getMeshEntryVolume(), and spines_.

Referenced by matchMeshEntries(), and NeuroMesh::matchMeshEntries().

545 {
546  const NeuroMesh* nm = dynamic_cast< const NeuroMesh* >( other );
547  assert( nm );
548  for ( unsigned int i = 0; i < spines_.size(); ++i ) {
549  double xda = spines_[i].rootArea() / spines_[i].diffusionLength();
550  ret.push_back( VoxelJunction( i, spines_[i].parent(), xda ) );
551  ret.back().firstVol = spines_[i].volume();
552  ret.back().secondVol =
553  nm->getMeshEntryVolume( spines_[i].parent() );
554  }
555 }
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: NeuroMesh.cpp:906
vector< SpineEntry > spines_
Definition: SpineMesh.h:183

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpineMesh::matchSpineMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const

Definition at line 538 of file SpineMesh.cpp.

540 {
541 }
double SpineMesh::nearest ( double  x,
double  y,
double  z,
unsigned int &  index 
) const
virtual

This works a little different from other subclass versions of the function. It finds the index of the mesh entry whose centre is closest to the specified coords, and returns the distance to the centre. Doesn't worry about whether this distance is inside or outside cell.

Implements ChemCompt.

Definition at line 516 of file SpineMesh.cpp.

References Vec::distance(), SpineEntry::mid(), and spines_.

518 {
519  double best = 1e12;
520  index = 0;
521  for( unsigned int i = 0; i < spines_.size(); ++i ) {
522  const SpineEntry& se = spines_[i];
523  double a0, a1, a2;
524  se.mid( a0, a1, a2 );
525  Vec a( a0, a1, a2 );
526  Vec b( x, y, z );
527  double d = a.distance( b );
528  if ( best > d ) {
529  best = d;
530  index = i;
531  }
532  }
533  if ( best == 1e12 )
534  return -1;
535  return best;
536 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
void mid(double &x, double &y, double &z) const
Return coords of centre of spine head.
Definition: SpineEntry.cpp:124
Definition: Vec.h:13

+ Here is the call graph for this function:

void SpineMesh::setMeshEntryVolume ( unsigned int  fid,
double  volume 
)
virtual

Virtual function to assign volume of mesh Entry.

Reimplemented from ChemCompt.

Definition at line 315 of file SpineMesh.cpp.

References spines_.

316 {
317  if ( spines_.size() == 0 )
318  return;
319  assert( fid < spines_.size() );
320  spines_[ fid % spines_.size() ].setVolume( volume );
321 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
const vector< SpineEntry > & SpineMesh::spines ( ) const

Definition at line 467 of file SpineMesh.cpp.

References spines_.

468 {
469  return spines_;
470 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
void SpineMesh::transmitChange ( const Eref e)
void SpineMesh::updateCoords ( )

Recomputes all local coordinate and meshing data following a change in any of the coord parameters

This assumes that lambda is the quantity to preserve, over numEntries. So when the compartment changes volume, numEntries changes too. Assumes that the soma node is at index 0.

Definition at line 235 of file SpineMesh.cpp.

References buildStencil().

Referenced by handleSpineList().

236 {
237  buildStencil();
238 }
void buildStencil()
Definition: SpineMesh.cpp:475

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double SpineMesh::vGetEntireVolume ( ) const
virtual

Inherited virtual func.

Implements ChemCompt.

Definition at line 413 of file SpineMesh.cpp.

References vs_.

Referenced by vSetVolumeNotRates().

414 {
415  double ret = 0.0;
416  for ( vector< double >::const_iterator i =
417  vs_.begin(); i != vs_.end(); ++i )
418  ret += *i;
419  return ret;
420 }
vector< double > vs_
Definition: SpineMesh.h:197

+ Here is the caller graph for this function:

const vector< double > & SpineMesh::vGetVoxelMidpoint ( ) const
virtual

Virtual func so that derived classes can return voxel midpoint.

Implements ChemCompt.

Definition at line 390 of file SpineMesh.cpp.

References spines_.

391 {
392  static vector< double > midpoint;
393  midpoint.resize( spines_.size() * 3 );
394  for ( unsigned int i = 0; i < spines_.size(); ++i ) {
395  spines_[i].mid( midpoint[i],
396  midpoint[i + spines_.size() ],
397  midpoint[i + 2 * spines_.size() ]
398  );
399  }
400  return midpoint;
401 }
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
const vector< double > & SpineMesh::vGetVoxelVolume ( ) const
virtual

Virtual func so that derived classes can pass voxel volume back.

Implements ChemCompt.

Definition at line 385 of file SpineMesh.cpp.

References vs_.

386 {
387  return vs_;
388 }
vector< double > vs_
Definition: SpineMesh.h:197
bool SpineMesh::vSetVolumeNotRates ( double  volume)
virtual

Inherited virtual func.

Implements ChemCompt.

Definition at line 422 of file SpineMesh.cpp.

References area_, length_, spines_, vGetEntireVolume(), and vs_.

423 {
424  double volscale = volume / vGetEntireVolume();
425  double linscale = pow( volscale, 1.0/3.0 );
426  assert( vs_.size() == spines_.size() );
427  assert( area_.size() == spines_.size() );
428  assert( length_.size() == spines_.size() );
429  for ( unsigned int i = 0; i < spines_.size(); ++i ) {
430  spines_[i].setVolume( volume );
431  vs_[i] *= volscale;
432  area_[i] *= linscale * linscale;
433  length_[i] *= linscale;
434  }
435  return true;
436 }
vector< double > area_
Definition: SpineMesh.h:203
vector< SpineEntry > spines_
Definition: SpineMesh.h:183
double vGetEntireVolume() const
Inherited virtual func.
Definition: SpineMesh.cpp:413
vector< double > length_
Pre-calculation of length of each MeshEntry.
Definition: SpineMesh.h:206
vector< double > vs_
Definition: SpineMesh.h:197

+ Here is the call graph for this function:

Member Data Documentation

vector< double > SpineMesh::area_
private

Mesh junction area pre-calculations for each MeshEntry. This is the cross-section area of the middle of each voxel.

Definition at line 203 of file SpineMesh.h.

Referenced by getVoxelArea(), handleSpineList(), and vSetVolumeNotRates().

vector< double > SpineMesh::length_
private

Pre-calculation of length of each MeshEntry.

Definition at line 206 of file SpineMesh.h.

Referenced by getVoxelLength(), handleSpineList(), and vSetVolumeNotRates().

double SpineMesh::surfaceGranularity_
private

Decides how finely to subdivide diffLength_ or radius or cubic mesh side when computing surfacearea of intersections with CubeMesh. Defaults to 0.1.

Definition at line 190 of file SpineMesh.h.

Referenced by matchCubeMeshEntries().

vector< double > SpineMesh::vs_
private

Volscale pre-calculations for each MeshEntry. vs = #molecules / vol where vol is expressed in m^3.

Definition at line 197 of file SpineMesh.h.

Referenced by handleSpineList(), vGetEntireVolume(), vGetVoxelVolume(), and vSetVolumeNotRates().


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