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

#include <PsdMesh.h>

+ Inheritance diagram for PsdMesh:
+ Collaboration diagram for PsdMesh:

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...
 
double getThickness () const
 
const vector< double > & getVoxelArea () const
 
const vector< double > & getVoxelLength () const
 
void handlePsdList (const Eref &e, vector< double > params, vector< Id > elecCompts, 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 innerHandleRequestMeshStats (const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo)
 
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
 
unsigned int parent (unsigned int index) const
 
 PsdMesh ()
 
 PsdMesh (const PsdMesh &other)
 
void setMeshEntryVolume (unsigned int fid, double volume)
 Virtual function to set volume of mesh Entry. More...
 
void setThickness (double v)
 
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...
 
 ~PsdMesh ()
 
- 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_
 Vol. More...
 
vector< IdelecCompt_
 Parent voxel index. More...
 
vector< double > length_
 area More...
 
vector< CylBasepa_
 Specified disk of psd. More...
 
vector< unsigned int > parent_
 Specifies diff distance to PSD. More...
 
vector< double > parentDist_
 Specifies direction of psd. Length ignored. More...
 
vector< CylBasepsd_
 
double surfaceGranularity_
 Ids of elec compts mapped to each voxel. More...
 
double thickness_
 Thickness of PSD. More...
 
vector< double > vs_
 

Detailed Description

The PsdMesh sets up the diffusion geometries for the PSD. It has to work in two contexts: first, as a PSD sitting on a spine head. Second, as a PSD sitting directly on the dendrite. In either case it is treated as a surface disc, not as a volume. On the dendrite this is a little strange conceptually (flat disc on round cylinder) but will do for now. Later can fine-tune the cap geometry.

In either case, the PsdMesh is filled by a message that contains information about the matching voxel index (either on spineMesh or NeuroMesh), the coordinates, the radial vector, and the diameter. The PsdMesh does not have any internal diffusion, and it expects to pass only N to the parent dendrite or spine.

Definition at line 27 of file PsdMesh.h.

Constructor & Destructor Documentation

PsdMesh::PsdMesh ( )

Definition at line 136 of file PsdMesh.cpp.

References psd_, and thickness_.

137  :
138  thickness_( 50.0e-9 ),
139  psd_( 1 ),
140  pa_( 1 ),
141  parentDist_( 1, 1e-6 ),
142  parent_( 1, 0 ),
143  surfaceGranularity_( 0.1 ),
144  vs_(1, 5.0e-21 ),
145  area_(1, 1.0e-13 ),
146  length_(1, 50.0e-9 )
147 {
148  const double defaultLength = 1e-6;
149  psd_[0].setDia( defaultLength );
150  psd_[0].setLength( thickness_ );
151  psd_[0].setNumDivs( 1 );
152  psd_[0].setIsCylinder( true );
153 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173
vector< double > area_
Vol.
Definition: PsdMesh.h:192
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > parentDist_
Specifies direction of psd. Length ignored.
Definition: PsdMesh.h:180
vector< double > vs_
Definition: PsdMesh.h:191
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181
double surfaceGranularity_
Ids of elec compts mapped to each voxel.
Definition: PsdMesh.h:189
vector< double > length_
area
Definition: PsdMesh.h:193
PsdMesh::PsdMesh ( const PsdMesh other)

Definition at line 155 of file PsdMesh.cpp.

156  :
157  psd_( other.psd_ ),
159 {;}
vector< CylBase > psd_
Definition: PsdMesh.h:178
double surfaceGranularity_
Ids of elec compts mapped to each voxel.
Definition: PsdMesh.h:189
PsdMesh::~PsdMesh ( )

Definition at line 161 of file PsdMesh.cpp.

162 {
163  ;
164 }

Member Function Documentation

void PsdMesh::buildStencil ( )

Definition at line 433 of file PsdMesh.cpp.

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

Referenced by updateCoords().

434 {
435  setStencilSize( psd_.size(), psd_.size() );
437 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
void innerResetStencil()
virtual func implemented here.
Definition: MeshCompt.cpp:49
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 PsdMesh::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 364 of file PsdMesh.cpp.

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

365 {
366  if ( fid < psd_.size() ) {
367  return getMeshEntryVolume( fid );
368  } else {
369  return MeshCompt::extendedMeshEntryVolume( fid - psd_.size() );
370  }
371 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: PsdMesh.cpp:309
double extendedMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry, including.
Definition: MeshCompt.cpp:36

+ Here is the call graph for this function:

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

Virtual function to return coords of mesh Entry.

Virtual function to return coords of mesh Entry. For PsdMesh, coords are x1y1z1 x2y2z2 dia

Implements ChemCompt.

Definition at line 331 of file PsdMesh.cpp.

References pa_, and psd_.

332 {
333  vector< double > ret;
334  ret.push_back( psd_[fid].getX() );
335  ret.push_back( psd_[fid].getY() );
336  ret.push_back( psd_[fid].getZ() );
337  ret.push_back( psd_[fid].getX() - pa_[fid].getX() );
338  ret.push_back( psd_[fid].getY() - pa_[fid].getY() );
339  ret.push_back( psd_[fid].getZ() - pa_[fid].getZ() );
340  ret.push_back( psd_[fid].getDia() );
341  return ret;
342 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > PsdMesh::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 345 of file PsdMesh.cpp.

References pa_, and psd_.

346 {
347  vector< double > ret;
348  assert( fid < psd_.size() );
349  ret.push_back( psd_[ fid ].getDiffusionArea( pa_[fid], 0 ) );
350 
351  return ret;
352 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > getDiffusionArea(unsigned int fid) const
Virtual function to return diffusion X-section area.
Definition: PsdMesh.cpp:345
vector< double > PsdMesh::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 357 of file PsdMesh.cpp.

358 {
359  return vector< double >( 2, 1.0 );
360 }
vector< Id > PsdMesh::getElecComptMap ( ) const

Definition at line 190 of file PsdMesh.cpp.

References elecCompt_.

Referenced by initCinfo().

191 {
192  return elecCompt_;
193 }
vector< Id > elecCompt_
Parent voxel index.
Definition: PsdMesh.h:182

+ Here is the caller graph for this function:

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

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

Definition at line 203 of file PsdMesh.cpp.

References elecCompt_.

Referenced by initCinfo().

204 {
205  vector< unsigned int > ret( elecCompt_.size() );
206  for ( unsigned int i = 0; i < ret.size(); ++i )
207  ret[i] = i+1;
208  return ret;
209 }
vector< Id > elecCompt_
Parent voxel index.
Definition: PsdMesh.h:182

+ Here is the caller graph for this function:

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

Virtual function to return dimensions of specified entry.

Implements ChemCompt.

Definition at line 303 of file PsdMesh.cpp.

304 {
305  return 2;
306 }
double PsdMesh::getMeshEntryVolume ( unsigned int  fid) const
virtual

Virtual function to return volume of mesh Entry.

Implements ChemCompt.

Definition at line 309 of file PsdMesh.cpp.

References pa_, psd_, and thickness_.

Referenced by extendedMeshEntryVolume(), handlePsdList(), and matchSpineMeshEntries().

310 {
311  if ( psd_.size() == 0 ) // Default for meshes before init.
312  return 1.0;
313  assert( fid < psd_.size() );
314  return thickness_ * psd_[ fid ].getDiffusionArea( pa_[fid], 0 );
315 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179

+ Here is the caller graph for this function:

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

Virtual function to return MeshType of specified entry.

Implements ChemCompt.

Definition at line 296 of file PsdMesh.cpp.

References DISK, and psd_.

297 {
298  assert( fid < psd_.size() );
299  return DISK;
300 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
Definition: MeshEntry.h:22
vector< unsigned int > PsdMesh::getNeuronVoxel ( ) const

Returns index of voxel on NeuroMesh to which this spine is connected. This isn't such a great function, as it only works if the spine is sitting directly on the NeuroMesh. Otherwise it returns the vector of voxels of parent spine heads, which isn't what the name indicates.

Definition at line 184 of file PsdMesh.cpp.

References parent_.

Referenced by initCinfo().

185 {
186  cout << "Warning: PsdMesh::getNeuronVoxel. Currently not working\n";
187  return parent_;
188 }
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181

+ Here is the caller graph for this function:

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

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

Implements MeshCompt.

Definition at line 542 of file PsdMesh.cpp.

References parent_.

543 {
544  vector< unsigned int > ret( parent_.size(), -1U );
545  return ret;
546  // return parent_;
547 }
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181
vector< unsigned int > PsdMesh::getStartVoxelInCompt ( ) const

Returns index of first voxel mapping to elec compt.

Definition at line 195 of file PsdMesh.cpp.

References elecCompt_.

Referenced by initCinfo().

196 {
197  vector< unsigned int > ret( elecCompt_.size() );
198  for ( unsigned int i = 0; i < ret.size(); ++i )
199  ret[i] = i;
200  return ret;
201 }
vector< Id > elecCompt_
Parent voxel index.
Definition: PsdMesh.h:182

+ Here is the caller graph for this function:

double PsdMesh::getThickness ( ) const

An assumed thickness for PSD. The volume is computed as the PSD area passed in to each PSD, times this value. Defaults to 50 nanometres. For reference, membranes are 5 nm.

Definition at line 169 of file PsdMesh.cpp.

References thickness_.

Referenced by initCinfo().

170 {
171  return thickness_;
172 }
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173

+ Here is the caller graph for this function:

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

Implements MeshCompt.

Definition at line 578 of file PsdMesh.cpp.

References area_.

579 {
580  return area_;
581 }
vector< double > area_
Vol.
Definition: PsdMesh.h:192
const vector< double > & PsdMesh::getVoxelLength ( ) const
virtual

Implements MeshCompt.

Definition at line 583 of file PsdMesh.cpp.

References length_.

584 {
585  return length_;
586 }
vector< double > length_
area
Definition: PsdMesh.h:193
void PsdMesh::handlePsdList ( const Eref e,
vector< double >  params,
vector< Id elecCompts,
vector< unsigned int >  parentVoxel 
)

Definition at line 227 of file PsdMesh.cpp.

References area_, elecCompt_, getMeshEntryVolume(), Eref::id(), length_, ChemCompt::lookupEntry(), pa_, parent_, parentDist_, psd_, thickness_, MeshEntry::triggerRemesh(), updateCoords(), Id::value(), and vs_.

Referenced by initCinfo().

235 {
236  double oldVol = getMeshEntryVolume( 0 );
237  assert( diskCoords.size() == 8 * parentVoxel.size() );
238  psd_.resize( parentVoxel.size() );
239  pa_.resize( parentVoxel.size() );
240  vs_.resize( parentVoxel.size() );
241  area_.resize( parentVoxel.size() );
242  length_.resize( parentVoxel.size() );
243  elecCompt_ = elecCompt;
244 
245  psd_.clear();
246  pa_.clear();
247  parentDist_.clear();
248  parent_.clear();
249  vector< double >::const_iterator x = diskCoords.begin();
250  for ( unsigned int i = 0; i < parentVoxel.size(); ++i ) {
251  double p = *x;
252  double q = *(x+1);
253  double r = *(x+2);
254 
255  psd_.push_back( CylBase( p, q, r, 1, 0, 1 ));
256  x += 3;
257  pa_.push_back( CylBase( p - *x, q - *(x+1), r - *(x+2), 1, 0, 1 ));
258  x += 3;
259  psd_.back().setDia( *x++ );
260  psd_.back().setIsCylinder( true );
261  // This is an entirely nominal
262  // length, so that the effective vol != 0.
263  psd_.back().setLength( thickness_ );
264 
265  parentDist_.push_back( *x++ );
266  vs_[i] = psd_.back().volume( psd_.back() );
267  area_[i] = psd_.back().getDiffusionArea( psd_.back(), 0 );
268  length_[i] = parentDist_.back();
269  }
270  parent_ = parentVoxel;
271 
272  updateCoords();
273 
274  Id meshEntry( e.id().value() + 1 );
275 
276  vector< unsigned int > localIndices( psd_.size() );
277  vector< double > vols( psd_.size() );
278  for ( unsigned int i = 0; i < psd_.size(); ++i ) {
279  localIndices[i] = i;
280  vols[i] = thickness_ * psd_[i].getDiffusionArea( pa_[i], 0 );
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 
288 }
Id id() const
Definition: Eref.cpp:62
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< Id > elecCompt_
Parent voxel index.
Definition: PsdMesh.h:182
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: PsdMesh.cpp:309
unsigned int value() const
Definition: Id.cpp:197
MeshEntry * lookupEntry(unsigned int index)
Definition: ChemCompt.cpp:379
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173
vector< double > area_
Vol.
Definition: PsdMesh.h:192
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > parentDist_
Specifies direction of psd. Length ignored.
Definition: PsdMesh.h:180
vector< double > vs_
Definition: PsdMesh.h:191
void updateCoords()
Definition: PsdMesh.cpp:216
void triggerRemesh(const Eref &e, double oldvol, unsigned int startEntry, const vector< unsigned int > &localIndices, const vector< double > &vols)
Definition: MeshEntry.cpp:267
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181
Definition: Id.h:17
vector< double > length_
area
Definition: PsdMesh.h:193

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PsdMesh::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 464 of file PsdMesh.cpp.

References innerGetNumEntries(), and psd_.

466 {
467  if ( index >= innerGetNumEntries() )
468  return;
469  x = psd_[index].getX();
470  y = psd_[index].getY();
471  z = psd_[index].getZ();
472 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
unsigned int innerGetNumEntries() const
Definition: PsdMesh.cpp:407

+ Here is the call graph for this function:

const Cinfo * PsdMesh::initCinfo ( )
static

Definition at line 28 of file PsdMesh.cpp.

References getElecComptMap(), getEndVoxelInCompt(), getNeuronVoxel(), getStartVoxelInCompt(), getThickness(), handlePsdList(), ChemCompt::initCinfo(), psdMeshCinfo, and setThickness().

29 {
31  // Field Definitions
33  static ValueFinfo< PsdMesh, double > thickness(
34  "thickness",
35  "An assumed thickness for PSD. The volume is computed as the"
36  "PSD area passed in to each PSD, times this value."
37  "defaults to 50 nanometres. For reference, membranes are 5 nm.",
40  );
41 
43  neuronVoxel
44  (
45  "neuronVoxel",
46  "Vector of indices of voxels on parent NeuroMesh, from which "
47  "the respective spines emerge.",
49  );
50 
51  static ReadOnlyValueFinfo< PsdMesh, vector< Id > > elecComptMap(
52  "elecComptMap",
53  "Vector of Ids of electrical compartments that map to each "
54  "voxel. This is necessary because the order of the IDs may "
55  "differ from the ordering of the voxels. Note that there "
56  "is always just one voxel per PSD. ",
58  );
59  static ReadOnlyValueFinfo< PsdMesh, vector< Id > > elecComptList(
60  "elecComptList",
61  "Vector of Ids of all electrical compartments in this "
62  "PsdMesh. Ordering is as per the tree structure built in "
63  "the NeuroMesh, and may differ from Id order. Ordering "
64  "matches that used for startVoxelInCompt and endVoxelInCompt",
66  );
67  static ReadOnlyValueFinfo< PsdMesh, vector< unsigned int > > startVoxelInCompt(
68  "startVoxelInCompt",
69  "Index of first voxel that maps to each electrical "
70  "compartment. This is a trivial function in the PsdMesh, as"
71  "we have a single voxel per spine. So just a vector of "
72  "its own indices.",
74  );
76  "endVoxelInCompt",
77  "Index of end voxel that maps to each electrical "
78  "compartment. Since there is just one voxel per electrical "
79  "compartment in the spine, this is just a vector of index+1",
81  );
82 
84  // MsgDest Definitions
86 
87  static DestFinfo psdList( "psdList",
88  "Specifies the geometry of the spine,"
89  "and the associated parent voxel"
90  "Arguments: "
91  "disk params vector with 8 entries per psd, "
92  "vector of Ids of electrical compts mapped to voxels, "
93  "parent voxel index ",
94  new EpFunc3< PsdMesh,
95  vector< double >,
96  vector< Id >,
97  vector< unsigned int > >(
99  );
100 
102  // Field Elements
104 
105  static Finfo* psdMeshFinfos[] = {
106  &thickness, // ValueFinfo
107  &neuronVoxel, // ReadOnlyValueFinfo
108  &elecComptMap, // ReadOnlyValueFinfo
109  &elecComptList, // ReadOnlyValueFinfo
110  &startVoxelInCompt, // ReadOnlyValueFinfo
111  &endVoxelInCompt, // ReadOnlyValueFinfo
112  &psdList, // DestFinfo
113  };
114 
115  static Dinfo< PsdMesh > dinfo;
116  static Cinfo psdMeshCinfo (
117  "PsdMesh",
119  psdMeshFinfos,
120  sizeof( psdMeshFinfos ) / sizeof ( Finfo* ),
121  &dinfo
122  );
123 
124  return &psdMeshCinfo;
125 }
static const Cinfo * initCinfo()
Definition: ChemCompt.cpp:25
vector< unsigned int > getNeuronVoxel() const
Definition: PsdMesh.cpp:184
static const Cinfo * psdMeshCinfo
Definition: PsdMesh.cpp:131
Definition: Dinfo.h:60
vector< unsigned int > getStartVoxelInCompt() const
Returns index of first voxel mapping to elec compt.
Definition: PsdMesh.cpp:195
Definition: EpFunc.h:95
double getThickness() const
Definition: PsdMesh.cpp:169
vector< unsigned int > getEndVoxelInCompt() const
Returns index of end voxel mapping to elec compt, just first+1.
Definition: PsdMesh.cpp:203
void handlePsdList(const Eref &e, vector< double > params, vector< Id > elecCompts, vector< unsigned int > parentVoxel)
Definition: PsdMesh.cpp:227
Definition: Cinfo.h:18
Definition: Finfo.h:12
void setThickness(double v)
Definition: PsdMesh.cpp:173
vector< Id > getElecComptMap() const
Definition: PsdMesh.cpp:190

+ Here is the call graph for this function:

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

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

Not permitted

Implements ChemCompt.

Definition at line 424 of file PsdMesh.cpp.

426 {
427  cout << "Warning: PsdMesh::innerBuildDefaultMesh: attempt to build a default psd: not permitted\n";
428 }
unsigned int PsdMesh::innerGetDimensions ( ) const
virtual

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

Implements ChemCompt.

Definition at line 221 of file PsdMesh.cpp.

222 {
223  return 2;
224 }
unsigned int PsdMesh::innerGetNumEntries ( ) const
virtual

Inherited virtual func. Returns number of MeshEntry in array

Implements ChemCompt.

Definition at line 407 of file PsdMesh.cpp.

References psd_.

Referenced by indexToSpace().

408 {
409  return psd_.size();
410 }
vector< CylBase > psd_
Definition: PsdMesh.h:178

+ Here is the caller graph for this function:

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

Implements ChemCompt.

Definition at line 388 of file PsdMesh.cpp.

391 {
392 }
void PsdMesh::innerHandleRequestMeshStats ( const Eref e,
const SrcFinfo2< unsigned int, vector< double > > *  meshStatsFinfo 
)

More inherited virtual funcs: request comes in for mesh stats Not clear what this does.

Definition at line 381 of file PsdMesh.cpp.

384 {
385  ;
386 }
void PsdMesh::innerSetNumEntries ( unsigned int  n)
virtual

Inherited virtual func.

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

Implements ChemCompt.

Definition at line 416 of file PsdMesh.cpp.

417 {
418 }
void PsdMesh::matchCubeMeshEntries ( const ChemCompt other,
vector< VoxelJunction > &  ret 
) const

Definition at line 520 of file PsdMesh.cpp.

References CylBase::matchCubeMeshEntries(), pa_, psd_, and surfaceGranularity_.

Referenced by matchMeshEntries().

522 {
523  for( unsigned int i = 0; i < psd_.size(); ++i ) {
524  const CylBase& cb = psd_[i];
525  cb.matchCubeMeshEntries( other, pa_[i],
526  i, surfaceGranularity_, ret, false, true );
527  }
528 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
void matchCubeMeshEntries(const ChemCompt *other, const CylBase &parent, unsigned int startIndex, double granularity, vector< VoxelJunction > &ret, bool useCylinderCurve, bool useCylinderCap) const
Definition: CylBase.cpp:320
double surfaceGranularity_
Ids of elec compts mapped to each voxel.
Definition: PsdMesh.h:189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PsdMesh::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 443 of file PsdMesh.cpp.

References matchCubeMeshEntries(), matchNeuroMeshEntries(), and matchSpineMeshEntries().

445 {
446  const SpineMesh* sm = dynamic_cast< const SpineMesh* >( other );
447  if ( sm ) {
448  matchSpineMeshEntries( other, ret );
449  return;
450  }
451  const CubeMesh* cm = dynamic_cast< const CubeMesh* >( other );
452  if ( cm ) {
453  matchCubeMeshEntries( other, ret );
454  return;
455  }
456  const NeuroMesh* nm = dynamic_cast< const NeuroMesh* >( other );
457  if ( nm ) {
458  matchNeuroMeshEntries( other, ret );
459  return;
460  }
461  cout << "Warning: PsdMesh::matchMeshEntries: unknown class\n";
462 }
void matchNeuroMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: PsdMesh.cpp:509
void matchCubeMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: PsdMesh.cpp:520
void matchSpineMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: PsdMesh.cpp:493

+ Here is the call graph for this function:

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

Definition at line 509 of file PsdMesh.cpp.

References pa_, parent_, parentDist_, and psd_.

Referenced by matchMeshEntries().

511 {
512  const NeuroMesh* nm = dynamic_cast< const NeuroMesh* >( other );
513  assert( nm );
514  for ( unsigned int i = 0; i < psd_.size(); ++i ) {
515  double xda = psd_[i].getDiffusionArea( pa_[i], 0) / parentDist_[i];
516  ret.push_back( VoxelJunction( i, parent_[i], xda ) );
517  }
518 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > parentDist_
Specifies direction of psd. Length ignored.
Definition: PsdMesh.h:180
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181

+ Here is the caller graph for this function:

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

Definition at line 493 of file PsdMesh.cpp.

References getMeshEntryVolume(), SpineMesh::getMeshEntryVolume(), pa_, parent_, parentDist_, and psd_.

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

495 {
496  const SpineMesh* sm = dynamic_cast< const SpineMesh* >( other );
497  assert( sm );
498  for ( unsigned int i = 0; i < psd_.size(); ++i ) {
499  double xda = psd_[i].getDiffusionArea( pa_[i], 0 ) / parentDist_[i];
500  ret.push_back( VoxelJunction( i, parent_[i], xda ) );
501  ret.back().firstVol = getMeshEntryVolume( i );
502  ret.back().secondVol = sm->getMeshEntryVolume( parent_[i] );
503  }
504 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: SpineMesh.cpp:307
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: PsdMesh.cpp:309
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
vector< double > parentDist_
Specifies direction of psd. Length ignored.
Definition: PsdMesh.h:180
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double PsdMesh::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 474 of file PsdMesh.cpp.

References Vec::distance(), and psd_.

476 {
477  double best = 1e12;
478  index = 0;
479  for( unsigned int i = 0; i < psd_.size(); ++i ) {
480  Vec a( psd_[i].getX(), psd_[i].getY(), psd_[i].getZ() );
481  Vec b( x, y, z );
482  double d = a.distance( b );
483  if ( best > d ) {
484  best = d;
485  index = i;
486  }
487  }
488  if ( best == 1e12 )
489  return -1;
490  return best;
491 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
Definition: Vec.h:13

+ Here is the call graph for this function:

unsigned int PsdMesh::parent ( unsigned int  index) const

Return voxel# on parent compartment on spine or dendrite. For now PSD is always on spine, so it just returns the index.

Definition at line 395 of file PsdMesh.cpp.

References parent_.

396 {
397  if ( i < parent_.size() )
398  return parent_[i];
399  cout << "Error: PsdMesh::parent: Index " << i << " out of range: " <<
400  parent_.size() << "\n";
401  return 0;
402 }
vector< unsigned int > parent_
Specifies diff distance to PSD.
Definition: PsdMesh.h:181
void PsdMesh::setMeshEntryVolume ( unsigned int  fid,
double  volume 
)
virtual

Virtual function to set volume of mesh Entry.

Virtual function to assign volume of mesh Entry. Thickness not touched.

Reimplemented from ChemCompt.

Definition at line 318 of file PsdMesh.cpp.

References area_, PI, psd_, thickness_, and vs_.

319 {
320  if ( psd_.size() == 0 ) // Default for meshes before init.
321  return;
322  assert( fid < psd_.size() );
323  vs_[fid] = volume;
324  area_[fid] = volume / thickness_;
325  double dia = 2.0 * sqrt( area_[fid] / PI );
326  psd_[ fid ].setDia( dia );
327 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173
vector< double > area_
Vol.
Definition: PsdMesh.h:192
vector< double > vs_
Definition: PsdMesh.h:191
const double PI
Definition: consts.cpp:12
void PsdMesh::setThickness ( double  v)

Definition at line 173 of file PsdMesh.cpp.

References thickness_.

Referenced by initCinfo().

174 {
175  thickness_ = v;
176 }
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173

+ Here is the caller graph for this function:

void PsdMesh::transmitChange ( const Eref e)
void PsdMesh::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 216 of file PsdMesh.cpp.

References buildStencil().

Referenced by handlePsdList().

217 {
218  buildStencil();
219 }
void buildStencil()
Definition: PsdMesh.cpp:433

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double PsdMesh::vGetEntireVolume ( ) const
virtual

Inherited virtual func.

Implements ChemCompt.

Definition at line 588 of file PsdMesh.cpp.

References vs_.

Referenced by vSetVolumeNotRates().

589 {
590  double ret = 0.0;
591  for ( vector< double >::const_iterator i =
592  vs_.begin(); i != vs_.end(); ++i )
593  ret += *i;
594  return ret;
595 }
vector< double > vs_
Definition: PsdMesh.h:191

+ Here is the caller graph for this function:

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

Virtual func so that derived classes can return voxel midpoint.

Implements ChemCompt.

Definition at line 561 of file PsdMesh.cpp.

References pa_, and psd_.

562 {
563  static vector< double > midpoint;
564  midpoint.resize( psd_.size() * 3 );
565  vector< double >::iterator k = midpoint.begin();
566  for ( unsigned int i = 0; i < psd_.size(); ++i ) {
567  vector< double > coords =
568  psd_[i].getCoordinates( pa_[i], 0 );
569  *k = ( coords[0] + coords[3] ) / 2.0;
570  *(k + psd_.size() ) = ( coords[1] + coords[4] ) / 2.0;
571  *(k + 2 * psd_.size() ) = ( coords[2] + coords[5] ) / 2.0;
572  k++;
573  // cout << i << " " << coords[0] << " " << coords[3]<< " " << coords[1]<< " " << coords[4]<< " " << coords[2]<< " " << coords[5] << " " << coords[6] << endl;
574  }
575  return midpoint;
576 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
vector< CylBase > pa_
Specified disk of psd.
Definition: PsdMesh.h:179
const vector< double > & PsdMesh::vGetVoxelVolume ( ) const
virtual

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

Implements ChemCompt.

Definition at line 549 of file PsdMesh.cpp.

References vs_.

550 {
551  return vs_;
552 }
vector< double > vs_
Definition: PsdMesh.h:191
bool PsdMesh::vSetVolumeNotRates ( double  volume)
virtual

Inherited virtual func.

Implements ChemCompt.

Definition at line 597 of file PsdMesh.cpp.

References area_, length_, psd_, thickness_, vGetEntireVolume(), and vs_.

598 {
599  double volscale = volume / vGetEntireVolume();
600  double linscale = pow( volscale, 1.0/3.0 );
601  assert( vs_.size() == psd_.size() );
602  assert( area_.size() == psd_.size() );
603  assert( length_.size() == psd_.size() );
604  thickness_ *= linscale;
605  for ( unsigned int i = 0; i < psd_.size(); ++i ) {
606  psd_[i].setLength( psd_[i].getLength() * linscale );
607  psd_[i].setDia( psd_[i].getDia() * linscale );
608  vs_[i] *= volscale;
609  area_[i] *= linscale * linscale;
610  length_[i] *= linscale;
611  }
612  return true;
613 }
vector< CylBase > psd_
Definition: PsdMesh.h:178
double thickness_
Thickness of PSD.
Definition: PsdMesh.h:173
vector< double > area_
Vol.
Definition: PsdMesh.h:192
double vGetEntireVolume() const
Inherited virtual func.
Definition: PsdMesh.cpp:588
vector< double > vs_
Definition: PsdMesh.h:191
vector< double > length_
area
Definition: PsdMesh.h:193

+ Here is the call graph for this function:

Member Data Documentation

vector< double > PsdMesh::area_
private

Vol.

Definition at line 192 of file PsdMesh.h.

Referenced by getVoxelArea(), handlePsdList(), setMeshEntryVolume(), and vSetVolumeNotRates().

vector< Id > PsdMesh::elecCompt_
private

Parent voxel index.

Definition at line 182 of file PsdMesh.h.

Referenced by getElecComptMap(), getEndVoxelInCompt(), getStartVoxelInCompt(), and handlePsdList().

vector< double > PsdMesh::length_
private

area

Definition at line 193 of file PsdMesh.h.

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

vector< CylBase > PsdMesh::pa_
private
vector< unsigned int > PsdMesh::parent_
private

Specifies diff distance to PSD.

Definition at line 181 of file PsdMesh.h.

Referenced by getNeuronVoxel(), getParentVoxel(), handlePsdList(), matchNeuroMeshEntries(), matchSpineMeshEntries(), and parent().

vector< double > PsdMesh::parentDist_
private

Specifies direction of psd. Length ignored.

Definition at line 180 of file PsdMesh.h.

Referenced by handlePsdList(), matchNeuroMeshEntries(), and matchSpineMeshEntries().

double PsdMesh::surfaceGranularity_
private

Ids of elec compts mapped to each voxel.

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 189 of file PsdMesh.h.

Referenced by matchCubeMeshEntries().

double PsdMesh::thickness_
private
vector< double > PsdMesh::vs_
private

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