#include "moab/Core.hpp" #include "moab/Interface.hpp" #include "moab/Range.hpp" #include "MBTagConventions.hpp" #include "moab/ParallelComm.hpp" #include "MBParallelConventions.h" #include #include #include /* ========================================================== */ #define PRINT_LAST_ERROR \ if (MB_SUCCESS != result) {\ std::string tmp_str;\ mb->get_last_error(tmp_str);\ std::cout << "Failure; message:" << tmp_str << std::endl;\ delete mb;\ return result;\ } /* ========================================================== */ using namespace moab; using namespace std; int main(int argc, char **argv) { if (argc!=2) { cout<<"Usage: h5m2plt "<proc_config().proc_size(); int rank = pcomm->proc_config().proc_rank(); MPI_Comm comm = pcomm->proc_config().proc_comm(); string options; string mesh_file_name; mesh_file_name = argv[1]; //Reading mesh file options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS"; if (rank == 0) cout << "Reading file " << mesh_file_name << "\n with options: " << options << endl << " on " << nprocs << " processors\n"; result = mb->load_file(mesh_file_name.c_str(), 0, options.c_str()); PRINT_LAST_ERROR; cout << "File loaded on processor " << rank << endl; // Now exchange 1 layer of ghost elements, using vertices as bridge result = pcomm->exchange_ghost_cells(3, // int ghost_dim, 2, // int bridge_dim, 1, //int num_layers, 2, //int addl_ents, true); // bool store_remote_handles); PRINT_LAST_ERROR; result = mb->tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, idtag ); Range faces; result = mb->get_entities_by_dimension(0, 2, faces); PRINT_LAST_ERROR; Range cells; result = mb->get_entities_by_dimension(0, 3, cells); PRINT_LAST_ERROR; Range owned_cells; result = pcomm->filter_pstatus(cells, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1, &owned_cells); Range nonghost_faces; result = mb->get_adjacencies(owned_cells, 2, true, nonghost_faces, Interface::UNION); root = mb->get_root_set(); int size = nonghost_faces.size(); int *gids = new int[size]; int *gids2 = new int[size]; result = mb->tag_get_data(idtag, nonghost_faces, (void *)gids); PRINT_LAST_ERROR; result = pcomm->exchange_tags(idtag, faces); PRINT_LAST_ERROR; result = mb->tag_get_data(idtag, nonghost_faces, (void *)gids2); PRINT_LAST_ERROR; for(int i=0; i