#include #include #include #include #include #include #include #include #include #define CHKERR(x) {if(result) {std::string str; imoab.get_last_error(str); std::cout << pcomm.rank() << " line: " << __LINE__ << " reason: " << str << std::endl; printf(x); MPI_Abort(MPI_COMM_WORLD,__LINE__);}} //Starting point int main(int argc,char ** argv) { int rank,size,result; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Comm_size(MPI_COMM_WORLD,&size); if( argc > 1 ) { moab::Range exch_tmp; moab::Core moab; moab::Interface & imoab = moab; moab::Tag phi_tag, global_id; moab::ParallelComm pcomm(&imoab,MPI_COMM_WORLD); moab::Range local,ghost; std::string version; imoab.impl_version(&version); if( pcomm.rank() == 0 ) std::cout << "MOAB version: " << version << std::endl; pcomm.set_debug_verbosity(0); std::stringstream options; options << "PARALLEL=READ_PART;"; options << "PARTITION=PARALLEL_PARTITION;"; options << "PARTITION_BY_RANK;"; options << "PARALLEL_COMM=" << pcomm.get_id() << ";"; result = imoab.load_file(argv[1],NULL,options.str().c_str()); CHKERR("load failed\n"); MPI_Barrier(pcomm.comm()); if( !rank ) std::cout << " file loaded " << std::endl; result = pcomm.resolve_shared_ents(imoab.get_root_set(),3,2); CHKERR("cannot resolve ents\n"); MPI_Barrier(pcomm.comm()); if( !rank ) std::cout << " resolved shared " << std::endl; result = pcomm.exchange_ghost_cells(3,2,1,0,1); CHKERR("cannot exchange ghost\n"); MPI_Barrier(pcomm.comm()); if( !rank ) std::cout << " exchange ghost " << std::endl; } else { //print help if( !rank ) std::cout << argv[0] << " [mesh_file]" << std::endl; } MPI_Finalize(); return 0; }