MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReadSwc.cpp File Reference
#include "header.h"
#include "../shell/Shell.h"
#include "../utility/Vec.h"
#include "SwcSegment.h"
#include "ReadSwc.h"
#include "CompartmentBase.h"
#include "Compartment.h"
#include "SymCompartment.h"
#include <fstream>
+ Include dependency graph for ReadSwc.cpp:

Go to the source code of this file.

Functions

static Id makeCompt (Id parent, const SwcSegment &seg, const SwcSegment &pa, double RM, double RA, double CM, unsigned int i, unsigned int j)
 

Variables

static const double MinRadius = 0.04
 

Function Documentation

static Id makeCompt ( Id  parent,
const SwcSegment seg,
const SwcSegment pa,
double  RM,
double  RA,
double  CM,
unsigned int  i,
unsigned int  j 
)
static

Definition at line 211 of file ReadSwc.cpp.

References Vec::a0(), Vec::a1(), Vec::a2(), Eref::data(), SwcSegment::distance(), Shell::doCreate(), Id::eref(), name, SwcSegment::parent(), PI, SwcSegment::radius(), moose::CompartmentBase::setCm(), moose::CompartmentBase::setDiameter(), moose::CompartmentBase::setLength(), moose::CompartmentBase::setRa(), moose::CompartmentBase::setRm(), moose::CompartmentBase::setX(), moose::CompartmentBase::setX0(), moose::CompartmentBase::setY(), moose::CompartmentBase::setY0(), moose::CompartmentBase::setZ(), moose::CompartmentBase::setZ0(), SwcSegment::type(), SwcSegment::typeName, and SwcSegment::vec().

Referenced by ReadSwc::build().

215 {
216  Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
217  double len = seg.radius() * 2.0;
218  string name = "soma";
219  Id compt;
220  double x0, y0, z0;
221  if ( seg.parent() != ~0U ) {
222  len = seg.distance( pa );
223  stringstream ss;
224  ss << SwcSegment::typeName[ seg.type() ] << "_" << i << "_" << j;
225  name = ss.str();
226  x0 = pa.vec().a0();
227  y0 = pa.vec().a1();
228  z0 = pa.vec().a2();
229  } else {
230  x0 = seg.vec().a0() - len;
231  y0 = seg.vec().a1();
232  z0 = seg.vec().a2();
233  }
234  assert( len > 0.0 );
235  compt = shell->doCreate( "Compartment", parent, name, 1 );
236  Eref er = compt.eref();
237  moose::CompartmentBase *cptr = reinterpret_cast< moose::CompartmentBase* >(
238  compt.eref().data() );
239  double xa = seg.radius() * seg.radius() * PI * 1e-12;
240  len *= 1e-6;
241  double dia = seg.radius() * 2.0e-6;
242  cptr->setRm( er, RM / ( len * dia * PI ) );
243  cptr->setRa( er, RA * len / xa );
244  cptr->setCm( er, CM * ( len * dia * PI ) );
245  cptr->setDiameter( dia );
246  cptr->setLength( len );
247  cptr->setX0( x0 * 1e-6 );
248  cptr->setY0( y0 * 1e-6 );
249  cptr->setZ0( z0 * 1e-6 );
250  cptr->setX( seg.vec().a0() * 1e-6 );
251  cptr->setY( seg.vec().a1() * 1e-6 );
252  cptr->setZ( seg.vec().a2() * 1e-6 );
253  return compt;
254 }
void setX(double value)
char * data() const
Definition: Eref.cpp:41
double a0() const
Definition: Vec.h:34
unsigned short type() const
Definition: SwcSegment.h:72
void setZ(double value)
void setLength(double length)
unsigned int parent() const
Definition: SwcSegment.h:44
double a2() const
Definition: Vec.h:40
Eref eref() const
Definition: Id.cpp:125
Id doCreate(string type, ObjId parent, string name, unsigned int numData, NodePolicy nodePolicy=MooseBlockBalance, unsigned int preferredNode=1)
Definition: Shell.cpp:181
void setCm(const Eref &e, double Cm)
Definition: Eref.h:26
double distance(const SwcSegment &other) const
Definition: SwcSegment.h:87
double radius() const
Definition: SwcSegment.h:76
void setZ0(double value)
static char name[]
Definition: mfield.cpp:401
const double PI
Definition: consts.cpp:12
void setDiameter(double diameter)
const Vec & vec() const
Definition: SwcSegment.h:91
Definition: Id.h:17
double a1() const
Definition: Vec.h:37
void setRa(const Eref &e, double Ra)
static const string typeName[]
Definition: SwcSegment.h:137
void setX0(double value)
void setRm(const Eref &e, double Rm)
Definition: Shell.h:43
void setY0(double value)
void setY(double value)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const double MinRadius = 0.04
static

Definition at line 22 of file ReadSwc.cpp.

Referenced by ReadSwc::validate().