Esempio n. 1
0
/**
 * In this destructor we need to put messages back to process,
 * and we need to replace the SolveFinfos on zombies with the
 * original ThisFinfo. This should really just use the clearFunc.
 */
void HSolveHub::destroy( const Conn* c )
{
	static Finfo* origCompartmentFinfo =
		const_cast< Finfo* >(
			initCompartmentCinfo()->getThisFinfo() );
	static Finfo* origHHChannelFinfo =
		const_cast< Finfo* >(
			initHHChannelCinfo()->getThisFinfo() );
	
	Element* hub = c->target().e;
	unsigned int eIndex = c->target().i;

	Conn* i = hub->targets( compartmentSolveFinfo->msg(), eIndex );
	while ( i->good() ) {
		i->target().e->setThisFinfo( origCompartmentFinfo );
		i->increment();
	}
	delete i;

	i = hub->targets( hhchannelSolveFinfo->msg(), eIndex );
	while ( i->good() ) {
		i->target().e->setThisFinfo( origHHChannelFinfo );
		i->increment();
	}
	delete i;

	Neutral::destroy( c );
}
Esempio n. 2
0
Finfo* initCompartmentZombieFinfo()
{
	static Finfo* compartmentFields[] =
	{
		new ValueFinfo( "Vm",
			ValueFtype1< double >::global(),
			GFCAST( &HSolveHub::getVm ),
			RFCAST( &HSolveHub::setVm )
		),
		new ValueFinfo( "Im",
			ValueFtype1< double >::global(),
			GFCAST( &HSolveHub::getIm ),
			&dummyFunc
		),
		new ValueFinfo( "inject",
			ValueFtype1< double >::global(),
			GFCAST( &HSolveHub::getInject ),
			RFCAST( &HSolveHub::setInject )
		),
	};

	static const ThisFinfo* tf = dynamic_cast< const ThisFinfo* >( 
		initCompartmentCinfo()->getThisFinfo() );
	assert( tf != 0 );

	static SolveFinfo compartmentZombieFinfo( 
		compartmentFields, 
		sizeof( compartmentFields ) / sizeof( Finfo* ),
		tf,
		"These fields will replace the original compartment fields so that the lookups refer to the solver rather "
		"than the compartment."
	);

	return &compartmentZombieFinfo;
}
void SigNeur::makeCell2SigAdaptors()
{
	static const Finfo* lookupChildFinfo = 
		initCompartmentCinfo()->findFinfo( "lookupChild" );
	for ( map< string, string >::iterator i = calciumMap_.begin();
		i != calciumMap_.end(); ++i ) {
		for ( vector< TreeNode >::iterator j = tree_.begin();
			j != tree_.end(); ++j ) {
			Id caId;
			bool ret = lookupGet< Id, string >( j->compt.eref(), lookupChildFinfo, caId, i->first );
			if ( ret && caId.good() ) {
				if ( j->category == SOMA ) {
					adaptCa2Sig( *j, somaMap_, 0, calciumScale_, 
						caId, i->second );
				} else if ( j->category == DEND ) {
					adaptCa2Sig( *j, dendMap_, numSoma_, calciumScale_, 
						caId, i->second );
				} else if ( j->category == SPINE ) {
					adaptCa2Sig( *j, spineMap_, numDend_ + numSoma_,
						calciumScale_,
						caId, i->second );
				}
			}
		}
	}
}
void SigNeur::buildTree( Id soma, const vector< Id >& compts )
{
	const Finfo* axialFinfo;
	const Finfo* raxialFinfo;
	if ( soma.eref().e->cinfo() == initSymCompartmentCinfo() ) {
		axialFinfo = initSymCompartmentCinfo()->findFinfo( "raxial1" );
		raxialFinfo = initSymCompartmentCinfo()->findFinfo( "raxial2" );
	} else {
		axialFinfo = initCompartmentCinfo()->findFinfo( "axial" );
		raxialFinfo = initCompartmentCinfo()->findFinfo( "raxial" );
	}
	assert( axialFinfo != 0 );
	assert( raxialFinfo != 0 );
	
	// Soma may be in middle of messaging structure for cell, so we need
	// to traverse both ways. But nothing below soma should 
	// change direction in the traversal.
	innerBuildTree( 0, soma.eref(), soma.eref(), 
		axialFinfo->msg(), raxialFinfo->msg() );
	// innerBuildTree( 0, soma.eref(), soma.eref(), raxialFinfo->msg() );
}
Esempio n. 5
0
void HSolveHub::manageCompartments()
{
	const vector< Id >& idlist = integ_->getCompartments();
	vector< Element* > elist;
	idlist2elist( idlist, elist );
	
	const vector< vector< Id > >& externalChannelIds =
		integ_->getExternalChannels();
	vector< Element* > extChanList;
	
	const Finfo* initFinfo = initCompartmentCinfo()->findFinfo( "init" );
	vector< Element* >::const_iterator i;
	for ( i = elist.begin(); i != elist.end(); i++ ) {
		zombify( hub_, *i, compartmentSolveFinfo, compartmentZombieFinfo );
		
		// Compartment receives 2 shared messages from Tick's "process"
		Eref( *i ).dropAll( initFinfo->msg() );
		
		redirectDynamicMessages( *i );
	}
	
	/*
	 * Redirecting dest/shared messages
	 */
	for ( unsigned int ic = 0; ic < elist.size(); ic++ ) {
		// The 'retain' flag at the end is 1: we do not delete the original
		// message to the compartment.
		redirectDestMessages(
			hub_, elist[ ic ],
			hubCompartmentInjectFinfo, compartmentInjectFinfo, 
			ic, compartmentInjectMap_,
			&elist, 0,
			1 );
		
		extChanList.clear();
		idlist2elist( externalChannelIds[ ic ], extChanList );
		redirectDestMessages(
			hub_, elist[ ic ],
			hubCompartmentChannelFinfo, compartmentChannelFinfo, 
			ic, compartmentChannelMap_,
			&elist, &extChanList,
			1 );
	}
}
Esempio n. 6
0
static const Finfo* hhchannelSolveFinfo = 
	initHSolveHubCinfo()->findFinfo( "hhchannelSolve" );
static const Finfo* caconcSolveFinfo = 
	initHSolveHubCinfo()->findFinfo( "caconcSolve" );
static const Finfo* hubCompartmentInjectFinfo =
	initHSolveHubCinfo()->findFinfo( "compartmentInjectMsg" );
static const Finfo* hubCompartmentChannelFinfo =
	initHSolveHubCinfo()->findFinfo( "compartmentChannel" );

/*
 * Finfos from biophysical objects. Needed so that 'set' operations are done
 * on the solver as well as the objects. Also needed for redirecting any dest
 * messages on these finfos to the solver (e.g.: to the inject field).
 */
static const Finfo* compartmentInjectFinfo =
	initCompartmentCinfo()->findFinfo( "injectMsg" );
static const Finfo* compartmentChannelFinfo =
	initCompartmentCinfo()->findFinfo( "channel" );
static const Finfo* compartmentVmFinfo =
	initCompartmentCinfo()->findFinfo( "Vm" );
static const Finfo* channelGbarFinfo =
	initHHChannelCinfo()->findFinfo( "Gbar" );
static const Finfo* channelEkFinfo =
	initHHChannelCinfo()->findFinfo( "Ek" );
static const Finfo* channelGkFinfo =
	initHHChannelCinfo()->findFinfo( "Gk" );
static const Finfo* channelXFinfo =
	initHHChannelCinfo()->findFinfo( "X" );
static const Finfo* channelYFinfo =
	initHHChannelCinfo()->findFinfo( "Y" );
static const Finfo* channelZFinfo =