#include <CubeMesh.h>
Public Member Functions | |
CubeMesh () | |
~CubeMesh () | |
void | setX0 (double v) |
double | getX0 () const |
void | setY0 (double v) |
double | getY0 () const |
void | setZ0 (double v) |
double | getZ0 () const |
void | setX1 (double v) |
double | getX1 () const |
void | setY1 (double v) |
double | getY1 () const |
void | setZ1 (double v) |
double | getZ1 () const |
void | setDx (double v) |
double | getDx () const |
void | setDy (double v) |
double | getDy () const |
void | setDz (double v) |
double | getDz () const |
void | setNx (unsigned int v) |
unsigned int | getNx () const |
void | setNy (unsigned int v) |
unsigned int | getNy () const |
void | setNz (unsigned int v) |
unsigned int | getNz () const |
void | innerSetCoords (const vector< double > &v) |
void | setCoords (const Eref &e, vector< double > v) |
vector< double > | getCoords (const Eref &e) const |
void | setMeshToSpace (vector< unsigned int > v) |
vector< unsigned int > | getMeshToSpace () const |
void | setSpaceToMesh (vector< unsigned int > v) |
vector< unsigned int > | getSpaceToMesh () const |
void | setSurface (vector< unsigned int > v) |
vector< unsigned int > | getSurface () const |
unsigned int | innerGetDimensions () const |
void | setIsToroid (bool v) |
bool | getIsToroid () const |
void | setPreserveNumEntries (bool v) |
bool | getPreserveNumEntries () const |
void | setAlwaysDiffuse (bool v) |
bool | getAlwaysDiffuse () 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 |
Virtual function to return volume of mesh Entry, including. | |
unsigned int | innerGetNumEntries () const |
void | innerSetNumEntries (unsigned int n) |
Inherited virtual func. | |
void | innerHandleRequestMeshStats (const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo) |
void | innerHandleNodeInfo (const Eref &e, unsigned int numNodes, unsigned int numThreads) |
double | vGetEntireVolume () const |
Virtual func to get volume of entire compartment. | |
void | buildMesh (Id geom, double x, double y, double z) |
void | addStoich (Id stoich) |
void | innerBuildDefaultMesh (const Eref &e, double volume, unsigned int numEntries) |
Virtual func to make a mesh with specified Volume and numEntries. | |
bool | vSetVolumeNotRates (double volume) |
Virtual func, assigns volume, usually to single voxel. | |
void | updateCoords () |
unsigned int | neighbor (unsigned int spaceIndex, int dx, int dy, int dz) const |
void | transmitChange (const Eref &e, double oldvol) |
bool | isInsideCuboid (double x, double y, double z) const |
bool | isInsideSpheroid (double x, double y, double z) const |
void | matchMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const |
void | matchCubeMeshEntries (const CubeMesh *other, vector< VoxelJunction > &ret) const |
void | matchCylMeshEntries (const ChemCompt *other, vector< VoxelJunction > &ret) const |
void | matchAllEntries (const CubeMesh *other, vector< VoxelJunction > &ret) const |
unsigned int | numDims () const |
Utility function for returning # of dimensions in mesh. | |
void | indexToSpace (unsigned int index, double &x, double &y, double &z) const |
Converts the integer meshIndex to spatial coords. | |
unsigned int | spaceToIndex (double x, double y, double z) const |
Converts the 3-D coords to an index. EMPTY if out of range. | |
double | nearest (double x, double y, double z, unsigned int &index) const |
int | compareMeshSpacing (const CubeMesh *other) const |
Return 0 if spacing same, -1 if self smaller, +1 if self bigger. | |
void | defineIntersection (const CubeMesh *other, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) const |
Defines a cuboid volume of intersection between self and other. | |
void | fillTwoDimSurface () |
Fills surface_ vector with spatial meshIndices for a rectangle. | |
void | fillThreeDimSurface () |
const vector< unsigned int > & | surface () const |
Utility and test function to read surface. | |
vector< unsigned int > | getParentVoxel () const |
Inherited virtual, do nothing for now. | |
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 |
void | buildStencil () |
void | fillSpaceToMeshLookup () |
void | deriveM2sFromS2m () |
void | deriveS2mFromM2s () |
void | assignVoxels (vector< pair< unsigned int, unsigned int > > &intersect, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) const |
void | setDiffScale (const CubeMesh *other, vector< VoxelJunction > &ret) const |
Assigns diffusion scaling info for the voxel junctions. | |
void | setJunctionVol (const CubeMesh *other, vector< VoxelJunction > &ret) const |
Assigns volume info for the voxel junctions. | |
void | updateM2s () |
void | updateS2m () |
Static Public Member Functions | |
static const Cinfo * | initCinfo () |
Static Public Attributes | |
static const unsigned int | EMPTY = ~0 |
static const unsigned int | SURFACE = ~1 |
static const unsigned int | ABUTX = ~2 |
static const unsigned int | ABUTY = ~3 |
static const unsigned int | ABUTZ = ~4 |
static const unsigned int | MULTI = ~5 |
The CubeMesh represents a chemically identified compartment shaped like a cuboid. This is not really an effective geometry for most neurons because it would have to be rather finely subdivided to fit a typical dendrite or soma volume, but it is general.
CubeMesh::CubeMesh | ( | ) |
CubeMesh::~CubeMesh | ( | ) |
void CubeMesh::addStoich | ( | Id | stoich | ) |
void CubeMesh::assignVoxels | ( | vector< pair< unsigned int, unsigned int > > & | intersect, | |
double | xmin, | |||
double | xmax, | |||
double | ymin, | |||
double | ymax, | |||
double | zmin, | |||
double | zmax | |||
) | const |
void CubeMesh::buildMesh | ( | Id | geom, | |
double | x, | |||
double | y, | |||
double | z | |||
) |
Referenced by initCinfo().
void CubeMesh::buildStencil | ( | ) |
Sets up the stencil that defines how to combine neighboring mesh elements to set up the diffusion du/dt term, using the method of lines. This is a very general function. It uses the information in the m2s_ and s2m_ vectors to work out the adjacency matrix. So we could use an arbitrary 3-D image to define the diffusive volume and boundaries using m2s_ and s2m_. We could also use geometric shapes through the fillSpaceToMeshLookup() function, which is currently a dummy and just does a cuboid.
References MeshCompt::addRow(), EMPTY, MeshCompt::innerResetStencil(), q, and MeshCompt::setStencilSize().
Referenced by deriveM2sFromS2m(), deriveS2mFromM2s(), and updateCoords().
int CubeMesh::compareMeshSpacing | ( | const CubeMesh * | other | ) | const |
Return 0 if spacing same, -1 if self smaller, +1 if self bigger.
References doubleApprox().
void CubeMesh::defineIntersection | ( | const CubeMesh * | other, | |
double & | xmin, | |||
double & | xmax, | |||
double & | ymin, | |||
double & | ymax, | |||
double & | zmin, | |||
double & | zmax | |||
) | const |
Defines a cuboid volume of intersection between self and other.
References swapIfBackward().
void CubeMesh::deriveM2sFromS2m | ( | ) |
Updates the m2s_ vector after s2m_ has been changed, and rebuilds the Stencil too. Any earlier junction information is lost.
References buildStencil(), and EMPTY.
void CubeMesh::deriveS2mFromM2s | ( | ) |
Updates the s2m_ vector after m2s_ has been changed, and rebuilds the Stencil too. Any earlier junction information is lost.
References buildStencil(), and EMPTY.
double CubeMesh::extendedMeshEntryVolume | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return volume of mesh Entry, including.
Utility function to return volume of any voxel including those diffusively coupled and aubtting the present volume.
Reimplemented from MeshCompt.
void CubeMesh::fillSpaceToMeshLookup | ( | ) |
void CubeMesh::fillThreeDimSurface | ( | ) |
Fills surface_ vector with spatial meshIndices for a cuboid, that is, puts the surfaces of the cuboid in the vector.
Referenced by updateCoords().
void CubeMesh::fillTwoDimSurface | ( | ) |
Fills surface_ vector with spatial meshIndices for a rectangle.
bool CubeMesh::getAlwaysDiffuse | ( | ) | const |
Referenced by initCinfo().
vector< double > CubeMesh::getCoordinates | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return coords of mesh Entry.
Virtual function to return coords of mesh Entry. For Cuboid mesh, coords are x1y1z1 x2y2z2
Implements ChemCompt.
vector< double > CubeMesh::getCoords | ( | const Eref & | e | ) | const |
Referenced by initCinfo(), and testCubeMesh().
vector< double > CubeMesh::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 EMPTY, and neighbor().
vector< double > CubeMesh::getDiffusionScaling | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return scale factor for diffusion. 1 here.
Implements ChemCompt.
double CubeMesh::getDx | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getDy | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getDz | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
bool CubeMesh::getIsToroid | ( | ) | const |
Referenced by initCinfo().
unsigned int CubeMesh::getMeshDimensions | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return dimensions of specified entry.
Implements ChemCompt.
Referenced by testCubeMesh(), and testCubeMeshExtendStencil().
double CubeMesh::getMeshEntryVolume | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return volume of mesh Entry.
Implements ChemCompt.
vector< unsigned int > CubeMesh::getMeshToSpace | ( | ) | const |
Referenced by initCinfo(), and testCubeMeshJunctionTwoDimSurface().
unsigned int CubeMesh::getMeshType | ( | unsigned int | fid | ) | const [virtual] |
Virtual function to return MeshType of specified entry.
Implements ChemCompt.
References CUBOID.
Referenced by testCubeMesh(), and testCubeMeshExtendStencil().
unsigned int CubeMesh::getNx | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
unsigned int CubeMesh::getNy | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
unsigned int CubeMesh::getNz | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
vector< unsigned int > CubeMesh::getParentVoxel | ( | ) | const [virtual] |
Inherited virtual, do nothing for now.
Implements MeshCompt.
bool CubeMesh::getPreserveNumEntries | ( | ) | const |
Referenced by initCinfo().
vector< unsigned int > CubeMesh::getSpaceToMesh | ( | ) | const |
Referenced by initCinfo(), and testCubeMeshJunctionTwoDimSurface().
vector< unsigned int > CubeMesh::getSurface | ( | ) | const |
Referenced by initCinfo().
const vector< double > & CubeMesh::getVoxelArea | ( | ) | const [virtual] |
Implements MeshCompt.
const vector< double > & CubeMesh::getVoxelLength | ( | ) | const [virtual] |
Implements MeshCompt.
double CubeMesh::getX0 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getX1 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getY0 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getY1 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getZ0 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
double CubeMesh::getZ1 | ( | ) | const |
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::indexToSpace | ( | unsigned int | index, | |
double & | x, | |||
double & | y, | |||
double & | z | |||
) | const [virtual] |
const Cinfo * CubeMesh::initCinfo | ( | ) | [static] |
Reimplemented from ChemCompt.
References buildMesh(), getAlwaysDiffuse(), getCoords(), getDx(), getDy(), getDz(), getIsToroid(), getMeshToSpace(), getNx(), getNy(), getNz(), getPreserveNumEntries(), getSpaceToMesh(), getSurface(), getX0(), getX1(), getY0(), getY1(), getZ0(), getZ1(), ChemCompt::initCinfo(), setAlwaysDiffuse(), setCoords(), setDx(), setDy(), setDz(), setIsToroid(), setMeshToSpace(), setNx(), setNy(), setNz(), setPreserveNumEntries(), setSpaceToMesh(), setSurface(), setX0(), setX1(), setY0(), setY1(), setZ0(), setZ1(), and surface().
void CubeMesh::innerBuildDefaultMesh | ( | const Eref & | e, | |
double | volume, | |||
unsigned int | numEntries | |||
) | [virtual] |
Virtual func to make a mesh with specified Volume and numEntries.
Builds something as close to a cube as can get. This needs a smarter boundary handling code than I have here. For now, goes for the nearest cube
Implements ChemCompt.
References setCoords().
unsigned int CubeMesh::innerGetDimensions | ( | ) | const [virtual] |
Implements ChemCompt.
unsigned int CubeMesh::innerGetNumEntries | ( | ) | const [virtual] |
Inherited virtual func. Returns number of MeshEntry in array
Implements ChemCompt.
Referenced by testCubeMesh().
void CubeMesh::innerHandleNodeInfo | ( | const Eref & | e, | |
unsigned int | numNodes, | |||
unsigned int | numThreads | |||
) | [virtual] |
Generate node decomposition of mesh, send it out along meshSplitFinfo msg
Implements ChemCompt.
void CubeMesh::innerHandleRequestMeshStats | ( | const Eref & | e, | |
const SrcFinfo2< unsigned int, vector< double > > * | meshStatsFinfo | |||
) |
void CubeMesh::innerSetCoords | ( | const vector< double > & | v | ) |
void CubeMesh::innerSetNumEntries | ( | unsigned int | n | ) | [virtual] |
Inherited virtual func.
Inherited virtual func. Assigns number of MeshEntries.
Implements ChemCompt.
bool CubeMesh::isInsideCuboid | ( | double | x, | |
double | y, | |||
double | z | |||
) | const |
Referenced by fillSpaceToMeshLookup().
bool CubeMesh::isInsideSpheroid | ( | double | x, | |
double | y, | |||
double | z | |||
) | const |
void CubeMesh::matchAllEntries | ( | const CubeMesh * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
Dumbed-down version that does mesh matching based only on index. Useful for non-spatial matching and single-voxel systems.
void CubeMesh::matchCubeMeshEntries | ( | const CubeMesh * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
Specialization for cube-to-cube mesh matching. Return vector is of pairs of meshIndices (not spatialIndices).
Referenced by testCubeMeshJunctionDiffSizeMesh(), and testCubeMeshJunctionTwoDimSurface().
void CubeMesh::matchCylMeshEntries | ( | const ChemCompt * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
void CubeMesh::matchMeshEntries | ( | const ChemCompt * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
double CubeMesh::nearest | ( | double | x, | |
double | y, | |||
double | z, | |||
unsigned int & | index | |||
) | const [virtual] |
Virtual function to return the distance and index of nearest meshEntry. Places entry at centre of voxel.
Implements ChemCompt.
References ChemCompt::distance(), EMPTY, and indexToSpace().
unsigned int CubeMesh::neighbor | ( | unsigned int | spaceIndex, | |
int | dx, | |||
int | dy, | |||
int | dz | |||
) | const |
References EMPTY.
Referenced by getDiffusionArea().
unsigned int CubeMesh::numDims | ( | ) | const |
Utility function for returning # of dimensions in mesh.
Referenced by testCubeMeshFillTwoDimSurface().
void CubeMesh::setAlwaysDiffuse | ( | bool | v | ) |
Referenced by initCinfo().
void CubeMesh::setCoords | ( | const Eref & | e, | |
vector< double > | v | |||
) |
Referenced by initCinfo(), and innerBuildDefaultMesh().
void CubeMesh::setDiffScale | ( | const CubeMesh * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
Assigns diffusion scaling info for the voxel junctions.
void CubeMesh::setDx | ( | double | v | ) |
void CubeMesh::setDy | ( | double | v | ) |
void CubeMesh::setDz | ( | double | v | ) |
void CubeMesh::setIsToroid | ( | bool | v | ) |
Referenced by initCinfo().
void CubeMesh::setJunctionVol | ( | const CubeMesh * | other, | |
vector< VoxelJunction > & | ret | |||
) | const |
Assigns volume info for the voxel junctions.
void CubeMesh::setMeshToSpace | ( | vector< unsigned int > | v | ) |
Referenced by initCinfo(), and testCubeMeshJunctionTwoDimSurface().
void CubeMesh::setNx | ( | unsigned int | v | ) |
void CubeMesh::setNy | ( | unsigned int | v | ) |
void CubeMesh::setNz | ( | unsigned int | v | ) |
void CubeMesh::setPreserveNumEntries | ( | bool | v | ) |
void CubeMesh::setSpaceToMesh | ( | vector< unsigned int > | v | ) |
Referenced by initCinfo(), and testCubeMeshJunctionTwoDimSurface().
void CubeMesh::setSurface | ( | vector< unsigned int > | v | ) |
Referenced by initCinfo(), and testCubeMeshJunctionTwoDimSurface().
void CubeMesh::setX0 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::setX1 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::setY0 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::setY1 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::setZ0 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
void CubeMesh::setZ1 | ( | double | v | ) |
References updateCoords().
Referenced by initCinfo(), and testCubeMesh().
unsigned int CubeMesh::spaceToIndex | ( | double | x, | |
double | y, | |||
double | z | |||
) | const |
Converts the 3-D coords to an index. EMPTY if out of range.
References EMPTY.
Referenced by fillPointsOnCircle().
const vector< unsigned int > & CubeMesh::surface | ( | ) | const |
Utility and test function to read surface.
Referenced by initCinfo(), testCubeMeshFillTwoDimSurface(), testCubeMeshJunctionDiffSizeMesh(), testCubeMeshJunctionTwoDimSurface(), and testCubeMeshMultiJunctionTwoD().
void CubeMesh::transmitChange | ( | const Eref & | e, | |
double | oldvol | |||
) |
void CubeMesh::updateCoords | ( | ) |
Recomputes all local coordinate and meshing data following a change in any of the coord parameters
This assumes that dx, dy, dz are the quantities to preserve, over numEntries. So when the compartment changes volume, so does numEntries. dx, dy, dz do not change, some of the sub-cuboids will partially be outside.
Temporarily fill out the whole cube for m2s and s2m. These
References buildStencil(), fillThreeDimSurface(), and swapIfBackward().
Referenced by CubeMesh(), setDx(), setDy(), setDz(), setNx(), setNy(), setNz(), setX0(), setX1(), setY0(), setY1(), setZ0(), and setZ1().
void CubeMesh::updateM2s | ( | ) |
void CubeMesh::updateS2m | ( | ) |
double CubeMesh::vGetEntireVolume | ( | ) | const [virtual] |
Virtual func to get volume of entire compartment.
Implements ChemCompt.
Referenced by vSetVolumeNotRates().
const vector< double > & CubeMesh::vGetVoxelMidpoint | ( | ) | const [virtual] |
Virtual func so that derived classes can return voxel midpoint.
Implements ChemCompt.
const vector< double > & CubeMesh::vGetVoxelVolume | ( | ) | const [virtual] |
Virtual func so that derived classes can pass voxel volume back.
Implements ChemCompt.
bool CubeMesh::vSetVolumeNotRates | ( | double | volume | ) | [virtual] |
Virtual func, assigns volume, usually to single voxel.
Implements ChemCompt.
References vGetEntireVolume().
const unsigned int CubeMesh::ABUTX = ~2 [static] |
Referenced by checkAbut(), setIntersectVoxel(), and testIntersectVoxel().
const unsigned int CubeMesh::ABUTY = ~3 [static] |
Referenced by checkAbut(), and setIntersectVoxel().
const unsigned int CubeMesh::ABUTZ = ~4 [static] |
Referenced by checkAbut(), and setIntersectVoxel().
const unsigned int CubeMesh::EMPTY = ~0 [static] |
const unsigned int CubeMesh::MULTI = ~5 [static] |
Referenced by checkAbut(), setAbut(), and testIntersectVoxel().
const unsigned int CubeMesh::SURFACE = ~1 [static] |
Referenced by checkAbut(), setAbut(), setIntersectVoxel(), and testIntersectVoxel().