//	This program demonstrates Cylinder and Injector by creating//	a single compartment with an injected current.  Reproduces//	_Genesis_ script "tutorial2.g".// include the necessary header files#include <stdio.h>			// for printf function#include "Cylinder.h"		// for cylindrical compartment#include "Injector.h"		// for current injection// define some global paramaters -- all in SI unitsreal RM = 0.33333;		// specific membrane resistance (ohm m^2)real CM = 0.01;			// specific membrane capacitance (farad/m^2)real RA = 0.3;			// specific axial resistance (ohms m)real EREST = -0.07;		// resting membrane potential (volts)real ELEAK = EREST + 0.0106;	// "leak" potential (volts)real SOMA_L = 30E-6;	// cylinder length (m)real SOMA_D = 30E-6;	// cylinder diameter (m)real TMAX = 0.050;		// simulation time (sec)real DT = 0.0025;		// simulation time step (sec)Cylinder *MakeDemoSoma( void ){	// create cylinder by radius and length	Cylinder *soma = new Cylinder(SOMA_D/2, SOMA_L);	// copy membrane parameters from global variables	soma->SetE( ELEAK );	soma->SetRm( RM );	soma->SetCm( CM );	soma->SetRa( RA );		soma->SetV( ELEAK );		// start at rest	return soma;}main( void ){	// create the soma	Cylinder *soma = MakeDemoSoma();		// provide a current injection of 0.3 nA	Injector inject( soma, 0.3E-9 );		// run the simulation	printf( "%4s\t%8s\n", "msec", "mV");	for (real t=0; t<TMAX; t += DT) {		printf( "%4.1f\t%8.4f\n", t*1000, soma->GetV()*1000 );		gStepmaster.StepAll(DT);	}		return 1;}
