void vecMap_lookUp_EA() { //EA vector map lookup eastl::scoped_ptr<VMAP> v_map(new VMAP); //fill vector map for(int i = 0; i < 10; i++) { std::string tmpString="a"; tmpString+= std::to_string(i); v_map->insert(eastl::pair<std::string,char>(tmpString,'a'+i)); } //print out vector map elements (key value) for(const auto &i: *v_map) { std::cout<<i.first<<"-->"<<i.second<<std::endl; } //VECTOR MAP look up for the: key=8 VMAP::iterator ea_it; ea_it = v_map->find("a1"); if (ea_it != v_map->end()) { std::cout<<(*ea_it).first<<"-->"<<(*ea_it).second<<std::endl; } }
static void Ublas2Epetra( element_type const& x, vector_ptrtype& v ) { epetra_vector_type& _v( dynamic_cast<epetra_vector_type&>( *v ) ); Epetra_Map v_map( _v.Map() ); DVLOG(2) << "Local size of ublas vector" << x.localSize() << "\n"; DVLOG(2) << "Local size of epetra vector" << v->localSize() << "\n"; const size_type L = v->localSize(); for ( size_type i=0; i<L; i++ ) { DVLOG(2) << "v[" << v_map.GID( i ) << "] = " << "x(" << x.firstLocalIndex() + i << ")=" << x( x.firstLocalIndex() + i ) << "\n"; v->set( v_map.GID( i ), x( x.firstLocalIndex() + i ) ); } }
static void Epetra2Ublas( vector_ptrtype const& u, element_type& x ) { epetra_vector_ptrtype const& _v( dynamic_cast<epetra_vector_ptrtype const&>( u ) ); Epetra_Map v_map( _v->Map() ); vector_type v = *u; //DVLOG(2) << "Initial EpetraVector " << v << "\n"; const size_type L = v.localSize(); for ( size_type i=0; i<L; i++ ) { DVLOG(2) << "x(" << x.firstLocalIndex() + i << ")=" << "v[" << v_map.GID( i ) << "] = " << v( i ) << "\n"; x( x.firstLocalIndex() + i ) = v( i ); } DVLOG(2) << "Epetra2Ublas:" << x << "\n"; }
void do_test(void) { thread_setup(&a_thr, (reg_t) a_thread, SP(a_stack)); thread_setup(&b_thr, (reg_t) b_thread, SP(b_stack)); thread_setup(&c_thr, (reg_t) c_thread, SP(c_stack)); initrd_thrs[INITRD_APPS-1].next = &a_thr; a_thr.next = &b_thr; b_thr.next = &c_thr; c_thr.next = &initrd_thrs[0]; CAP_TCB(&a_thr, 1) = &initrd_thrs[0];//ipc server /usr/wtest CAP_TCB(&b_thr, 1) = &initrd_thrs[0];//ipc server /usr/wtest CAP_TCB(&c_thr, 1) = &initrd_thrs[0];//ipc server /usr/wtest CAP_TCB(&a_thr, 0) = &idle_thr;//ipc server idle CAP_TCB(&b_thr, 0) = &idle_thr;//ipc server idle CAP_TCB(&c_thr, 0) = &idle_thr;//ipc server idle CAP_TCB(&c_thr, 2) = &initrd_thrs[5];//fault server /dev/ata thread_switch(&initrd_thrs[4]);//fault server /dev/fd0 ad_t vir = 0x80000000, phy = 0x100000; printstr("/dev/fd0: server mem v_map to fd0mem..."); for (int i = 0; i < 0x168; i++) { /*printstr("v_map(vir="); printint(vir); printstr(", phy="); printint(phy); printstr(")\n");*/ v_map(vir, phy, PG_W | PG_U); vir += PGSIZE; phy += PGSIZE; } printstr("done\n"); /*printstr("/svr/fat: set mem server (cid 2) to /dev/fd0\n"); CAP_TCB(&initrd_thrs[5], 2) = &initrd_thrs[4];//fault server /dev/fd0*/ thread_switch(&initrd_thrs[5]);//fault server /dev/ata }