本文整理汇总了C++中Eref::dataIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Eref::dataIndex方法的具体用法?C++ Eref::dataIndex怎么用?C++ Eref::dataIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eref
的用法示例。
在下文中一共展示了Eref::dataIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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 );
}
示例3: 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;
}
示例4: Msg
OneToOneMsg::OneToOneMsg( 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() )
{
if ( msgIndex == 0 ) {
msg_.push_back( this );
} else {
if ( msg_.size() <= msgIndex )
msg_.resize( msgIndex + 1 );
msg_[ msgIndex ] = this;
}
}
示例5: child
// static function
Id Neutral::child( const Eref& e, const string& name )
{
static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
static const FuncId pafid = pf2->getFid();
static const Finfo* cf = neutralCinfo->findFinfo( "childOut" );
static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf );
static const BindIndex bi = cf2->getBindIndex();
const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi );
vector< Id > ret;
for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
i != bvec->end(); ++i ) {
if ( i->fid == pafid ) {
const Msg* m = Msg::getMsg( i->mid );
assert( m );
Element* e2 = m->e2();
if ( e2->getName() == name ) {
if ( e.dataIndex() == ALLDATA ) {// Child of any index is OK
return e2->id();
} else {
ObjId parent = m->findOtherEnd( m->getE2() );
// If child is a fieldElement, then all parent indices
// are permitted. Otherwise insist parent dataIndex OK.
if ( e2->hasFields() || parent == e.objId() )
return e2->id();
}
}
}
}
return Id();
}
示例6: getVoxelIndex
unsigned int Ksolve::getVoxelIndex( const Eref& e ) const
{
unsigned int ret = e.dataIndex();
if ( ret < startVoxel_ || ret >= startVoxel_ + pools_.size() )
return OFFNODE;
return ret - startVoxel_;
}
示例7: reinit
/**
* Assigns the Stoich Id to the parent.
*/
void MeshEntry::reinit( const Eref& e, ProcPtr info )
{
if ( e.dataIndex() == 0 ) {
ObjId pa = Neutral::parent( e );
// parent_->lookupStoich( pa );
}
}
示例8: lookupVolumeFromMesh
/// Utility function to find the size of a pool. We assume one-to-one
/// match between pool indices and mesh indices: that is what they are for.
double lookupVolumeFromMesh( const Eref& e )
{
ObjId compt = getCompt( e.id() );
if ( compt == ObjId() )
return 1.0;
return LookupField< unsigned int, double >::
get( compt, "oneVoxelVolume", e.dataIndex() );
}
示例9: children
// Static function
void Neutral::children( const Eref& e, vector< Id >& ret )
{
/*
vector< Id > temp;
getNeighbors( ret, neutralCinfo->findFinfo( "childOut" ) );
for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) {
if ( ret
}
*/
static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
static const FuncId pafid = pf2->getFid();
static const Finfo* cf = neutralCinfo->findFinfo( "childOut" );
static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf );
static const BindIndex bi = cf2->getBindIndex();
const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi );
for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
i != bvec->end(); ++i ) {
if ( i->fid == pafid ) {
const Msg* m = Msg::getMsg( i->mid );
assert( m );
vector< vector< Eref > > kids;
m->targets( kids );
if ( e.dataIndex() == ALLDATA ) {
for ( vector< vector< Eref > >::iterator
i = kids.begin(); i != kids.end(); ++i ) {
for ( vector< Eref >::iterator
j = i->begin(); j != i->end(); ++j )
ret.push_back( j->id() );
}
} else {
const vector< Eref >& temp = kids[e.dataIndex()];
for ( vector< Eref >::const_iterator
i = temp.begin(); i != temp.end(); ++i )
ret.push_back( i->id() );
}
}
}
}
示例10: addSpike
void Synapse::addSpike( const Eref& e, double time )
{
static bool report = false;
static unsigned int tgtDataIndex = 0;
// static unsigned int tgtFieldIndex = 0;
if ( report && e.dataIndex() == tgtDataIndex ) {
cout << " " << time << "," << e.fieldIndex();
}
handler_->addSpike( e.fieldIndex(), time + delay_, weight_ );
}
示例11: requestOut
void HDF5DataWriter::reinit(const Eref & e, ProcPtr p)
{
steps_ = 0;
for (unsigned int ii = 0; ii < data_.size(); ++ii){
H5Dclose(datasets_[ii]);
}
data_.clear();
src_.clear();
func_.clear();
datasets_.clear();
unsigned int numTgt = e.element()->getMsgTargetAndFunctions(e.dataIndex(),
requestOut(),
src_,
func_);
assert(numTgt == src_.size());
// TODO: what to do when reinit is called? Close the existing file
// and open a new one in append mode? Or keep adding to the
// current file?
if (filename_.empty()){
filename_ = "moose_data.h5";
}
if (filehandle_ > 0 ){
close();
}
if (numTgt == 0){
return;
}
openFile();
for (unsigned int ii = 0; ii < src_.size(); ++ii){
string varname = func_[ii];
size_t found = varname.find("get");
if (found == 0){
varname = varname.substr(3);
if (varname.length() == 0){
varname = func_[ii];
} else {
// TODO: there is no way we can get back the original
// field-name case. tolower will get the right name in
// most cases as field names start with lower case by
// convention in MOOSE.
varname[0] = tolower(varname[0]);
}
}
assert(varname.length() > 0);
string path = src_[ii].path() + "/" + varname;
hid_t dataset_id = getDataset(path);
datasets_.push_back(dataset_id);
}
data_.resize(src_.size());
}
示例12: firstTgt
Eref SparseMsg::firstTgt( const Eref& src ) const
{
if ( matrix_.nEntries() == 0 )
return Eref( 0, 0 );
if ( src.element() == e1_ ) {
const unsigned int* fieldIndex;
const unsigned int* colIndex;
unsigned int n = matrix_.getRow( src.dataIndex(),
&fieldIndex, &colIndex );
if ( n != 0 ) {
return Eref( e2_, colIndex[0], fieldIndex[0] );
}
} else if ( src.element() == e2_ ) {
return Eref( e1_, 0 );
}
return Eref( 0, 0 );
}
示例13: ret
vector< string > Neutral::getMsgDestFunctions( const Eref& e, string field ) const
{
vector< string > ret( 0 );
const Finfo* finfo = e.element()->cinfo()->findFinfo( field );
const SrcFinfo* sf = dynamic_cast< const SrcFinfo* >( finfo );
if ( sf ) {
vector< ObjId > tgt;
vector< string > func;
e.element()->getMsgTargetAndFunctions( e.dataIndex(), sf,
tgt, func );
return func;
} else {
cout << "Warning: Neutral::getMsgDestFunctions: Id.Field '" <<
e.id().path() << "." << field <<
"' not found or not a SrcFinfo\n";
}
return ret;
}
示例14: sortOutUniformSources
void NSDFWriter::sortOutUniformSources(const Eref& eref)
{
vars_.clear();
classFieldToSrcIndex_.clear();
objectField_.clear();
objectFieldToIndex_.clear();
const SrcFinfo * requestOut = (SrcFinfo*)eref.element()->cinfo()->findFinfo("requestOut");
unsigned int numTgt = eref.element()->getMsgTargetAndFunctions(eref.dataIndex(),
requestOut,
src_,
func_);
assert(numTgt == src_.size());
/////////////////////////////////////////////////////////////
// Go through all the sources and determine the index of the
// source message in the dataset
/////////////////////////////////////////////////////////////
for (unsigned int ii = 0; ii < func_.size(); ++ii){
string varname = func_[ii];
size_t found = varname.find("get");
if (found == 0){
varname = varname.substr(3);
if (varname.length() == 0){
varname = func_[ii];
} else {
varname[0] = tolower(varname[0]);
}
}
assert(varname.length() > 0);
string className = Field<string>::get(src_[ii], "className");
string datasetPath = className + "/"+ varname;
classFieldToSrcIndex_[datasetPath].push_back(ii);
vars_.push_back(varname);
}
data_.resize(numTgt);
}
示例15: setNumField
void Neutral::setNumField( const Eref& e, unsigned int num )
{
assert( e.isDataHere() );
unsigned int rawIndex = e.element()->rawIndex( e.dataIndex() );
e.element()->resizeField( rawIndex, num );
}