本文整理汇总了C++中Eref::element方法的典型用法代码示例。如果您正苦于以下问题:C++ Eref::element方法的具体用法?C++ Eref::element怎么用?C++ Eref::element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eref
的用法示例。
在下文中一共展示了Eref::element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vRemesh
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;
}
}
示例2: getReactantVols
unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools,
vector< double >& vols )
{
static const unsigned int meshIndex = 0;
const vector< MsgFuncBinding >* mfb =
reac.element()->getMsgAndFunc( pools->getBindIndex() );
unsigned int smallIndex = 0;
vols.resize( 0 );
if ( mfb ) {
for ( unsigned int i = 0; i < mfb->size(); ++i ) {
double v = 1;
Element* pool = Msg::getMsg( (*mfb)[i].mid )->e2();
if ( pool == reac.element() )
pool = Msg::getMsg( (*mfb)[i].mid )->e1();
assert( pool != reac.element() );
Eref pooler( pool, meshIndex );
if ( pool->cinfo()->isA( "PoolBase" ) ) {
v = lookupVolumeFromMesh( pooler );
} else {
cout << "Error: getReactantVols: pool is of unknown type\n";
assert( 0 );
}
vols.push_back( v );
if ( v < vols[0] )
smallIndex = i;
}
}
return smallIndex;
}
示例3: firstTgt
Eref OneToAllMsg::firstTgt( const Eref& src ) const
{
if ( src.element() == e1_ )
return Eref( e2_, 0 );
else if ( src.element() == e2_ )
return Eref( e1_, i1_ );
return Eref( 0, 0 );
}
示例4: firstTgt
Eref SingleMsg::firstTgt( const Eref& src ) const
{
if ( src.element() == e1_ )
return Eref( e2_, i2_, f2_ );
else if ( src.element() == e2_ )
return Eref( e1_, i1_ );
return Eref( 0, 0 );
}
示例5: firstTgt
/**
* This is a little tricky because we might be mapping between
* data entries and field entries here.
* May wish also to apply to exec operations.
* At this point, the effect of trying to go between regular
* data entries and field entries is undefined.
*/
Eref OneToOneDataIndexMsg::firstTgt( const Eref& src ) const
{
if ( src.element() == e1_ ) {
return Eref( e2_, src.dataIndex(), 0 );
} else if ( src.element() == e2_ ) {
return Eref( e1_, src.dataIndex() );
}
return Eref( 0, 0 );
}
示例6: vSetIsBuffered
/**
* setIsBuffered is a really nasty operation, made possible only because
* BufPool is derived from Pool and has no other fields.
* It uses a low-level replaceCinfo call to just change the
* identity of the Cinfo used, leaving everything else as is.
*/
void Pool::vSetIsBuffered( const Eref& e, bool v )
{
static const Cinfo* bufPoolCinfo = Cinfo::find( "BufPool" );
if (vGetIsBuffered( e ) == v)
return;
if (v) {
e.element()->replaceCinfo( bufPoolCinfo );
} else {
e.element()->replaceCinfo( poolCinfo );
}
}
示例7: ret
vector< string > Neutral::getDestFields( const Eref& e ) const
{
unsigned int num = e.element()->cinfo()->getNumDestFinfo();
vector< string > ret( num );
for ( unsigned int i = 0; i < num; ++i ) {
const Finfo *f = e.element()->cinfo()->getDestFinfo( i );
assert( f );
ret[i] = f->name();
}
return ret;
}
示例8:
vector< Id > Neutral::getNeighbors( const Eref& e, string field ) const
{
vector< Id > ret;
const Finfo* finfo = e.element()->cinfo()->findFinfo( field );
if ( finfo )
e.element()->getNeighbors( ret, finfo );
else
cout << "Warning: Neutral::getNeighbors: Id.Field '" <<
e.id().path() << "." << field <<
"' not found\n";
return ret;
}
示例9: firstTgt
/**
* This is a little tricky because we might be mapping between
* data entries and field entries here.
* May wish also to apply to exec operations.
* At this point, the effect of trying to go between regular
* data entries and field entries is undefined.
*/
Eref OneToOneMsg::firstTgt( const Eref& src ) const
{
if ( src.element() == e1_ ) {
if ( e2_->hasFields() )
return Eref( e2_, i2_, src.dataIndex() );
else
return Eref( e2_, src.dataIndex(), 0 );
} else if ( src.element() == e2_ ) {
return Eref( e1_, src.dataIndex() );
}
return Eref( 0, 0 );
}
示例10: zombify
void HSolve::zombify( Eref hsolve ) const
{
vector< Id >::const_iterator i;
for ( i = compartmentId_.begin(); i != compartmentId_.end(); ++i )
ZombieCompartment::zombify( hsolve.element(), i->eref().element() );
for ( i = caConcId_.begin(); i != caConcId_.end(); ++i )
ZombieCaConc::zombify( hsolve.element(), i->eref().element() );
for ( i = channelId_.begin(); i != channelId_.end(); ++i )
ZombieHHChannel::zombify( hsolve.element(), i->eref().element() );
}
示例11: buildTree
unsigned int Neutral::buildTree( const Eref& e, vector< Id >& tree )
const
{
unsigned int ret = 1;
Eref er( e.element(), ALLDATA );
vector< Id > kids = getChildren( er );
sort( kids.begin(), kids.end() );
kids.erase( unique( kids.begin(), kids.end() ), kids.end() );
for ( vector< Id >::iterator i = kids.begin(); i != kids.end(); ++i )
ret += buildTree( i->eref(), tree );
tree.push_back( e.element()->id() );
return ret;
}
示例12: Msg
OneToOneDataIndexMsg::OneToOneDataIndexMsg(
const Eref& e1, const Eref& e2,
unsigned int msgIndex )
: Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ),
e1.element(), e2.element() )
{
if ( msgIndex == 0 ) {
msg_.push_back( this );
} else {
if ( msg_.size() <= msgIndex )
msg_.resize( msgIndex + 1 );
msg_[ msgIndex ] = this;
}
}
示例13: Msg
SingleMsg::SingleMsg( const Eref& e1, const Eref& e2, unsigned int msgIndex)
: Msg( ObjId( managerId_, (msgIndex != 0 ) ? msgIndex: msg_.size() ),
e1.element(), e2.element() ),
i1_( e1.dataIndex() ),
i2_( e2.dataIndex() ),
f2_( e2.fieldIndex() )
{
if ( msgIndex == 0 ) {
msg_.push_back( this );
return;
} else if ( msg_.size() <= msgIndex ) {
msg_.resize( msgIndex + 1 );
}
msg_[ msgIndex ] = this;
}
示例14:
OneToAllMsg::OneToAllMsg( MsgId mid, Eref e1, Element* e2 )
:
Msg( mid, e1.element(), e2, OneToAllMsg::managerId_ ),
i1_( e1.index() )
{
;
}
示例15: getNumSub
unsigned int EnzBase::getNumSub( const Eref& e, const Qinfo* q ) const
{
const vector< MsgFuncBinding >* mfb =
e.element()->getMsgAndFunc( toSub()->getBindIndex() );
assert( mfb );
return ( mfb->size() );
}