read partition file created by a Zoltan process, that used the global ids for identification of entities
#include <iostream>
#include <fstream>
using namespace std;
#ifndef MESH_DIR
#define MESH_DIR "."
#endif
int main(
int argc,
char** argv )
{
Interface*
mb =
new( std::nothrow ) Core;
if( NULL ==
mb )
return 1;
if( argc > 4 )
{
}
else
{
cerr << " usage is " << argv[0] << " <input file> <part file> <#parts> <output file> \n";
exit( 0 );
}
ifstream inFile;
if( !inFile )
{
exit( 1 );
}
Range sets;
cout << "Number of sets is " << sets.size() << endl;
rval =
mb->tag_get_handle(
"PARALLEL_PARTITION", tag );
MB_CHK_ERR( rval );
int i = 0;
int num_deleted_sets = 0;
{
int val = -1;
rval =
mb->tag_get_data( tag, &eh, 1, &val );
if( val != -1 )
{
num_deleted_sets++;
rval =
mb->delete_entities( &eh, 1 );
}
}
if( num_deleted_sets ) cout << "delete " << num_deleted_sets << " existing partition sets, and create new ones \n";
Range cells;
rval =
mb->get_entities_by_dimension( 0, 2, cells );
MB_CHK_ERR( rval );
for(
int i = 0; i <
nparts; i++ )
{
rval =
mb->tag_set_data( tag, &( psets[i] ), 1, &i );
MB_CHK_ERR( rval );
}
{
int part;
inFile >> part;
rval =
mb->add_entities( psets[part], &eh, 1 );
MB_CHK_ERR( rval );
}
mb->write_file( argv[4] );
return 0;
}