Exemple #1
0
psection()
{
	Section *sec;
	Prop *p, *p1;
	
	sec = chk_access();
	p = sec->prop;
	Printf("%s {", secname(sec));
	Printf(" nseg=%d  L=%g  Ra=%g", sec->nnode - 1, section_length(sec),
		nrn_ra(sec));
	if (p->dparam[4].val != 1) {
		Printf(" rallbranch=%g", p->dparam[4].val);
	}
	Printf("\n");
	if (sec->parentsec) {
		Printf("	%s ",secname(sec->parentsec));
		Printf("connect %s (%g), %g\n",	secname(sec),
			p->dparam[3].val, p->dparam[1].val);
	} else {
		v_setup_vectors();
		/*SUPPRESS 440*/
		Printf("	/*location %g attached to cell %d*/\n",
			p->dparam[3].val, sec->parentnode->v_node_index);
	}
	if (sec->nnode) {
		/*SUPPRESS 440*/
		Printf("	/* First segment only */\n");
		p1 = sec->pnode[0]->prop;
		pnode(p1);
	}
	Printf("}\n");
	ret(1.);
}
Exemple #2
0
batch_run() /* avoid interpreter overhead */
{
	double tstop, tstep, tnext;
	char* filename;
	char* comment;

	tstopunset;
	tstop = chkarg(1,0.,1e20);
	tstep = chkarg(2, 0., 1e20);
	if (ifarg(3)) {
		filename = gargstr(3);
	}else{
		filename = 0;
	}
	if (ifarg(4)) {
		comment = gargstr(4);
	}else{
		comment = "";
	}
	
	if (tree_changed) {
		setup_topology();
	}
#if VECTORIZE
	if (v_structure_change) {
		v_setup_vectors();
	}
#endif
	batch_open(filename, tstop, tstep, comment);
	batch_out();
	if (cvode_active_) {
		while (t < tstop) {
			cvode_fadvance(t+tstep);
			batch_out();
		}
	}else{
		tstep -= dt/4.;
		tstop -= dt/4.;
		tnext = t + tstep;
		while (t < tstop) {
			nrn_fixed_step();
			if (t > tnext) {
				batch_out();
				tnext = t + tstep;
			}
			if (stoprun) { tstopunset; break; }
		}
	}
	batch_close();
	ret(1.);
}
Exemple #3
0
void NonLinImp::compute(double omega, double deltafac, int maxiter) {
	v_setup_vectors();
	nrn_rhs(nrn_threads);
	if (rep_ && rep_->scnt_ != structure_change_cnt) {
		delete rep_;
		rep_ = NULL;
	}
	if (!rep_) {
		rep_ = new NonLinImpRep();
	}
	rep_->maxiter_ = maxiter;
	if (rep_->neq_ == 0) { return; }
	if (nrndae_extra_eqn_count() > 0) {
		hoc_execerror("Impedance calculation with LinearMechanism not implemented", 0);
	}
	if (nrn_threads->_ecell_memb_list) {
		hoc_execerror("Impedance calculation with extracellular not implemented", 0);
	}

	rep_->omega_ = 1000.* omega;
	rep_->delta(deltafac);
	// fill matrix
	cmplx_spClear(rep_->m_);
	rep_->didv();
	rep_->dsds();
#if 1	// when 0 equivalent to standard method
 	rep_->dids();
	rep_->dsdv();
#endif
	
//	cmplx_spPrint(rep_->m_, 0, 1, 1);
//	for (int i=0; i < rep_->neq_; ++i) {
//		printf("i=%d %g %g\n", i, rep_->diag_[i][0], rep_->diag_[i][1]);
//	}
	int e = cmplx_spFactor(rep_->m_);
	switch (e) {
	case spZERO_DIAG:
		hoc_execerror("cmplx_spFactor error:", "Zero Diagonal");
	case spNO_MEMORY:
		hoc_execerror("cmplx_spFactor error:", "No Memory");
	case spSINGULAR:
		hoc_execerror("cmplx_spFactor error:", "Singular");
	}  

	rep_->iloc_ = -2;
}
Exemple #4
0
fcurrent()
{
	int i;
	if (tree_changed) {
		setup_topology();
	}
	if (v_structure_change) {
		v_setup_vectors();
	}
	if (diam_changed) {
		recalc_diam();
	}

	dt2thread(-1.);
	nrn_thread_table_check();
	state_discon_allowed_ = 0;
	nrn_multithread_job(setup_tree_matrix);
	state_discon_allowed_ = 1;
	ret(1.);
}
Exemple #5
0
fadvance()
{
	tstopunset;
#if CVODE
	if (cvode_active_) {
		cvode_fadvance(-1.);
		tstopunset;
		ret(1.);
		return;
	}
#endif
	if (tree_changed) {
		setup_topology();
	}
	if (v_structure_change) {
		v_setup_vectors();
	}
	if (diam_changed) {
		recalc_diam();
	}
	nrn_fixed_step();
	tstopunset;
	ret(1.);
}