Example #1
0
OneToAllMsg::OneToAllMsg( MsgId mid, Eref e1, Element* e2 )
	: 
		Msg( mid, e1.element(), e2, OneToAllMsg::managerId_ ),
		i1_( e1.index() )
{
	;
}
Example #2
0
void Pool::vRemesh( const Eref& e, const Qinfo* q, 
	double oldvol,
	unsigned int numTotalEntries, unsigned int startEntry, 
	const vector< unsigned int >& localIndices, 
	const vector< double >& vols )
{
	if ( e.index().value() != 0 )
		return;
	/*
	if ( q->addToStructuralQ() )
		return;
		*/
	Neutral* n = reinterpret_cast< Neutral* >( e.data() );
	assert( vols.size() > 0 );
	double concInit = nInit_ / ( NA * oldvol );
	if ( vols.size() != e.element()->dataHandler()->localEntries() )
		n->setLastDimension( e, q, vols.size() );
	// Note that at this point the Pool pointer may be invalid!
	// But we need to update the concs anyway.
	assert( e.element()->dataHandler()->localEntries() == vols.size() );
	Pool* pooldata = reinterpret_cast< Pool* >( e.data() );
	for ( unsigned int i = 0; i < vols.size(); ++i ) {
		pooldata[i].nInit_ = pooldata[i].n_ = concInit * vols[i] * NA;
	}
}
Example #3
0
double GslStoich::getNinit( const Eref& e ) const
{
	unsigned int i = e.index().value();
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( i < pools_.size() );
	assert( j < pools_[i].size() );
	return pools_[i].Sinit()[j];
}
Example #4
0
void GslStoich::setNinit( const Eref& e, double v )
{
	unsigned int i = e.index().value();
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( i < pools_.size() );
	assert( j < pools_[i].size() );
	pools_[i].varSinit()[j] = v;
}
Example #5
0
void GslStoich::setN( const Eref& e, double v )
{
	unsigned int i = e.index().value(); // Later: Handle node location.
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( i < pools_.size() );
	assert( j < pools_[i].size() );
	pools_[i].varS()[j] = v;
	assert( i < y_.size() );
	assert( j < y_[i].size() );
	y_[i][j] = v;
}
Example #6
0
// vRemesh: All the work is done by the message from the compartment to the
// Stoich. None of the ZPools is remeshed directly. However, their
// DataHandlers need updating.
void ZPool::vRemesh( const Eref& e, const Qinfo* q, 
	double oldvol,
	unsigned int numTotalEntries, unsigned int startEntry, 
	const vector< unsigned int >& localIndices, 
	const vector< double >& vols )
{
	;
	if ( e.index().value() != 0 )
		return;
	Neutral* n = reinterpret_cast< Neutral* >( e.data() );
	if ( vols.size() != e.element()->dataHandler()->localEntries() )
		n->setLastDimension( e, q, vols.size() );
}
Example #7
0
void Pool::vProcess( const Eref& e, ProcPtr p )
{
	// double A = e.sumBuf( aSlot );
	// double B = e.sumBuf( bSlot );
	if ( n_ < 0 )
		cout << "nugh" << e.index() << endl;
	if ( B_ < 0 )
		cout << "bugh" << e.index() << endl;
	if ( p->dt < 0 )
		cout << "tugh" << e.index() << endl;

	if ( n_ > EPSILON && B_ > EPSILON ) {
		double C = exp( -B_ * p->dt / n_ );
		n_ *= C + (A_ / B_ ) * ( 1.0 - C );
	} else {
		n_ += ( A_ - B_ ) * p->dt;
		if ( n_ < 0.0 )
			n_ = 0.0;
	}

	A_ = B_ = 0.0;

	nOut.send( e, p->threadIndexInGroup, n_ );
}
Example #8
0
double GslStoich::getDiffConst( const Eref& e ) const
{
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( j < pools_[ e.index().value() ].size() );
	return coreStoich()->getDiffConst( j );
}
Example #9
0
void GslStoich::setDiffConst( const Eref& e, double v )
{
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( j < pools_[ e.index().value() ].size() );
	coreStoich_.setDiffConst( j, v );
}
Example #10
0
unsigned int GslStoich::getSpecies( const Eref& e )
{
	unsigned int j = coreStoich()->convertIdToPoolIndex( e.id() );
	assert( j < pools_[ e.index().value() ].size() );
	return coreStoich()->getSpecies( j );
}