/// Dummy for now. DataId MsgDataHandler::pathDataId( const vector< vector< unsigned int > >& indices) const { if ( indices.size() != static_cast< unsigned int >( pathDepth_ ) + 1 ) return DataId::bad(); return DataId( 0 ); }
/// For now I'm just copying over the code for the BlockHandler. DataId ZombieHandler::pathDataId( const vector< vector< unsigned int > >& indices) const { if ( indices.size() != static_cast< unsigned int >( pathDepth_ ) + 1 ) return DataId::bad(); unsigned short depth = 0; unsigned long long linearIndex = 0; unsigned int j = 0; for ( unsigned int i = 0; i < dims_.size(); ++i ) { if ( depth != dims_[i].depth ) { j = 0; depth = dims_[i].depth; } assert( indices.size() > depth ); if ( indices[ depth ].size() > j ) { linearIndex *= dims_[i].size; linearIndex += indices[depth][j++]; } else if ( indices[ depth ].size() == 0 ) { // if no braces given in path string, assume index of zero. linearIndex *= dims_[i].size; j++; } else { return DataId::bad(); } } return DataId( linearIndex ); }
ObjId SparseMsg::findOtherEnd( ObjId f ) const { if ( f.element() == e1() ) { const unsigned int* entry; const unsigned int* colIndex; unsigned int num = matrix_.getRow( f.dataIndex, &entry, &colIndex ); if ( num > 0 ) { // Return the first matching entry. return ObjId( e2()->id(), colIndex[0] ); } return ObjId( 0, BADINDEX ); } else if ( f.element() == e2() ) { // Bad! Slow! Avoid! vector< unsigned int > entry; vector< unsigned int > rowIndex; unsigned int num = matrix_.getColumn( f.dataIndex, entry, rowIndex ); if ( num > 0 ) { // Return the first matching entry. return ObjId( e1()->id(), DataId( rowIndex[0] ) ); } } return ObjId( 0, BADINDEX ); }