/// Construct an evaluator. RefinerTagManager::RefinerTagManager( Interface* in_mesh, Interface* out_mesh ) : shared_procs_in( 5 * MAX_SHARING_PROCS, -1 ), shared_procs_out( MAX_SHARING_PROCS, -1 ) { assert( in_mesh ); if ( ! out_mesh ) out_mesh = in_mesh; this->input_mesh = in_mesh; this->output_mesh = out_mesh; this->reset_vertex_tags(); this->reset_element_tags(); ParallelComm* ipcomm = ParallelComm::get_pcomm( this->input_mesh, 0 ); ParallelComm* opcomm = 0; if ( this->output_mesh != this->input_mesh ) { opcomm = ParallelComm::get_pcomm( this->output_mesh, 0 ); if ( ! opcomm ) { #ifdef MB_DEBUG std::cout << "Creating opcomm: " << opcomm << "\n"; #endif // MB_DEBUG opcomm = new ParallelComm( this->output_mesh, MPI_COMM_WORLD ); } } else { opcomm = ipcomm; } if ( ipcomm ) { ipcomm->get_shared_proc_tags( this->tag_ipsproc, this->tag_ipsprocs, this->tag_ipshand, this->tag_ipshands, this->tag_ipstatus ); } else { this->tag_ipsproc = this->tag_ipsprocs = 0; this->tag_ipshand = this->tag_ipshands = 0; this->tag_ipstatus = 0; } if ( opcomm ) { opcomm->get_shared_proc_tags( this->tag_opsproc, this->tag_opsprocs, this->tag_opshand, this->tag_opshands, this->tag_opstatus ); } else { this->tag_opsproc = this->tag_opsprocs = 0; this->tag_opshand = this->tag_opshands = 0; this->tag_opstatus = 0; } this->rank = ipcomm ? ipcomm->proc_config().proc_rank() : ( opcomm ? opcomm->proc_config().proc_rank() : 0 ); // Create the mesh global ID tags if they aren't already there. int zero = 0; ErrorCode result; result = this->input_mesh->tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, this->tag_igid, MB_TAG_DENSE|MB_TAG_CREAT, &zero ); if ( result != MB_SUCCESS ) { throw new std::logic_error( "Unable to find input mesh global ID tag \"" GLOBAL_ID_TAG_NAME "\"" ); } result = this->output_mesh->tag_get_handle( GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER, this->tag_ogid, MB_TAG_DENSE|MB_TAG_CREAT, &zero ); if ( result != MB_SUCCESS ) { throw new std::logic_error( "Unable to find/create output mesh global ID tag \"" GLOBAL_ID_TAG_NAME "\"" ); } #ifdef MB_DEBUG std::cout << "psproc: " << this->tag_ipsproc << ", " << this->tag_opsproc << "\n" << "psprocs: " << this->tag_ipsprocs << ", " << this->tag_opsprocs << "\n" << "pshand: " << this->tag_ipshand << ", " << this->tag_opshand << "\n" << "pshands: " << this->tag_ipshands << ", " << this->tag_opshands << "\n" << "pstatus: " << this->tag_ipstatus << ", " << this->tag_opstatus << "\n" << "gid: " << this->tag_igid << ", " << this->tag_ogid << "\n"; #endif // MB_DEBUG }