Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
GeneralGnomonic.cpp
Go to the documentation of this file.
1 /*
2  * gnom_project_test.cpp
3  * will test new global gnomonic projection method, to be used by zoltan for partitioning
4  *
5  */
6 #include <iostream>
7 #include <sstream>
8 
9 #include "moab/Core.hpp"
10 #include "moab/Interface.hpp"
11 
13 #include "moab/ProgOptions.hpp"
14 
15 using namespace moab;
16 using namespace std;
17 
18 int main( int argc, char* argv[] )
19 {
20  string filein = "target_1.h5m";
21  string fileout = "project.h5m";
22 
23  ProgOptions opts;
24  opts.addOpt< std::string >( "model,m", "input file ", &filein );
25 
26  opts.addOpt< std::string >( "output,o", "output filename", &fileout );
27 
28  opts.parseCommandLine( argc, argv );
29 
30  Core moab;
31  Interface* mb = &moab;
32  EntityHandle sf;
33  ErrorCode rval = mb->create_meshset( MESHSET_SET, sf );MB_CHK_ERR( rval );
34 
35  rval = mb->load_file( filein.c_str(), &sf );MB_CHK_ERR( rval );
36 
37  EntityHandle outSet;
38  rval = mb->create_meshset( MESHSET_SET, outSet );MB_CHK_ERR( rval );
39  // get the coords of the first vertex entity handle
40  EntityHandle v1 = 1; // we know it must exist; we could get a specific one too :)
41 
42  CartVect P;
43  rval = mb->get_coords( &v1, 1, P.array() );MB_CHK_ERR( rval );
44 
45  rval = IntxUtils::global_gnomonic_projection_general( mb, sf, P, outSet );MB_CHK_ERR( rval );
46  std::cout << "writing output file " << fileout.c_str() << "\n";
47  rval = mb->write_file( fileout.c_str(), 0, 0, &outSet, 1 );MB_CHK_ERR( rval );
48 
49  return 0;
50 }