#include <NeuroMesh.h>
Public Member Functions | |
NeuroMesh () | |
NeuroMesh (const NeuroMesh &other) | |
~NeuroMesh () | |
NeuroMesh & | operator= (const NeuroMesh &other) |
void | updateCoords () |
void | setSubTreePath (const Eref &e, string path) |
string | getSubTreePath (const Eref &e) const |
void | setSubTree (const Eref &e, vector< ObjId > compartments) |
vector< ObjId > | getSubTree (const Eref &e) const |
void | transmitSpineInfo (const Eref &e) |
void | setSeparateSpines (bool v) |
bool | getSeparateSpines () const |
unsigned int | getNumSegments () const |
unsigned int | getNumDiffCompts () const |
void | setDiffLength (double v) |
double | getDiffLength () const |
void | setGeometryPolicy (string v) |
string | getGeometryPolicy () const |
unsigned int | innerGetDimensions () const |
vector< Id > | getElecComptList () const |
vector< Id > | getElecComptMap () const |
vector< unsigned int > | getStartVoxelInCompt () const |
vector< unsigned int > | getEndVoxelInCompt () const |
vector< int > | getSpineVoxelOnDendVoxel () const |
vector< unsigned int > | getDendVoxelsOnCompartment (ObjId compt) const |
vector< unsigned int > | getSpineVoxelsOnCompartment (ObjId compt) const |
vector< unsigned int > | getParentVoxel () const |
const vector< double > & | vGetVoxelVolume () const |
Virtual func so that derived classes can pass voxel volume back. | |
const vector< double > & | vGetVoxelMidpoint () const |
Virtual func so that derived classes can return voxel midpoint. | |
const vector< double > & | getVoxelArea () const |
const vector< double > & | getVoxelLength () const |
unsigned int | getMeshType (unsigned int fid) const |
Virtual function to return MeshType of specified entry. | |
unsigned int | getMeshDimensions (unsigned int fid) const |
Virtual function to return dimensions of specified entry. | |
double | getMeshEntryVolume (unsigned int fid) const |
Virtual function to return volume of mesh Entry. | |
vector< double > | getCoordinates (unsigned int fid) const |
Virtual function to return coords of mesh Entry. | |
vector< double > | getDiffusionArea (unsigned int fid) const |
Virtual function to return diffusion X-section area. | |
vector< double > | getDiffusionScaling (unsigned int fid) const |
Virtual function to return scale factor for diffusion. 1 here. | |
double | extendedMeshEntryVolume (unsigned int fid) const |
Vol of all mesh Entries including abutting diff-coupled voxels. | |
unsigned int | innerGetNumEntries () const |
void | innerSetNumEntries (unsigned int n) |
Inherited virtual func. | |
double | vGetEntireVolume () const |
bool | vSetVolumeNotRates (double volume) |
void | innerBuildDefaultMesh (const Eref &e, double size, unsigned int numEntries) |
Virtual func to make a mesh with specified size and numEntries. | |
void | innerHandleRequestMeshStats (const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo) |
void | innerHandleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads) |
double | getAdx (unsigned int curr, unsigned int &parentFid) const |
void | buildStencil () |
Utility function to set up Stencil for diffusion in NeuroMesh. | |
void | matchMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const |
void | matchCubeMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const |
void | matchNeuroMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const |
double | nearest (double x, double y, double z, unsigned int &index) const |
void | indexToSpace (unsigned int index, double &x, double &y, double &z) const |
void | insertSingleDummy (unsigned int parent, unsigned int self, double x, double y, double z) |
void | insertDummyNodes () |
Id | putSomaAtStart (Id origSoma, unsigned int maxDiaIndex) |
This shuffles the nodes_ vector to put soma node at the start. | |
void | buildNodeTree (const map< Id, unsigned int > &comptMap) |
bool | filterSpines (Id compt) |
void | updateShaftParents () |
const vector< NeuroNode > & | getNodes () const |
Static Public Member Functions | |
static const Cinfo * | initCinfo () |
The NeuroMesh represents sections of a neuron whose spatial attributes are obtained from a neuronal model. Like the CylMesh, this is pseudo-1 dimension: Only the axial dimension is considered for diffusion and subdivisions. Branching is also handled.
Dendritic spines typically contain different reaction systems from the dendrite, but each spine has the same reactions. So they deserve their own mesh: SpineMesh. The idea is the the SpineMesh has just the spine head compartment, which duplicate the same reactions, but does not diffuse to other spine heads. Instead it has an effective diffusion constant to the parent dendrite compartment, obtained by treating the spine neck as a diffusion barrier with zero volume.
NeuroMesh::NeuroMesh | ( | ) |
NeuroMesh::NeuroMesh | ( | const NeuroMesh & | other | ) |
NeuroMesh::~NeuroMesh | ( | ) |
void NeuroMesh::buildNodeTree | ( | const map< Id, unsigned int > & | comptMap | ) |
buildNodeTree: This connects up parent and child nodes and if needed inserts dummy nodes to build up the model tree.
void NeuroMesh::buildStencil | ( | ) |
Utility function to set up Stencil for diffusion in NeuroMesh.
References MeshCompt::addRow(), getAdx(), MeshCompt::innerResetStencil(), and MeshCompt::setStencilSize().
Referenced by updateCoords().
double NeuroMesh::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.
References getMeshEntryVolume().
bool NeuroMesh::filterSpines | ( | Id | compt | ) |
Returns true if it finds a compartment name that looks like it ought to be on a spine. It filters out the names "neck", "shaft", "spine" and "head". The latter two are classified into the head_ vector. The first two are classified into the shaft_ vector.
References Id::element(), and Element::getName().
double NeuroMesh::getAdx | ( | unsigned int | curr, | |
unsigned int & | parentFid | |||
) | const |
Helper function for buildStencil, calculates diffusion term adx for rate between current compartment curr, and parent. By product: also passes back parent compartment index.
References CylBase::getDiffusionArea(), CylBase::getLength(), CylBase::getNumDivs(), NeuroNode::isDummyNode(), NeuroNode::parent(), and NeuroNode::startFid().
Referenced by buildStencil().
vector< double > NeuroMesh::getCoordinates | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return coords of mesh Entry.
Virtual function to return coords of mesh Entry. For Cylindrical mesh, coords are x1y1z1 x2y2z2 r0 r1 phi0 phi1
Implements ChemCompt.
vector< unsigned int > NeuroMesh::getDendVoxelsOnCompartment | ( | ObjId | compt | ) | const |
References ObjId::id.
Referenced by initCinfo().
double NeuroMesh::getDiffLength | ( | ) | const |
Referenced by initCinfo().
vector< double > NeuroMesh::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.
References MeshCompt::getNeighbors().
vector< double > NeuroMesh::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.
vector< Id > NeuroMesh::getElecComptList | ( | ) | const |
Referenced by getSubTree(), and initCinfo().
vector< Id > NeuroMesh::getElecComptMap | ( | ) | const |
Referenced by initCinfo().
vector< unsigned int > NeuroMesh::getEndVoxelInCompt | ( | ) | const |
Referenced by initCinfo().
string NeuroMesh::getGeometryPolicy | ( | ) | const |
Referenced by initCinfo().
unsigned int NeuroMesh::getMeshDimensions | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return dimensions of specified entry.
Implements ChemCompt.
double NeuroMesh::getMeshEntryVolume | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return volume of mesh Entry.
Implements ChemCompt.
Referenced by extendedMeshEntryVolume().
unsigned int NeuroMesh::getMeshType | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return MeshType of specified entry.
Implements ChemCompt.
References CYL, and SPHERE_SHELL_SEG.
const vector< NeuroNode > & NeuroMesh::getNodes | ( | ) | const |
unsigned int NeuroMesh::getNumDiffCompts | ( | ) | const |
Referenced by initCinfo().
unsigned int NeuroMesh::getNumSegments | ( | ) | const |
Referenced by initCinfo().
vector< unsigned int > NeuroMesh::getParentVoxel | ( | ) | const [virtual] |
Implements MeshCompt.
Referenced by initCinfo().
bool NeuroMesh::getSeparateSpines | ( | ) | const |
Referenced by initCinfo().
vector< int > NeuroMesh::getSpineVoxelOnDendVoxel | ( | ) | const |
Referenced by initCinfo().
vector< unsigned int > NeuroMesh::getSpineVoxelsOnCompartment | ( | ObjId | compt | ) | const |
References ObjId::id.
Referenced by initCinfo().
vector< unsigned int > NeuroMesh::getStartVoxelInCompt | ( | ) | const |
Referenced by initCinfo().
string NeuroMesh::getSubTreePath | ( | const Eref & | e | ) | const |
Referenced by initCinfo().
const vector< double > & NeuroMesh::getVoxelArea | ( | ) | const [virtual] |
Implements MeshCompt.
const vector< double > & NeuroMesh::getVoxelLength | ( | ) | const [virtual] |
Implements MeshCompt.
void NeuroMesh::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.
References a, Vec::a0(), Vec::a1(), Vec::a2(), CylBase::getNumDivs(), CylBase::getX(), CylBase::getY(), CylBase::getZ(), innerGetNumEntries(), NeuroNode::parent(), and NeuroNode::startFid().
const Cinfo * NeuroMesh::initCinfo | ( | ) | [static] |
Reimplemented from ChemCompt.
References getDendVoxelsOnCompartment(), getDiffLength(), getElecComptList(), getElecComptMap(), getEndVoxelInCompt(), getGeometryPolicy(), getNumDiffCompts(), getNumSegments(), getParentVoxel(), getSeparateSpines(), getSpineVoxelOnDendVoxel(), getSpineVoxelsOnCompartment(), getStartVoxelInCompt(), getSubTree(), getSubTreePath(), ChemCompt::initCinfo(), setDiffLength(), setGeometryPolicy(), setSeparateSpines(), setSubTree(), and setSubTreePath().
void NeuroMesh::innerBuildDefaultMesh | ( | const Eref & | e, | |
double | size, | |||
unsigned int | numEntries | |||
) | [virtual] |
Virtual func to make a mesh with specified size and numEntries.
This is a bit odd, effectively asks to build an imaginary neuron and then subdivide it. I'll make do with a ball-and-stick model: Soma with a single apical dendrite with reasonable diameter. I will interpret size as total length of neuron, not as volume. Soma will have a diameter of up to 20 microns, anything bigger than this is treated as soma of 20 microns + dendrite of (specified length - 10 microns) for radius of soma. This means we avoid having miniscule dendrites protruding from soma, the shortest one will be 10 microns.
Implements ChemCompt.
References dummy(), and updateCoords().
unsigned int NeuroMesh::innerGetDimensions | ( | ) | const [virtual] |
Implements ChemCompt.
unsigned int NeuroMesh::innerGetNumEntries | ( | ) | const [virtual] |
Inherited virtual func. Returns number of MeshEntry in array
Implements ChemCompt.
Referenced by indexToSpace().
void NeuroMesh::innerHandleNodeInfo | ( | const Eref & | e, | |
unsigned int | numNodes, | |||
unsigned int | numThreads | |||
) | [virtual] |
Implements ChemCompt.
void NeuroMesh::innerHandleRequestMeshStats | ( | const Eref & | e, | |
const SrcFinfo2< unsigned int, vector< double > > * | meshStatsFinfo | |||
) |
void NeuroMesh::innerSetNumEntries | ( | unsigned int | n | ) | [virtual] |
Inherited virtual func.
Inherited virtual func. Assigns number of MeshEntries. This one doesn't set exact number, because each compartment has to fit integral numbers of voxels.
Implements ChemCompt.
References updateCoords().
void NeuroMesh::insertDummyNodes | ( | ) |
Puts in all the required dummy nodes for the tree.
References insertSingleDummy(), and y.
void NeuroMesh::insertSingleDummy | ( | unsigned int | parent, | |
unsigned int | self, | |||
double | x, | |||
double | y, | |||
double | z | |||
) |
Puts in a dummy node between parent and self. Used to set up the correct size of proximal compartments.
References NeuroNode::addChild(), NeuroNode::clearChildren(), doubleEq(), dummy(), EPSILON, CylBase::setIsCylinder(), CylBase::setNumDivs(), NeuroNode::setParent(), CylBase::setX(), CylBase::setY(), and CylBase::setZ().
Referenced by insertDummyNodes().
void NeuroMesh::matchCubeMeshEntries | ( | const ChemCompt * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
void NeuroMesh::matchMeshEntries | ( | const ChemCompt * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
void NeuroMesh::matchNeuroMeshEntries | ( | const ChemCompt * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
double NeuroMesh::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.
References CylBase::getNumDivs(), NeuroNode::isDummyNode(), CylBase::nearest(), NeuroNode::parent(), and NeuroNode::startFid().
This shuffles the nodes_ vector to put soma node at the start.
void NeuroMesh::setDiffLength | ( | double | v | ) |
void NeuroMesh::setGeometryPolicy | ( | string | v | ) |
Referenced by initCinfo().
void NeuroMesh::setSeparateSpines | ( | bool | v | ) |
Flag. True if NeuroMesh should configure a separate SpineMesh. The process is that both the NeuroMesh and SpineMesh should have been created, and a spineList message sent from the NeuroMesh to the SpineMesh. This may cascade down to PsdMesh.
References updateCoords().
Referenced by initCinfo().
The SubTree is a set of compartments to model. The first entry is the root of the tree, closest to the soma. The system does handle non-contiguous sets.
Referenced by initCinfo().
void NeuroMesh::setSubTreePath | ( | const Eref & | e, | |
string | path | |||
) |
This overloaded function sets up a presumed contiguous set of compartments, complains if they are not contiguous due to the check in NeuroNode::traverse.
The 'path' argument specifies a wildcard list of compartments, which can be also a comma-separated explicit list. Does not have to be in any particular order.
Referenced by initCinfo().
void NeuroMesh::transmitSpineInfo | ( | const Eref & | e | ) |
Transmits the information about spines to SpineMesh and PsdMesh.
References Eref::element(), Element::hasMsgs(), and SpineEntry::psdCoords().
void NeuroMesh::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 size, so does numEntries. Assumes that the soma node is at index 0.
References buildStencil(), CylBase::getMiddleArea(), CylBase::getNumDivs(), CylBase::getVoxelLength(), NeuroNode::isDummyNode(), NeuroNode::parent(), NeuroNode::startFid(), and CylBase::voxelVolume().
Referenced by innerBuildDefaultMesh(), innerSetNumEntries(), setDiffLength(), and setSeparateSpines().
void NeuroMesh::updateShaftParents | ( | ) |
converts the parents_ vector from identifying the parent NeuroNode to identifying the parent voxel, for each shaft entry.
References CylBase::getX(), CylBase::getY(), CylBase::getZ(), CylBase::nearest(), NeuroNode::parent(), and NeuroNode::startFid().
double NeuroMesh::vGetEntireVolume | ( | ) | const [virtual] |
Inherited virtual func. Returns volume of soma and whole dendritic tree of neuron, excluding spines. Any axonal compartments are also included.
Implements ChemCompt.
const vector< double > & NeuroMesh::vGetVoxelMidpoint | ( | ) | const [virtual] |
Virtual func so that derived classes can return voxel midpoint.
Implements ChemCompt.
References CylBase::getCoordinates(), CylBase::getNumDivs(), NeuroNode::isDummyNode(), and NeuroNode::parent().
const vector< double > & NeuroMesh::vGetVoxelVolume | ( | ) | const [virtual] |
Virtual func so that derived classes can pass voxel volume back.
Implements ChemCompt.
bool NeuroMesh::vSetVolumeNotRates | ( | double | volume | ) | [virtual] |
Inherited virtual func. In the NeuroMesh this carries out a rescaling on all dimensions. The length and diameter of each compartment are scaled by the same factor = volscale^(1/3) The rescaling carries through to the spines and PSDs, which are also updated. They are not permitted to change their own volumes.
Implements ChemCompt.
References CylBase::getDia(), CylBase::getLength(), CylBase::setDia(), CylBase::setLength(), and CylBase::volume().