MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NeuroMesh.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2012 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _NEURO_MESH_H
11 #define _NEURO_MESH_H
12 
31 class NeuroMesh: public MeshCompt
32 {
33  public:
34  NeuroMesh();
35  NeuroMesh( const NeuroMesh& other );
36  ~NeuroMesh();
37  NeuroMesh& operator=( const NeuroMesh& other );
39  // Utility func
41 
46  void updateCoords();
47 
49  // Field assignment stuff
51 
61  void setSubTreePath( const Eref& e, string path );
62  string getSubTreePath( const Eref& e ) const;
63 
69  void setSubTree( const Eref& e, vector< ObjId > compartments );
70  vector< ObjId > getSubTree( const Eref& e ) const;
71 
76  void transmitSpineInfo( const Eref& e );
77 
78 
85  void setSeparateSpines( bool v );
86  bool getSeparateSpines() const;
87 
88  unsigned int getNumSegments() const;
89  unsigned int getNumDiffCompts() const;
90 
91  void setDiffLength( double v );
92  double getDiffLength() const;
93 
94  void setGeometryPolicy( string v );
95  string getGeometryPolicy() const;
96 
97  unsigned int innerGetDimensions() const;
98 
99  vector< Id > getElecComptList() const;
100  vector< Id > getElecComptMap() const;
101  vector< unsigned int > getStartVoxelInCompt() const;
102  vector< unsigned int > getEndVoxelInCompt() const;
103  vector< int > getSpineVoxelOnDendVoxel() const;
104  vector< unsigned int > getDendVoxelsOnCompartment( ObjId compt ) const;
105  vector< unsigned int > getSpineVoxelsOnCompartment( ObjId compt ) const;
106 
107  vector< unsigned int > getParentVoxel() const;
108  const vector< double >& vGetVoxelVolume() const;
109  const vector< double >& vGetVoxelMidpoint() const;
110  const vector< double >& getVoxelArea() const;
111  const vector< double >& getVoxelLength() const;
112 
114  // FieldElement assignment stuff for MeshEntries
116 
118  unsigned int getMeshType( unsigned int fid ) const;
120  unsigned int getMeshDimensions( unsigned int fid ) const;
122  double getMeshEntryVolume( unsigned int fid ) const;
124  vector< double > getCoordinates( unsigned int fid ) const;
126  vector< double > getDiffusionArea( unsigned int fid ) const;
128  vector< double > getDiffusionScaling( unsigned int fid ) const;
130  double extendedMeshEntryVolume( unsigned int fid ) const;
131 
133 
136  unsigned int innerGetNumEntries() const;
138  void innerSetNumEntries( unsigned int n );
139 
145  double vGetEntireVolume() const;
146 
156  bool vSetVolumeNotRates( double volume );
157 
159  // Dest funcs
161 
163  void innerBuildDefaultMesh( const Eref& e,
164  double size, unsigned int numEntries );
165 
167  const Eref& e,
168  const SrcFinfo2< unsigned int, vector< double > >*
169  meshStatsFinfo
170  );
171 
172  void innerHandleNodeInfo(
173  const Eref& e,
174  unsigned int numNodes, unsigned int numThreads );
175 
176  // void transmitChange( const Eref& e, double oldVol );
177 
183  double getAdx( unsigned int curr, unsigned int& parentFid ) const;
184 
186  void buildStencil();
187 
189  // inherited virtual funcs for Boundary
191 
192  void matchMeshEntries( const ChemCompt* other,
193  vector< VoxelJunction > & ret ) const;
194 
195  void matchCubeMeshEntries( const ChemCompt* other,
196  vector< VoxelJunction > & ret ) const;
197 
198  void matchNeuroMeshEntries( const ChemCompt* other,
199  vector< VoxelJunction > & ret ) const;
200 
209  double nearest( double x, double y, double z,
210  unsigned int& index ) const;
211 
212  void indexToSpace( unsigned int index,
213  double& x, double& y, double& z ) const;
214 
215 
217  // Utility functions for building tree.
219 
224  void insertSingleDummy( unsigned int parent, unsigned int self,
225  double x, double y, double z );
226 
230  void insertDummyNodes();
231 
233  Id putSomaAtStart( Id origSoma, unsigned int maxDiaIndex );
234 
239  void buildNodeTree( const map< Id, unsigned int >& comptMap );
240 
248  bool filterSpines( Id compt );
253  void updateShaftParents();
254 
256  // Utility functions for testing
257  // const Stencil* getStencil() const;
258  const vector< NeuroNode >& getNodes() const;
259 
261  static const Cinfo* initCinfo();
262 
263  private:
270  vector< NeuroNode > nodes_;
271 
277  string subTreePath_;
278 
287  vector< unsigned int > nodeIndex_;
288 
294  vector< double > vs_;
295 
300  vector< double > area_;
301 
303  vector< double > length_;
304 
305  // double size_; /// Total Volume
306  double diffLength_;
307 
315 
317 
324 
329  vector< Id > shaft_;
330  vector< Id > head_;
331  vector< unsigned int > parent_;
332 
336  vector< unsigned int > parentVoxel_;
337 };
338 
339 
340 #endif // _NEURO_MESH_H
vector< double > getDiffusionScaling(unsigned int fid) const
Virtual function to return scale factor for diffusion. 1 here.
Definition: NeuroMesh.cpp:956
const vector< double > & vGetVoxelVolume() const
Virtual func so that derived classes can pass voxel volume back.
Definition: NeuroMesh.cpp:814
vector< Id > head_
Id of shaft compartment.
Definition: NeuroMesh.h:330
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: NeuroMesh.cpp:906
void setDiffLength(double v)
Definition: NeuroMesh.cpp:399
vector< Id > shaft_
Definition: NeuroMesh.h:329
vector< int > getSpineVoxelOnDendVoxel() const
Definition: NeuroMesh.cpp:774
void insertDummyNodes()
Definition: NeuroMesh.cpp:530
void matchCubeMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: NeuroMesh.cpp:1329
bool separateSpines_
Max permitted length constant for diffusion.
Definition: NeuroMesh.h:314
void indexToSpace(unsigned int index, double &x, double &y, double &z) const
Definition: NeuroMesh.cpp:1283
void setGeometryPolicy(string v)
Definition: NeuroMesh.cpp:410
double getDiffLength() const
Definition: NeuroMesh.cpp:405
vector< unsigned int > getEndVoxelInCompt() const
Definition: NeuroMesh.cpp:762
vector< double > getCoordinates(unsigned int fid) const
Virtual function to return coords of mesh Entry.
Definition: NeuroMesh.cpp:923
unsigned int getMeshType(unsigned int fid) const
Virtual function to return MeshType of specified entry.
Definition: NeuroMesh.cpp:889
vector< Id > getElecComptMap() const
Definition: NeuroMesh.cpp:726
Definition: ObjId.h:20
unsigned int getMeshDimensions(unsigned int fid) const
Virtual function to return dimensions of specified entry.
Definition: NeuroMesh.cpp:900
unsigned int getNumDiffCompts() const
Definition: NeuroMesh.cpp:716
const int numEntries
Definition: proc.cpp:60
vector< unsigned int > getStartVoxelInCompt() const
Definition: NeuroMesh.cpp:750
unsigned int innerGetDimensions() const
Definition: NeuroMesh.cpp:441
const vector< double > & getVoxelArea() const
Definition: NeuroMesh.cpp:845
vector< unsigned int > getSpineVoxelsOnCompartment(ObjId compt) const
Definition: NeuroMesh.cpp:802
vector< double > vs_
Definition: NeuroMesh.h:294
vector< double > getDiffusionArea(unsigned int fid) const
Virtual function to return diffusion X-section area.
Definition: NeuroMesh.cpp:936
void transmitSpineInfo(const Eref &e)
Definition: NeuroMesh.cpp:591
vector< unsigned int > getDendVoxelsOnCompartment(ObjId compt) const
Definition: NeuroMesh.cpp:785
vector< Id > getElecComptList() const
Definition: NeuroMesh.cpp:738
string getSubTreePath(const Eref &e) const
Definition: NeuroMesh.cpp:688
vector< ObjId > getSubTree(const Eref &e) const
Definition: NeuroMesh.cpp:670
void buildNodeTree(const map< Id, unsigned int > &comptMap)
const vector< double > & getVoxelLength() const
Definition: NeuroMesh.cpp:850
const vector< double > & vGetVoxelMidpoint() const
Virtual func so that derived classes can return voxel midpoint.
Definition: NeuroMesh.cpp:819
void updateCoords()
Definition: NeuroMesh.cpp:343
void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
Definition: NeuroMesh.cpp:1001
NeuroMesh & operator=(const NeuroMesh &other)
Definition: NeuroMesh.cpp:316
vector< unsigned int > getParentVoxel() const
Definition: NeuroMesh.cpp:721
void setSeparateSpines(bool v)
Definition: NeuroMesh.cpp:693
vector< double > length_
Pre-calculation of length of each MeshEntry.
Definition: NeuroMesh.h:303
Definition: Eref.h:26
void innerHandleRequestMeshStats(const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo)
bool vSetVolumeNotRates(double volume)
Definition: NeuroMesh.cpp:864
void insertSingleDummy(unsigned int parent, unsigned int self, double x, double y, double z)
Definition: NeuroMesh.cpp:503
double extendedMeshEntryVolume(unsigned int fid) const
Vol of all mesh Entries including abutting diff-coupled voxels.
Definition: NeuroMesh.cpp:971
void updateShaftParents()
Definition: NeuroMesh.cpp:620
void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: NeuroMesh.cpp:1251
unsigned int getNumSegments() const
Definition: NeuroMesh.cpp:707
void innerBuildDefaultMesh(const Eref &e, double size, unsigned int numEntries)
Virtual func to make a mesh with specified size and numEntries.
Definition: NeuroMesh.cpp:1078
static unsigned int numNodes
double diffLength_
Definition: NeuroMesh.h:306
void setSubTree(const Eref &e, vector< ObjId > compartments)
Definition: NeuroMesh.cpp:650
string geometryPolicy_
Definition: NeuroMesh.h:316
vector< unsigned int > parentVoxel_
Index of parent voxel of spines.
Definition: NeuroMesh.h:336
const vector< NeuroNode > & getNodes() const
Definition: NeuroMesh.cpp:1242
double vGetEntireVolume() const
Definition: NeuroMesh.cpp:855
vector< unsigned int > parent_
Id of head compartment.
Definition: NeuroMesh.h:331
Definition: Id.h:17
unsigned int innerGetNumEntries() const
Definition: NeuroMesh.cpp:1030
double nearest(double x, double y, double z, unsigned int &index) const
Definition: NeuroMesh.cpp:1299
void setSubTreePath(const Eref &e, string path)
Definition: NeuroMesh.cpp:680
double surfaceGranularity_
Definition: NeuroMesh.h:323
Id putSomaAtStart(Id origSoma, unsigned int maxDiaIndex)
This shuffles the nodes_ vector to put soma node at the start.
Definition: NeuroMesh.cpp:468
void buildStencil()
Utility function to set up Stencil for diffusion in NeuroMesh.
Definition: NeuroMesh.cpp:1166
void matchNeuroMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: NeuroMesh.cpp:1345
static const Cinfo * initCinfo()
Definition: NeuroMesh.cpp:66
string getGeometryPolicy() const
Definition: NeuroMesh.cpp:436
string subTreePath_
Definition: NeuroMesh.h:277
Definition: Cinfo.h:18
static char path[]
Definition: mfield.cpp:403
bool filterSpines(Id compt)
Definition: NeuroMesh.cpp:573
vector< NeuroNode > nodes_
Definition: NeuroMesh.h:270
void innerSetNumEntries(unsigned int n)
Inherited virtual func.
Definition: NeuroMesh.cpp:1040
double getAdx(unsigned int curr, unsigned int &parentFid) const
Definition: NeuroMesh.cpp:1126
bool getSeparateSpines() const
Definition: NeuroMesh.cpp:702
vector< unsigned int > nodeIndex_
Definition: NeuroMesh.h:287
vector< double > area_
Definition: NeuroMesh.h:300