13 #include "../utility/Vec.h"
27 #include "../utility/numutil.h"
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",
67 "Vector of indices of voxels on parent NeuroMesh, from which "
68 "the respective spines emerge.",
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. ",
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",
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 "
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",
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 ",
114 vector< unsigned int > >(
122 static Finfo* spineMeshFinfos[] = {
138 sizeof( spineMeshFinfos ) /
sizeof (
Finfo* ),
157 surfaceGranularity_( 0.1 ),
165 spines_( other.spines_ ),
166 surfaceGranularity_( other.surfaceGranularity_ )
187 vector< unsigned int > ret(
spines_.size(), -1U );
198 vector< unsigned int > ret(
spines_.size(), -1U );
199 for (
unsigned int i = 0; i <
spines_.size(); ++i )
206 vector< Id > ret(
spines_.size() );
207 for (
unsigned int i = 0; i <
spines_.size(); ++i )
214 vector< unsigned int > ret(
spines_.size() );
215 for (
unsigned int i = 0; i < ret.size(); ++i )
222 vector< unsigned int > ret(
spines_.size() );
223 for (
unsigned int i = 0; i < ret.size(); ++i )
247 const Eref& e, vector< Id > shaft, vector< Id > head,
248 vector< unsigned int > parentVoxel )
251 assert( head.size() == parentVoxel.size() );
252 assert( head.size() == shaft.size() );
254 vs_.resize( head.size() );
255 area_.resize( head.size() );
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 ) {
276 vector< unsigned int > localIndices( head.size() );
277 vector< double > vols( head.size() );
278 for (
unsigned int i = 0; i < head.size(); ++i ) {
282 vector< vector< unsigned int > > outgoingEntries;
283 vector< vector< unsigned int > > incomingEntries;
286 oldVol, 0, localIndices, vols );
296 assert( fid <
spines_.size() );
311 assert( fid <
spines_.size() );
319 assert( fid <
spines_.size() );
327 vector< double > ret;
334 vector< double > ret;
343 return vector< double >( 2, 1.0 );
376 unsigned int numNodes,
unsigned int numThreads )
392 static vector< double > midpoint;
393 midpoint.resize(
spines_.size() * 3 );
394 for (
unsigned int i = 0; i <
spines_.size(); ++i ) {
397 midpoint[i + 2 *
spines_.size() ]
416 for ( vector< double >::const_iterator i =
417 vs_.begin(); i !=
vs_.end(); ++i )
425 double linscale = pow( volscale, 1.0/3.0 );
429 for (
unsigned int i = 0; i <
spines_.size(); ++i ) {
430 spines_[i].setVolume( volume );
432 area_[i] *= linscale * linscale;
463 cout <<
"Warning: SpineMesh::innerBuildDefaultMesh: attempt to build a default spine: not permitted\n";
487 vector< VoxelJunction >& ret )
const
505 cout <<
"Warning: SpineMesh::matchMeshEntries: unknown class\n";
509 double& x,
double& y,
double& z )
const
513 spines_[ index ].mid( x, y, z );
517 unsigned int& index )
const
521 for(
unsigned int i = 0; i <
spines_.size(); ++i ) {
524 se.
mid( a0, a1, a2 );
539 vector< VoxelJunction >& ret )
const
544 vector< VoxelJunction >& ret )
const
548 for (
unsigned int i = 0; i <
spines_.size(); ++i ) {
549 double xda =
spines_[i].rootArea() /
spines_[i].diffusionLength();
551 ret.back().firstVol =
spines_[i].volume();
552 ret.back().secondVol =
558 vector< VoxelJunction >& ret )
const
560 for(
unsigned int i = 0; i <
spines_.size(); ++i ) {
static const Cinfo * initCinfo()
unsigned int innerGetNumEntries() const
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
static const Cinfo * spineMeshCinfo
void innerBuildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)
Virtual func to make a mesh with specified Volume and numEntries.
void innerResetStencil()
virtual func implemented here.
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
const vector< double > & vGetVoxelVolume() const
Virtual func so that derived classes can pass voxel volume back.
bool vSetVolumeNotRates(double volume)
Inherited virtual func.
unsigned int value() const
vector< unsigned int > getStartVoxelInCompt() const
Returns index of first voxel mapping to elec compt.
MeshEntry * lookupEntry(unsigned int index)
const vector< double > & vGetVoxelMidpoint() const
Virtual func so that derived classes can return voxel midpoint.
double extendedMeshEntryVolume(unsigned int fid) const
Vol of all mesh Entries including abutting diff-coupled voxels.
double extendedMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry, including.
vector< double > getCoordinates(unsigned int fid) const
Virtual function to return coords of mesh Entry.
const vector< double > & getVoxelArea() const
void indexToSpace(unsigned int index, double &x, double &y, double &z) const
vector< double > getDiffusionArea(unsigned int fid) const
Virtual function to return diffusion X-section area.
void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
vector< SpineEntry > spines_
const vector< SpineEntry > & spines() const
void mid(double &x, double &y, double &z) const
Return coords of centre of spine head.
vector< Id > getElecComptMap() const
unsigned int getMeshType(unsigned int fid) const
Virtual function to return MeshType of specified entry.
double vGetEntireVolume() const
Inherited virtual func.
const vector< double > & getVoxelLength() const
vector< double > length_
Pre-calculation of length of each MeshEntry.
vector< unsigned int > getNeuronVoxel() const
static const Cinfo * initCinfo()
double surfaceGranularity_
double distance(const Vec &other) const
void matchSpineMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
vector< double > getDiffusionScaling(unsigned int fid) const
Virtual function to return scale factor for diffusion. 1 here.
void matchSpineMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
void innerSetNumEntries(unsigned int n)
Inherited virtual func.
void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
void triggerRemesh(const Eref &e, double oldvol, unsigned int startEntry, const vector< unsigned int > &localIndices, const vector< double > &vols)
double nearest(double x, double y, double z, unsigned int &index) const
static unsigned int numNodes
void matchNeuroMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
vector< unsigned int > getEndVoxelInCompt() const
Returns index of end voxel mapping to elec compt, just first+1.
void matchCubeMeshEntriesToHead(const ChemCompt *compt, unsigned int myIndex, double granularity, vector< VoxelJunction > &ret) const
Returns Id of head electrical compartment.
void setStencilSize(unsigned int numRows, unsigned int numCols)
void setMeshEntryVolume(unsigned int fid, double volume)
Virtual function to assign volume of mesh Entry.
void flipRet(vector< VoxelJunction > &ret) const
Utility function for swapping first and second in VoxelJunctions.
void matchCubeMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
unsigned int getMeshDimensions(unsigned int fid) const
Virtual function to return dimensions of specified entry.
unsigned int innerGetDimensions() const
Returns # of dimensions, always 3 here. Inherited pure virt func.
vector< unsigned int > getParentVoxel() const
void handleSpineList(const Eref &e, vector< Id > shaft, vector< Id > head, vector< unsigned int > parentVoxel)