26 int main(
int argc,
char* argv[] )
31 std::string inputfile, outfile(
"out.h5m" ), sourcefile;
33 opts.
addOpt< std::string >(
"input,i",
"input mesh filename", &inputfile );
34 opts.
addOpt< std::string >(
"source,s",
"h5m file aligned with the mesh input file", &sourcefile );
35 opts.
addOpt< std::string >(
"output,o",
"output mesh filename", &outfile );
39 std::cout <<
"input mesh file: " << inputfile <<
"\n";
40 std::cout <<
"source file: " << sourcefile <<
"\n";
41 std::cout <<
"output file: " << outfile <<
"\n";
43 if( inputfile.empty() )
67 std::vector< int > gids;
68 gids.resize( iniVerts.
size() );
71 std::map< int, EntityHandle > fromGidToEh;
75 fromGidToEh[gids[i]] = *vit;
81 std::vector< int > gids2;
82 gids2.resize( sourceVerts.
size() );
84 std::map< int, EntityHandle > fromGid2ToEh;
88 fromGid2ToEh[gids2[i]] = *vit;
92 for(
size_t i = 0; i < gids2.size(); i++ )
94 int globalId = gids2[i];
96 usedVerts.
insert( usedVert );
109 std::vector< EntityHandle > nconn( nnodes );
110 bool goodCell =
true;
111 for(
int i = 0; i < nnodes; i++ )
114 int index = iniVerts.
index( v );
115 if( index < 0 ) goodCell =
false;
116 int id = gids[index];
117 if( fromGid2ToEh.find(
id ) == fromGid2ToEh.end() )
120 nconn[i] = fromGid2ToEh[id];
122 if( !goodCell )
continue;
123 EntityType type =
MBTRI;
126 else if( nnodes == 4 )
128 else if( nnodes > 4 )