MOAB: Mesh Oriented datABase
(version 5.4.1)
|
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 Core moab; 00032 Interface* mb = &moab; 00033 EntityHandle sf; 00034 ErrorCode rval = mb->create_meshset( MESHSET_SET, sf );MB_CHK_ERR( rval ); 00035 00036 rval = mb->load_file( filein.c_str(), &sf );MB_CHK_ERR( rval ); 00037 00038 double R = 1.; // should be input 00039 EntityHandle outSet; 00040 rval = mb->create_meshset( MESHSET_SET, outSet );MB_CHK_ERR( rval ); 00041 00042 rval = IntxUtils::global_gnomonic_projection( mb, sf, R, false, outSet );MB_CHK_ERR( rval ); 00043 rval = mb->write_file( fileout.c_str(), 0, 0, &outSet, 1 ); 00044 ;MB_CHK_ERR( rval ); 00045 // skip the test for 32 bit builds, CHECK_ARRAYS_EQUAL macro is not working correctly 00046 #ifndef MOAB_FORCE_32_BIT_HANDLES 00047 // check first cell position 00048 Range cells; 00049 rval = mb->get_entities_by_dimension( outSet, 2, cells );MB_CHK_ERR( rval ); 00050 EntityHandle firstCell = cells[0]; 00051 double coords[3]; 00052 rval = mb->get_coords( &firstCell, 1, coords );MB_CHK_ERR( rval ); 00053 // check position 00054 double values[3] = { -0.78867513420303437, 0.78867513420303437, 0 }; 00055 CHECK_ARRAYS_EQUAL( coords, 3, values, 3 ); 00056 #endif 00057 00058 return 0; 00059 }