MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CylMesh.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) 2011 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 _CYL_MESH_H
11 #define _CYL_MESH_H
12 
19 class CylMesh: public MeshCompt
20 {
21  public:
22  CylMesh();
23  ~CylMesh();
25  // Utility func
27 
32  void updateCoords( const Eref& e, const vector< double >& childConcs );
33 
35  // Field assignment stuff
37 
38  void setX0( const Eref& e, double v );
39  double getX0( const Eref& e ) const;
40  void setY0( const Eref& e, double v );
41  double getY0( const Eref& e ) const;
42  void setZ0( const Eref& e, double v );
43  double getZ0( const Eref& e ) const;
44  void setR0( const Eref& e, double v );
45  double getR0( const Eref& e ) const;
46 
47  void setX1( const Eref& e, double v );
48  double getX1( const Eref& e ) const;
49  void setY1( const Eref& e, double v );
50  double getY1( const Eref& e ) const;
51  void setZ1( const Eref& e, double v );
52  double getZ1( const Eref& e ) const;
53  void setR1( const Eref& e, double v );
54  double getR1( const Eref& e ) const;
55 
56  void innerSetCoords( const Eref& e, const vector< double >& v);
57  void setCoords( const Eref& e, vector< double > v );
58  vector< double > getCoords( const Eref& e ) const;
59 
60  void setDiffLength( const Eref& e, double v );
61  double getDiffLength( const Eref& e ) const;
62 
63  double getTotLength() const;
64 
65  unsigned int innerGetDimensions() const;
66 
68  // FieldElement assignment stuff for MeshEntries
70 
72  unsigned int getMeshType( unsigned int fid ) const;
74  unsigned int getMeshDimensions( unsigned int fid ) const;
76  double getMeshEntryVolume( unsigned int fid ) const;
78  vector< double > getCoordinates( unsigned int fid ) const;
80  vector< double > getDiffusionArea( unsigned int fid ) const;
82  vector< double > getDiffusionScaling( unsigned int fid ) const;
84  double extendedMeshEntryVolume( unsigned int fid ) const;
85 
87 
91  unsigned int innerGetNumEntries() const;
93  void innerSetNumEntries( unsigned int n );
94 
96  vector< unsigned int > getParentVoxel() const;
97  const vector< double >& vGetVoxelVolume() const;
98  const vector< double >& vGetVoxelMidpoint() const;
99  const vector< double >& getVoxelArea() const;
100  const vector< double >& getVoxelLength() const;
101 
103  double vGetEntireVolume() const;
104 
106  bool vSetVolumeNotRates( double volume );
108  // Dest funcs
110 
112  void innerBuildDefaultMesh( const Eref& e,
113  double volume, unsigned int numEntries );
114 
116  const Eref& e,
117  const SrcFinfo2< unsigned int, vector< double > >*
118  meshStatsFinfo
119  );
120 
121  void innerHandleNodeInfo(
122  const Eref& e,
123  unsigned int numNodes, unsigned int numThreads );
124 
125  void transmitChange( const Eref& e );
126 
127  void buildStencil();
128 
130  // inherited virtual funcs for Boundary
132 
133  void matchMeshEntries( const ChemCompt* other,
134  vector< VoxelJunction > & ret ) const;
135 
136  double nearest( double x, double y, double z,
137  unsigned int& index ) const;
138 
139  double nearest( double x, double y, double z,
140  double& linePos, double& r ) const;
141 
142  void indexToSpace( unsigned int index,
143  double& x, double& y, double& z ) const;
144 
146  // Inner specific functions needed by matchMeshEntries.
148  void matchCylMeshEntries( const CylMesh* other,
149  vector< VoxelJunction >& ret ) const;
150  void matchCubeMeshEntries( const CubeMesh* other,
151  vector< VoxelJunction >& ret ) const;
152  void matchNeuroMeshEntries( const NeuroMesh* other,
153  vector< VoxelJunction >& ret ) const;
154 
155  // Selects a grid volume for generating intersection with CubeMesh.
156  double selectGridVolume( double h ) const;
157 
159 
160  static const Cinfo* initCinfo();
161 
162  private:
163  unsigned int numEntries_; // Number of subdivisions to use
164  bool useCaps_; // Flag: Should the ends have hemispherical caps?
165  bool isToroid_; // Flag: Should the ends loop around mathemagically?
166 
167  double x0_;
168  double y0_;
169  double z0_;
170 
171  double x1_;
172  double y1_;
173  double z1_;
174 
175  double r0_;
176  double r1_;
177 
178  double diffLength_;
179 
186 
187  double totLen_;
188  double rSlope_;
189  double lenSlope_;
190 };
191 
192 #endif // _CYL_MESH_H
double surfaceGranularity_
Length constant for diffusion. Equal to dx.
Definition: CylMesh.h:185
vector< double > getDiffusionArea(unsigned int fid) const
Virtual function to return diffusion X-section area.
Definition: CylMesh.cpp:520
void updateCoords(const Eref &e, const vector< double > &childConcs)
Definition: CylMesh.cpp:205
double nearest(double x, double y, double z, unsigned int &index) const
Definition: CylMesh.cpp:1075
double getY0(const Eref &e) const
Definition: CylMesh.cpp:259
unsigned int numEntries_
Definition: CylMesh.h:163
static const Cinfo * initCinfo()
Definition: CylMesh.cpp:27
vector< double > getCoordinates(unsigned int fid) const
Virtual function to return coords of mesh Entry.
Definition: CylMesh.cpp:489
unsigned int getMeshType(unsigned int fid) const
Virtual function to return MeshType of specified entry.
Definition: CylMesh.cpp:421
double x0_
Definition: CylMesh.h:167
void innerHandleNodeInfo(const Eref &e, unsigned int numNodes, unsigned int numThreads)
Definition: CylMesh.cpp:591
void setDiffLength(const Eref &e, double v)
Definition: CylMesh.cpp:392
void transmitChange(const Eref &e)
Definition: CylMesh.cpp:741
void indexToSpace(unsigned int index, double &x, double &y, double &z) const
Definition: CylMesh.cpp:1026
const int numEntries
Definition: proc.cpp:60
void setY1(const Eref &e, double v)
Definition: CylMesh.cpp:304
vector< double > getCoords(const Eref &e) const
Definition: CylMesh.cpp:372
double r1_
Radius at one end.
Definition: CylMesh.h:176
double y1_
coords
Definition: CylMesh.h:172
double z0_
coords
Definition: CylMesh.h:169
bool isToroid_
Definition: CylMesh.h:165
CylMesh()
Definition: CylMesh.cpp:169
double getTotLength() const
Definition: CylMesh.cpp:406
unsigned int innerGetNumEntries() const
Definition: CylMesh.cpp:615
void innerHandleRequestMeshStats(const Eref &e, const SrcFinfo2< unsigned int, vector< double > > *meshStatsFinfo)
More inherited virtual funcs: request comes in for mesh stats.
Definition: CylMesh.cpp:583
double getX1(const Eref &e) const
Definition: CylMesh.cpp:299
unsigned int getMeshDimensions(unsigned int fid) const
Virtual function to return dimensions of specified entry.
Definition: CylMesh.cpp:430
double lenSlope_
Utility value: dr/dx.
Definition: CylMesh.h:189
void setZ0(const Eref &e, double v)
Definition: CylMesh.cpp:264
double getMeshEntryVolume(unsigned int fid) const
Virtual function to return volume of mesh Entry.
Definition: CylMesh.cpp:477
void matchNeuroMeshEntries(const NeuroMesh *other, vector< VoxelJunction > &ret) const
Definition: CylMesh.cpp:1021
~CylMesh()
Definition: CylMesh.cpp:191
void setX0(const Eref &e, double v)
Definition: CylMesh.cpp:238
void innerSetNumEntries(unsigned int n)
Inherited virtual func.
Definition: CylMesh.cpp:623
void matchMeshEntries(const ChemCompt *other, vector< VoxelJunction > &ret) const
Definition: CylMesh.cpp:827
void setX1(const Eref &e, double v)
Definition: CylMesh.cpp:291
double getR1(const Eref &e) const
Definition: CylMesh.cpp:338
const vector< double > & getVoxelArea() const
Definition: CylMesh.cpp:694
bool useCaps_
Definition: CylMesh.h:164
void setR0(const Eref &e, double v)
Definition: CylMesh.cpp:277
double r0_
coords
Definition: CylMesh.h:175
double extendedMeshEntryVolume(unsigned int fid) const
Volume of mesh Entry including abutting diff-coupled voxels.
Definition: CylMesh.cpp:569
Definition: Eref.h:26
double getR0(const Eref &e) const
Definition: CylMesh.cpp:285
vector< double > getDiffusionScaling(unsigned int fid) const
Virtual function to return scale factor for diffusion. 1 here.
Definition: CylMesh.cpp:556
void buildStencil()
Definition: CylMesh.cpp:785
double rSlope_
Utility value: Total length of cylinder.
Definition: CylMesh.h:188
double getZ0(const Eref &e) const
Definition: CylMesh.cpp:272
bool vSetVolumeNotRates(double volume)
Inherited virtual. Resizes len and dia of each voxel.
Definition: CylMesh.cpp:722
double totLen_
Definition: CylMesh.h:187
vector< unsigned int > getParentVoxel() const
Inherited virtual, do nothing for now.
Definition: CylMesh.cpp:656
double getY1(const Eref &e) const
Definition: CylMesh.cpp:312
double x1_
coords
Definition: CylMesh.h:171
static unsigned int numNodes
const vector< double > & vGetVoxelMidpoint() const
Virtual func so that derived classes can return voxel midpoint.
Definition: CylMesh.cpp:676
double z1_
coords
Definition: CylMesh.h:173
double diffLength_
Radius at other end.
Definition: CylMesh.h:178
void setR1(const Eref &e, double v)
Definition: CylMesh.cpp:330
void matchCubeMeshEntries(const CubeMesh *other, vector< VoxelJunction > &ret) const
Definition: CylMesh.cpp:983
double getX0(const Eref &e) const
Definition: CylMesh.cpp:246
const vector< double > & getVoxelLength() const
Definition: CylMesh.cpp:707
const vector< double > & vGetVoxelVolume() const
Virtual func so that derived classes can pass voxel volume back.
Definition: CylMesh.cpp:667
double y0_
coords
Definition: CylMesh.h:168
void setY0(const Eref &e, double v)
Definition: CylMesh.cpp:251
void setZ1(const Eref &e, double v)
Definition: CylMesh.cpp:317
double getDiffLength(const Eref &e) const
Definition: CylMesh.cpp:400
double vGetEntireVolume() const
Inherited virtual. Returns entire volume of compartment.
Definition: CylMesh.cpp:714
void matchCylMeshEntries(const CylMesh *other, vector< VoxelJunction > &ret) const
Definition: CylMesh.cpp:861
void innerBuildDefaultMesh(const Eref &e, double volume, unsigned int numEntries)
Virtual func to make a mesh with specified Volume and numEntries.
Definition: CylMesh.cpp:641
unsigned int innerGetDimensions() const
Definition: CylMesh.cpp:411
void setCoords(const Eref &e, vector< double > v)
Definition: CylMesh.cpp:363
Definition: Cinfo.h:18
double getZ1(const Eref &e) const
Definition: CylMesh.cpp:325
double selectGridVolume(double h) const
Definition: CylMesh.cpp:940
void innerSetCoords(const Eref &e, const vector< double > &v)
Definition: CylMesh.cpp:343