本文整理汇总了C++中Eref::data方法的典型用法代码示例。如果您正苦于以下问题:C++ Eref::data方法的具体用法?C++ Eref::data怎么用?C++ Eref::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eref
的用法示例。
在下文中一共展示了Eref::data方法的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: getChannelMap
string SigNeur::getChannelMap( Eref e, const string& i )
{
SigNeur* sn = static_cast< SigNeur* >( e.data() );
map< string, string >::iterator j = sn->channelMap_.find( i );
if ( j != sn->channelMap_.end() )
return j->second;
return "";
}
示例3: testParGet
/////////////////////////////////////////////////////////////////
// Now test 'get' across nodes.
// Normally the 'get' call is invoked by the parser, which expects a
// value to come back. Note that the return must be asynchronous:
// the parser cannot block since we need to execute MPI polling
// operations on either side.
/////////////////////////////////////////////////////////////////
void testParGet( Id tnId, vector< Id >& testIds )
{
unsigned int myNode = MuMPI::INTRA_COMM().Get_rank();
unsigned int numNodes = MuMPI::INTRA_COMM().Get_size();
Slot parGetSlot = initShellCinfo()->getSlot( "parallel.getSrc" );
char name[20];
string sname;
if ( myNode == 0 ) {
cout << "\ntesting parallel get" << flush;
} else {
sprintf( name, "foo%d", myNode * 2 );
sname = name;
set< string >( tnId.eref(), "name", sname );
}
MuMPI::INTRA_COMM().Barrier();
Eref e = Id::shellId().eref();
Shell* sh = static_cast< Shell* >( e.data() );
vector< unsigned int > rids( numNodes, 0 );
vector< string > ret( numNodes );
unsigned int origSize = sh->freeRidStack_.size();
ASSERT( origSize > 0 , "Stack initialized properly" );
if ( myNode == 0 ) {
for ( unsigned int i = 1; i < numNodes; i++ ) {
rids[i] =
openOffNodeValueRequest< string >( sh, &ret[i], 1 );
ASSERT( sh->freeRidStack_.size() == origSize - i, "stack in use" );
sendTo3< Id, string, unsigned int >(
Id::shellId().eref(), parGetSlot, i - 1,
testIds[i - 1], "name", rids[i]
);
}
}
// Here we explicitly do what the closeOffNodeValueRequest handles.
MuMPI::INTRA_COMM().Barrier();
// Cycle a few times to make sure all data gets back to node 0
for ( unsigned int i = 0; i < 5; i++ ) {
pollPostmaster();
MuMPI::INTRA_COMM().Barrier();
}
// Now go through to check all values have come back.
if ( myNode == 0 ) {
ASSERT( sh->freeRidStack_.size() == 1 + origSize - numNodes,
"Stack still waiting" );
for ( unsigned int i = 1; i < numNodes; i++ ) {
sprintf( name, "foo%d", i * 2 );
sname = name;
ASSERT( sh->offNodeData_[ rids[i] ].numPending == 0,
"Pending requests cleared" );
ASSERT( sh->offNodeData_[ rids[i] ].data ==
static_cast< void* >( &ret[i] ), "Pointing to strings" );
ASSERT( ret[ i ] == sname, "All values returned correctly" );
// Clean up the debris
sh->offNodeData_[ rids[i] ].data = 0;
sh->freeRidStack_.push_back( rids[i] );
}
}
}
示例4: destroy
void Shell::destroy( const Eref& e, ObjId oid)
{
Neutral *n = reinterpret_cast< Neutral* >( e.data() );
assert( n );
// cout << myNode_ << ": Shell::destroy done for element id: " << eid << ", name = " << eid.element()->getName() << endl;
n->destroy( oid.eref(), 0 );
if ( cwe_.id == oid.id )
cwe_ = ObjId();
}
示例5: getSecondDelay
double PulseGen::getSecondDelay(Eref e)
{
PulseGen* obj = static_cast <PulseGen*> (e.data());
ASSERT( obj != NULL, "PulseGen::getSecondDelay(Eref ) - target data pointer is NULL.");
if (obj->delay_.size() >= 2){
return obj->delay_[obj->delay_.size() - 1];
}
return 0.0;
}
示例6: getReleaseCount
double BinSynchan::getReleaseCount( Eref e, const unsigned int& i )
{
vector< BinSynInfo >& synapses =
static_cast< BinSynchan* >( e.data() )->synapses_;
if ( i < synapses.size() )
return synapses[i].getReleaseCount();
cout << "Error: BinSynchan::getReleaseCount : Index " << i <<
" out of range\n";
return 0.0;
}
示例7: getDelay
double PulseGen::getDelay(Eref e, const int& index)
{
PulseGen* obj = static_cast <PulseGen*> (e.data());
ASSERT( obj != NULL, "PulseGen::getDelay(Eref ) - target data pointer is NULL.");
if (index >= 0 && index < obj->delay_.size()){
return obj->delay_[index];
} else {
cout << "WARNING: PulseGen::getDelay - invalid index." << endl;
return 0.0;
}
}
示例8: getDmap
static double getDmap( Eref e, const string& s ) {
map< string, double >::iterator i;
LookupTestClass* atc =
static_cast< LookupTestClass* >( e.data() );
i = atc->dmap.find( s );
if ( i != atc->dmap.end() )
return i->second;
cout << "Error: LookupTestClass::getDvec: index not found \n";
return 0.0;
}
示例9: vRemesh
// 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() );
}
示例10: cleanSimulation
// Static func
void Shell::cleanSimulation()
{
Eref sheller = Id().eref();
Shell* s = reinterpret_cast< Shell* >( sheller.data() );
vector< Id > kids;
Neutral::children( sheller, kids );
for ( vector< Id >::iterator i = kids.begin(); i != kids.end(); ++i )
{
if ( i->value() > 4 ) {
cout << "Shell::cleanSimulation: deleted cruft at " <<
i->value() << ": " << i->path() << endl;
s->doDelete( *i );
}
}
}
示例11: getSigDt
double SigNeur::getSigDt( Eref e )
{
return static_cast< SigNeur* >( e.data() )->sigDt_;
}
示例12: getSomaMethod
string SigNeur::getSomaMethod( Eref e )
{
return static_cast< SigNeur* >( e.data() )->somaMethod_;
}
示例13: getDendMethod
string SigNeur::getDendMethod( Eref e )
{
return static_cast< SigNeur* >( e.data() )->dendMethod_;
}
示例14: getCellMethod
string SigNeur::getCellMethod( Eref e )
{
return static_cast< SigNeur* >( e.data() )->cellMethod_;
}
示例15: getGamma
double IzhikevichNrn::getGamma(Eref e)
{
return static_cast<IzhikevichNrn*>(e.data())->gamma_;
}