MOAB: Mesh Oriented datABase  (version 5.2.1)
gnom_project_test.cpp
Go to the documentation of this file.
00001 /*
00002  * gnom_project_test.cpp
00003  * will test new global gnomonic projection method, to be used by zoltan for partitioning
00004  *
00005  */
00006 #include <iostream>
00007 #include <sstream>
00008 
00009 #include "moab/Core.hpp"
00010 #include "moab/Interface.hpp"
00011 
00012 #include "moab/IntxMesh/IntxUtils.hpp"
00013 #include "moab/ProgOptions.hpp"
00014 #include "TestUtil.hpp"
00015 
00016 using namespace moab;
00017 using namespace std;
00018 
00019 int main( int  argc, char*  argv[] )
00020 {
00021     string filein = STRINGIFY( MESHDIR ) "/mbcslam/eulerHomme.vtk";
00022     string fileout = "project.vtk";
00023 
00024     ProgOptions opts;
00025     opts.addOpt< std::string >( "model,m", "input file ", &filein );
00026 
00027     opts.addOpt< std::string >( "output,o", "output filename", &fileout );
00028 
00029     opts.parseCommandLine( argc, argv );
00030 
00031 
00032 
00033     Core moab;
00034     Interface* mb = &moab;
00035     EntityHandle sf;
00036     ErrorCode rval = mb->create_meshset( MESHSET_SET, sf );MB_CHK_ERR( rval );
00037 
00038     rval = mb->load_file( filein.c_str(), &sf );MB_CHK_ERR( rval );
00039 
00040     double R = 1.;  // should be input
00041     EntityHandle outSet;
00042     rval = mb->create_meshset( MESHSET_SET, outSet );MB_CHK_ERR( rval );
00043 
00044     rval = IntxUtils::global_gnomonic_projection( mb, sf,  R, false, outSet );MB_CHK_ERR( rval );
00045     // check first cell position
00046     Range cells;
00047     rval = mb->get_entities_by_dimension(outSet, 2, cells);MB_CHK_ERR( rval );
00048     EntityHandle firstCell = cells[0];
00049     double coords[3];
00050     rval  = mb->get_coords(&firstCell, 1, coords); MB_CHK_ERR( rval );
00051     // check position
00052     double values[3]={-0.78867513420303437, 0.78867513420303437, 0};
00053     CHECK_ARRAYS_EQUAL(coords, 3, values, 3);
00054 
00055     rval = mb->write_file(fileout.c_str(), 0, 0, &outSet, 1); ;MB_CHK_ERR( rval );
00056 
00057     return 0;
00058 
00059 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines