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

#include <CylBase.h>

+ Inheritance diagram for CylBase:
+ Collaboration diagram for CylBase:

Public Member Functions

 CylBase (double x, double y, double z, double dia, double length, unsigned int numDivs)
 
 CylBase ()
 
vector< double > getCoordinates (const CylBase &parent, unsigned int entry) const
 
double getDia () const
 
double getDiffusionArea (const CylBase &parent, unsigned int index) const
 
bool getIsCylinder () const
 
double getLength () const
 
double getMiddleArea (const CylBase &parent, unsigned int index) const
 Return cross-section area of middle of specified voxel. More...
 
unsigned int getNumDivs () const
 
double getVoxelLength () const
 Return length of voxel. All are equal. More...
 
double getX () const
 
double getY () const
 
double getZ () const
 
void matchCubeMeshEntries (const ChemCompt *other, const CylBase &parent, unsigned int startIndex, double granularity, vector< VoxelJunction > &ret, bool useCylinderCurve, bool useCylinderCap) const
 
double nearest (double x, double y, double z, const CylBase &parent, double &linePos, double &r) const
 
double nearest (double x, double y, double z, const CylBase &parent, unsigned int &index) const
 
double selectGridSize (double h, double dia1, double granularity) const
 
void setDia (double v)
 
void setIsCylinder (bool v)
 
void setLength (double v)
 
void setNumDivs (unsigned int v)
 
void setX (double v)
 
void setY (double v)
 
void setZ (double v)
 
double volume (const CylBase &parent) const
 Returns vol of current node. Usually needs to refer to parent. More...
 
double voxelVolume (const CylBase &parent, unsigned int fid) const
 

Private Attributes

double dia_
 
bool isCylinder_
 Number of subdivisions of cylinder. More...
 
double length_
 Diameter of node end. More...
 
unsigned int numDivs_
 Length of compartment. More...
 
double x_
 end of the node. The start is given by parent coords. More...
 
double y_
 
double z_
 

Detailed Description

Base class for cylinder calculations.

Definition at line 17 of file CylBase.h.

Constructor & Destructor Documentation

CylBase::CylBase ( double  x,
double  y,
double  z,
double  dia,
double  length,
unsigned int  numDivs 
)

Definition at line 26 of file CylBase.cpp.

28  :
29  x_( x ),
30  y_( y ),
31  z_( z ),
32  dia_( dia ),
33  length_( length ),
34  numDivs_( numDivs ),
35  isCylinder_( false )
36 {
37  ;
38 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
double z_
Definition: CylBase.h:105
double y_
Definition: CylBase.h:104
CylBase::CylBase ( )

Definition at line 40 of file CylBase.cpp.

41  :
42  x_( 0.0 ),
43  y_( 0.0 ),
44  z_( 0.0 ),
45  dia_( 1.0 ),
46  length_( 1.0 ),
47  numDivs_( 1.0 ),
48  isCylinder_( false )
49 {
50  ;
51 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
double z_
Definition: CylBase.h:105
double y_
Definition: CylBase.h:104

Member Function Documentation

vector< double > CylBase::getCoordinates ( const CylBase parent,
unsigned int  fid 
) const

Returns a vector with the coordinates of the specified MeshEntry. The MeshEntry (entry argument) is a voxel within this CylBase, 'entry' is indexed from 0 to numDivs. The parent is the parent CylBase with its own set of coords. The function does interpolation from the ends of the Node. These are detailed coordinates representative of the shape of the MeshEntry. For cylinders it is x1y1z1 x2y2z2 r0 r1 phi0 phi1 For spheres it is xyzdia.

Virtual function to return coords of mesh Entry. For Cylindrical mesh, coords are x1y1z1 x2y2z2 r0 r1 phi0 phi1

Definition at line 172 of file CylBase.cpp.

References dia_, numDivs_, x_, y_, and z_.

Referenced by NeuroMesh::vGetVoxelMidpoint().

174 {
175  assert( numDivs_ > fid );
176  double frac0 = ( static_cast< double >( fid ) ) /
177  static_cast< double >( numDivs_ );
178  double frac1 = ( static_cast< double >( fid + 1 ) ) /
179  static_cast< double >( numDivs_ );
180 
181  double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 );
182  // equivalent: double r0 = parent.dia_ + frac0 * ( dia_ - parent.dia_ );
183  double r1 = 0.5 * ( parent.dia_ * ( 1.0 - frac1 ) + dia_ * frac1 );
184 
185  vector< double > ret( 10, 0.0 );
186  ret[0] = parent.x_ + frac0 * ( x_ - parent.x_ );
187  ret[1] = parent.y_ + frac0 * ( y_ - parent.y_ );
188  ret[2] = parent.z_ + frac0 * ( z_ - parent.z_ );
189  ret[3] = parent.x_ + frac1 * ( x_ - parent.x_ );
190  ret[4] = parent.y_ + frac1 * ( y_ - parent.y_ );
191  ret[5] = parent.z_ + frac1 * ( z_ - parent.z_ );
192  ret[6] = r0;
193  ret[7] = r1;
194  ret[8] = 0;
195  ret[9] = 0;
196 
197  return ret;
198 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103
double dia_
Definition: CylBase.h:107
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
double z_
Definition: CylBase.h:105
double y_
Definition: CylBase.h:104

+ Here is the caller graph for this function:

double CylBase::getDia ( ) const

Definition at line 88 of file CylBase.cpp.

References dia_.

Referenced by NeuroNode::findStartNode(), SpineEntry::psdCoords(), SpineEntry::rootArea(), SpineEntry::setVolume(), and NeuroMesh::vSetVolumeNotRates().

89 {
90  return dia_;
91 }
double dia_
Definition: CylBase.h:107

+ Here is the caller graph for this function:

double CylBase::getDiffusionArea ( const CylBase parent,
unsigned int  fid 
) const

Returns diffusion cross-section from specified index to next. For index 0, this is cross-section to parent. For index numDivs-1, it is the cross-section from the second-last to the last voxel in this CylBase. Thus there is no valid value for (index == numDivs - 1), it has to be computed external to the CylBase, typically by calling the getDiffusionArea for the child CylBase.

Returns diffusion cross-section from specified index to previous. For index 0, this is cross-section area of parent. For index numDivs-1, it is the cross-section from the second-last to the last voxel in this CylBase. For index numDivs it is the area of this CylBase. Thus there is no valid value for (index > numDivs), it has to be computed external to the CylBase, typically by calling the getDiffusionArea for the child CylBase.

Definition at line 210 of file CylBase.cpp.

References dia_, isCylinder_, numDivs_, and PI.

Referenced by NeuroMesh::getAdx().

212 {
213  assert( fid < numDivs_ + 1 );
214  if ( isCylinder_ )
215  return PI * dia_ * dia_ / 4.0;
216  double frac0 = ( static_cast< double >( fid ) ) /
217  static_cast< double >( numDivs_ );
218  double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 );
219  return PI * r0 * r0;
220 }
const double PI
Definition: consts.cpp:12
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

bool CylBase::getIsCylinder ( ) const

Definition at line 118 of file CylBase.cpp.

References isCylinder_.

119 {
120  return isCylinder_;
121 }
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
double CylBase::getLength ( ) const

Definition at line 98 of file CylBase.cpp.

References length_.

Referenced by NeuroNode::calculateLength(), SpineEntry::diffusionLength(), NeuroMesh::getAdx(), SpineEntry::setVolume(), and NeuroMesh::vSetVolumeNotRates().

99 {
100  return length_;
101 }
double length_
Diameter of node end.
Definition: CylBase.h:108

+ Here is the caller graph for this function:

double CylBase::getMiddleArea ( const CylBase parent,
unsigned int  index 
) const

Return cross-section area of middle of specified voxel.

Return the cross section area of the middle of the specified voxel.

Definition at line 223 of file CylBase.cpp.

References dia_, isCylinder_, numDivs_, and PI.

Referenced by NeuroMesh::updateCoords().

225 {
226  assert( fid < numDivs_ );
227  if ( isCylinder_ )
228  return PI * dia_ * dia_ / 4.0;
229  double frac0 = ( 0.5 + static_cast< double >( fid ) ) /
230  static_cast< double >( numDivs_ );
231  double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 );
232  return PI * r0 * r0;
233 }
const double PI
Definition: consts.cpp:12
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

unsigned int CylBase::getNumDivs ( ) const

Definition at line 108 of file CylBase.cpp.

References numDivs_.

Referenced by NeuroMesh::getAdx(), NeuroMesh::indexToSpace(), NeuroNode::isDummyNode(), NeuroMesh::nearest(), NeuroMesh::updateCoords(), and NeuroMesh::vGetVoxelMidpoint().

109 {
110  return numDivs_;
111 }
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

double CylBase::getVoxelLength ( ) const

Return length of voxel. All are equal.

Definition at line 235 of file CylBase.cpp.

References length_, and numDivs_.

Referenced by NeuroMesh::updateCoords().

236 {
237  return length_ / numDivs_;
238 }
double length_
Diameter of node end.
Definition: CylBase.h:108
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

double CylBase::getX ( ) const

Definition at line 58 of file CylBase.cpp.

References x_.

Referenced by NeuroNode::calculateLength(), NeuroMesh::indexToSpace(), SpineEntry::mid(), SpineEntry::positionShaftBase(), SpineEntry::psdCoords(), SpineEntry::setVolume(), and NeuroMesh::updateShaftParents().

59 {
60  return x_;
61 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103

+ Here is the caller graph for this function:

double CylBase::getY ( ) const

Definition at line 68 of file CylBase.cpp.

References y_.

Referenced by NeuroNode::calculateLength(), NeuroMesh::indexToSpace(), SpineEntry::mid(), SpineEntry::positionShaftBase(), SpineEntry::psdCoords(), SpineEntry::setVolume(), and NeuroMesh::updateShaftParents().

69 {
70  return y_;
71 }
double y_
Definition: CylBase.h:104

+ Here is the caller graph for this function:

double CylBase::getZ ( ) const

Definition at line 78 of file CylBase.cpp.

References z_.

Referenced by NeuroNode::calculateLength(), NeuroMesh::indexToSpace(), SpineEntry::mid(), SpineEntry::positionShaftBase(), SpineEntry::psdCoords(), SpineEntry::setVolume(), and NeuroMesh::updateShaftParents().

79 {
80  return z_;
81 }
double z_
Definition: CylBase.h:105

+ Here is the caller graph for this function:

void CylBase::matchCubeMeshEntries ( const ChemCompt other,
const CylBase parent,
unsigned int  startIndex,
double  granularity,
vector< VoxelJunction > &  ret,
bool  useCylinderCurve,
bool  useCylinderCap 
) const

Definition at line 320 of file CylBase.cpp.

References Vec::a0(), Vec::a1(), Vec::a2(), dia_, EPSILON, fillPointsOnCircle(), fillPointsOnDisc(), CubeMesh::getDx(), ChemCompt::getNumEntries(), isCylinder_, length_, numDivs_, Vec::orthogonalAxes(), selectGridSize(), x_, y_, and z_.

Referenced by SpineEntry::matchCubeMeshEntries(), PsdMesh::matchCubeMeshEntries(), NeuroMesh::matchCubeMeshEntries(), SpineEntry::matchCubeMeshEntriesToHead(), and SpineEntry::matchCubeMeshEntriesToPSD().

326 {
327  const CubeMesh* other = dynamic_cast< const CubeMesh* >( compt );
328  assert( other );
329  const double EPSILON = 1e-18;
330  Vec a( parent.x_ - x_, parent.y_ - y_, parent.z_ - z_ );
331  Vec u;
332  Vec v;
333  a.orthogonalAxes( u, v );
334 
335  double h = selectGridSize( other->getDx(), parent.dia_/2, granularity );
336  double lambda = length_ / numDivs_;
337 
338  unsigned int num = floor( 0.1 + lambda / h );
339  // March along axis of cylinder.
340  // q is the location of the point along axis.
341  double rSlope = ( dia_ - parent.dia_ ) * 0.5 / length_;
342  for ( unsigned int i = 0; i < numDivs_; ++i ) {
343  vector< double >area( other->getNumEntries(), 0.0 );
344  if ( useCylinderCurve ) {
345  for ( unsigned int j = 0; j < num; ++j ) {
346  unsigned int m = i * num + j;
347  double frac = ( m * h + h/2.0 ) / length_;
348  double q0 = x_ + a.a0() * frac;
349  double q1 = y_ + a.a1() * frac;
350  double q2 = z_ + a.a2() * frac;
351  // get radius of cylinder at this point.
352  double r = dia_/2.0;
353  if ( !isCylinder_ ) // Use the more complicated conic value
354  r = parent.dia_/2.0 + frac * rSlope;
355  fillPointsOnCircle( u, v, Vec( q0, q1, q2 ),
356  h, r, area, other );
357  }
358  }
359  if ( useCylinderCap && i == numDivs_ - 1 ) {
360  fillPointsOnDisc( u, v, Vec( x_, y_, z_ ),
361  h, dia_/2.0, area, other );
362  }
363  // Go through all cubeMesh entries and compute diffusion
364  // cross-section. Assume this is through a membrane, so the
365  // only factor relevant is area. Not the distance.
366  for ( unsigned int k = 0; k < area.size(); ++k ) {
367  if ( area[k] > EPSILON ) {
368  ret.push_back( VoxelJunction( i + startIndex, k, area[k] ));
369  }
370  }
371  }
372 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103
static void fillPointsOnDisc(const Vec &u, const Vec &v, const Vec &q, double h, double r, vector< double > &area, const CubeMesh *other)
Definition: CylBase.cpp:291
static void fillPointsOnCircle(const Vec &u, const Vec &v, const Vec &q, double h, double r, vector< double > &area, const CubeMesh *other)
Definition: CylBase.cpp:263
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
double getDx() const
Definition: CubeMesh.cpp:507
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int getNumEntries() const
Definition: ChemCompt.cpp:390
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
Definition: Vec.h:13
double z_
Definition: CylBase.h:105
double y_
Definition: CylBase.h:104
void orthogonalAxes(Vec &u, Vec &v) const
Generates vectors u and v to form a mutually orthogonal system.
Definition: Vec.cpp:41
#define EPSILON
Definition: MatrixOps.h:28
double selectGridSize(double h, double dia1, double granularity) const
Definition: CylBase.cpp:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double CylBase::nearest ( double  x,
double  y,
double  z,
const CylBase parent,
double &  linePos,
double &  r 
) const

Definition at line 378 of file CylBase.cpp.

References dia_, Vec::distance(), EPSILON, numDivs_, Vec::pointOnLine(), x_, y_, and z_.

Referenced by nearest(), NeuroMesh::nearest(), and NeuroMesh::updateShaftParents().

381 {
382  const double EPSILON = 1e-8; // 10 nm is too small for any compt.
383  // Consider a = parent and b = self, and c = x,y,z.
384  // Fraction along cylinder axis ab = k
385  // k = (c - a).(b - a)/((b-a).(b-a))
386  //
387  // Then, point p along line from parent to self is
388  // p = k( self-parent) + parent.
389  //
390  // So distance from c to p is what we want.
391  //
392  // If k is
393  //
394  Vec a( parent.x_, parent.y_, parent.z_ );
395  Vec b( x_, y_, z_ );
396  Vec c( x, y, z );
397 
398  double dist = b.distance( a );
399  assert( dist > EPSILON );
400  double k = ( b - a ).dotProduct( c - a );
401  k /= dist * dist;
402  Vec pt = a.pointOnLine( b, k );
403 
404  double ret = c.distance(pt);
405  linePos = k;
406  // For now I disable the positioning with a tapering cylinder.
407  // double rSlope = 0.5 * ( dia_ - parent.dia_ ) / numDivs_;
408  double rSlope = 0;
409  r = dia_/2.0 + k * numDivs_ * rSlope;
410  return ret;
411 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103
double dia_
Definition: CylBase.h:107
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
Definition: Vec.h:13
double distance(const Vec &other) const
Definition: Vec.cpp:81
double z_
Definition: CylBase.h:105
double y_
Definition: CylBase.h:104
#define EPSILON
Definition: MatrixOps.h:28
Vec pointOnLine(const Vec &end, double k)
Definition: Vec.cpp:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double CylBase::nearest ( double  x,
double  y,
double  z,
const CylBase parent,
unsigned int &  index 
) const

Definition at line 414 of file CylBase.cpp.

References nearest(), and numDivs_.

417 {
418  double k = 0.0;
419  double r;
420  double ret = nearest( x, y, z, parent, k, r );
421  if ( k < 0.0 ) {
422  ret = -ret;
423  index = 0;
424  } else if ( k > 1.0 ) {
425  ret = -ret;
426  index = numDivs_ - 1;
427  } else { // Inside length of cylinder, now is it inside radius?
428  index = k * numDivs_;
429  if ( index >= numDivs_ )
430  index = numDivs_ - 1;
431  // double ri = r0_ + (index + 0.5) * rSlope_;
432  if ( ret > r * 1.01 ) // Handle roundoff
433  ret = -ret;
434  }
435  return ret;
436 }
double nearest(double x, double y, double z, const CylBase &parent, double &linePos, double &r) const
Definition: CylBase.cpp:378
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the call graph for this function:

double CylBase::selectGridSize ( double  h,
double  dia1,
double  granularity 
) const

Utility commands for building interface to cube mesh

Definition at line 242 of file CylBase.cpp.

References dia_, length_, and numDivs_.

Referenced by matchCubeMeshEntries().

244 {
245  if ( length_ < 1e-7 && numDivs_ == 1 ) { // It is a disc, not a cylinder
246  return granularity * dia_ / 2.0;
247  }
248 
249  double lambda = length_ / numDivs_;
250  if ( h > lambda )
251  h = lambda;
252  if ( h > dia_ / 2.0 )
253  h = dia_ / 2.0;
254  if ( h > dia1/2.0 )
255  h = dia1/2.0;
256  h *= granularity;
257  unsigned int num = ceil( lambda / h );
258  h = lambda / num;
259 
260  return h;
261 }
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

void CylBase::setDia ( double  v)

Definition at line 83 of file CylBase.cpp.

References dia_.

Referenced by NeuroNode::NeuroNode(), SpineEntry::setVolume(), SpineEntry::SpineEntry(), and NeuroMesh::vSetVolumeNotRates().

84 {
85  dia_ = v;
86 }
double dia_
Definition: CylBase.h:107

+ Here is the caller graph for this function:

void CylBase::setIsCylinder ( bool  v)

Definition at line 113 of file CylBase.cpp.

References isCylinder_.

Referenced by NeuroMesh::insertSingleDummy(), and SpineEntry::SpineEntry().

114 {
115  isCylinder_ = v;
116 }
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110

+ Here is the caller graph for this function:

void CylBase::setLength ( double  v)

Definition at line 93 of file CylBase.cpp.

References length_.

Referenced by NeuroNode::calculateLength(), NeuroNode::NeuroNode(), SpineEntry::setVolume(), SpineEntry::SpineEntry(), and NeuroMesh::vSetVolumeNotRates().

94 {
95  length_ = v;
96 }
double length_
Diameter of node end.
Definition: CylBase.h:108

+ Here is the caller graph for this function:

void CylBase::setNumDivs ( unsigned int  v)

Definition at line 103 of file CylBase.cpp.

References numDivs_.

Referenced by NeuroMesh::insertSingleDummy(), and SpineEntry::SpineEntry().

104 {
105  numDivs_ = v;
106 }
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109

+ Here is the caller graph for this function:

void CylBase::setX ( double  v)

Definition at line 53 of file CylBase.cpp.

References x_.

Referenced by NeuroMesh::insertSingleDummy(), NeuroNode::NeuroNode(), SpineEntry::positionShaftBase(), SpineEntry::setVolume(), and SpineEntry::SpineEntry().

54 {
55  x_ = v;
56 }
double x_
end of the node. The start is given by parent coords.
Definition: CylBase.h:103

+ Here is the caller graph for this function:

void CylBase::setY ( double  v)

Definition at line 63 of file CylBase.cpp.

References y_.

Referenced by NeuroMesh::insertSingleDummy(), NeuroNode::NeuroNode(), SpineEntry::positionShaftBase(), SpineEntry::setVolume(), and SpineEntry::SpineEntry().

64 {
65  y_ = v;
66 }
double y_
Definition: CylBase.h:104

+ Here is the caller graph for this function:

void CylBase::setZ ( double  v)

Definition at line 73 of file CylBase.cpp.

References z_.

Referenced by NeuroMesh::insertSingleDummy(), NeuroNode::NeuroNode(), SpineEntry::positionShaftBase(), SpineEntry::setVolume(), and SpineEntry::SpineEntry().

74 {
75  z_ = v;
76 }
double z_
Definition: CylBase.h:105

+ Here is the caller graph for this function:

double CylBase::volume ( const CylBase parent) const

Returns vol of current node. Usually needs to refer to parent.

The entire volume for a truncated cone is given by: V = 1/3 pi.length.(r0^2 + r0.r1 + r1^2) where the length is the length of the cone r0 is radius at base r1 is radius at top. Note that this converges to volume of a cone if r0 or r1 is zero, and to the volume of a cylinder if r0 == r1.

Definition at line 135 of file CylBase.cpp.

References dia_, isCylinder_, length_, and PI.

Referenced by SpineEntry::setVolume(), SpineEntry::volume(), and NeuroMesh::vSetVolumeNotRates().

136 {
137  if ( isCylinder_ )
138  return length_ * dia_ * dia_ * PI / 4.0;
139  double r0 = parent.dia_/2.0;
140  double r1 = dia_/2.0;
141  return length_ * ( r0*r0 + r0 *r1 + r1 * r1 ) * PI / 3.0;
142 }
const double PI
Definition: consts.cpp:12
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110

+ Here is the caller graph for this function:

double CylBase::voxelVolume ( const CylBase parent,
unsigned int  fid 
) const

Returns volume of specified voxel (MeshEntry)

Returns volume of MeshEntry. This isn't the best subdivision of the cylinder from the viewpoint of keeping the length constants all the same for different volumes. Ideally the thinner segments should have a smaller length. But this is simple and so is the diffusion calculation, so leave it. Easy to fine-tune later by modifying how one computes frac0 and frac1.

Definition at line 152 of file CylBase.cpp.

References dia_, isCylinder_, length_, numDivs_, PI, and s0.

Referenced by NeuroMesh::updateCoords().

153 {
154  assert( numDivs_ > fid );
155  if ( isCylinder_ )
156  return length_ * dia_ * dia_ * PI / ( 4.0 * numDivs_ );
157 
158  double frac0 = ( static_cast< double >( fid ) ) /
159  static_cast< double >( numDivs_ );
160  double frac1 = ( static_cast< double >( fid + 1 ) ) /
161  static_cast< double >( numDivs_ );
162  double r0 = 0.5 * ( parent.dia_ * ( 1.0 - frac0 ) + dia_ * frac0 );
163  double r1 = 0.5 * ( parent.dia_ * ( 1.0 - frac1 ) + dia_ * frac1 );
164  double s0 = length_ * frac0;
165  double s1 = length_ * frac1;
166 
167  return (s1 - s0) * ( r0*r0 + r0 *r1 + r1 * r1 ) * PI / 3.0;
168 }
const double PI
Definition: consts.cpp:12
double length_
Diameter of node end.
Definition: CylBase.h:108
double dia_
Definition: CylBase.h:107
bool isCylinder_
Number of subdivisions of cylinder.
Definition: CylBase.h:110
unsigned int numDivs_
Length of compartment.
Definition: CylBase.h:109
static SrcFinfo0 s0("s0","")

+ Here is the caller graph for this function:

Member Data Documentation

double CylBase::dia_
private
bool CylBase::isCylinder_
private

Number of subdivisions of cylinder.

Definition at line 110 of file CylBase.h.

Referenced by getDiffusionArea(), getIsCylinder(), getMiddleArea(), matchCubeMeshEntries(), setIsCylinder(), volume(), and voxelVolume().

double CylBase::length_
private

Diameter of node end.

Definition at line 108 of file CylBase.h.

Referenced by getLength(), getVoxelLength(), matchCubeMeshEntries(), selectGridSize(), setLength(), volume(), and voxelVolume().

unsigned int CylBase::numDivs_
private
double CylBase::x_
private

end of the node. The start is given by parent coords.

Definition at line 103 of file CylBase.h.

Referenced by getCoordinates(), getX(), matchCubeMeshEntries(), nearest(), and setX().

double CylBase::y_
private

Definition at line 104 of file CylBase.h.

Referenced by getCoordinates(), getY(), matchCubeMeshEntries(), nearest(), and setY().

double CylBase::z_
private

Definition at line 105 of file CylBase.h.

Referenced by getCoordinates(), getZ(), matchCubeMeshEntries(), nearest(), and setZ().


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