MOAB: Mesh Oriented datABase  (version 5.5.0)
gnom_project_test.cpp File Reference
#include <iostream>
#include <sstream>
#include "moab/Core.hpp"
#include "moab/Interface.hpp"
#include "moab/IntxMesh/IntxUtils.hpp"
#include "moab/ProgOptions.hpp"
#include "TestUtil.hpp"
+ Include dependency graph for gnom_project_test.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 19 of file gnom_project_test.cpp.

20 {
21  string filein = STRINGIFY( MESHDIR ) "/mbcslam/eulerHomme.vtk";
22  string fileout = "project.vtk";
23 
24  ProgOptions opts;
25  opts.addOpt< std::string >( "model,m", "input file ", &filein );
26 
27  opts.addOpt< std::string >( "output,o", "output filename", &fileout );
28 
29  opts.parseCommandLine( argc, argv );
30 
31  Core moab;
32  Interface* mb = &moab;
33  EntityHandle sf;
34  ErrorCode rval = mb->create_meshset( MESHSET_SET, sf );MB_CHK_ERR( rval );
35 
36  rval = mb->load_file( filein.c_str(), &sf );MB_CHK_ERR( rval );
37 
38  double R = 1.; // should be input
39  EntityHandle outSet;
40  rval = mb->create_meshset( MESHSET_SET, outSet );MB_CHK_ERR( rval );
41 
42  rval = IntxUtils::global_gnomonic_projection( mb, sf, R, false, outSet );MB_CHK_ERR( rval );
43  rval = mb->write_file( fileout.c_str(), 0, 0, &outSet, 1 );
44  ;MB_CHK_ERR( rval );
45  // skip the test for 32 bit builds, CHECK_ARRAYS_EQUAL macro is not working correctly
46 #ifndef MOAB_FORCE_32_BIT_HANDLES
47  // check first cell position
48  Range cells;
49  rval = mb->get_entities_by_dimension( outSet, 2, cells );MB_CHK_ERR( rval );
50  EntityHandle firstCell = cells[0];
51  double coords[3];
52  rval = mb->get_coords( &firstCell, 1, coords );MB_CHK_ERR( rval );
53  // check position
54  double values[3] = { -0.78867513420303437, 0.78867513420303437, 0 };
55  CHECK_ARRAYS_EQUAL( coords, 3, values, 3 );
56 #endif
57 
58  return 0;
59 }

References ProgOptions::addOpt(), CHECK_ARRAYS_EQUAL, moab::Core::create_meshset(), ErrorCode, moab::Core::get_coords(), moab::Core::get_entities_by_dimension(), moab::IntxUtils::global_gnomonic_projection(), moab::Core::load_file(), mb, MB_CHK_ERR, MESHSET_SET, ProgOptions::parseCommandLine(), moab::R, STRINGIFY, and moab::Core::write_file().