Definition at line 30 of file ExtractClose.cpp.
35 double x = -0.784768, y = 0.594952, z = -0.173698;
36 double lat = 28.6551, lon = 61.0204;
40 opts.
addOpt<
string >(
"inFile,i",
"Specify the input file name string ", &inputFile );
42 string outFile =
"out.h5m";
43 opts.
addOpt<
string >(
"outFile,o",
"Specify the output file name string ", &outFile );
45 opts.
addOpt<
double >( string(
"xpos,x" ), string(
"x position" ), &x );
46 opts.
addOpt<
double >( string(
"ypos,y" ), string(
"y position" ), &y );
47 opts.
addOpt<
double >( string(
"zpos,z" ), string(
"z position" ), &z );
49 opts.
addOpt<
double >( string(
"latitude,t" ), string(
"north latitude in degrees" ), &lat );
50 opts.
addOpt<
double >( string(
"longitude,w" ), string(
"east longitude in degrees" ), &lon );
52 bool spherical =
false;
53 opts.
addOpt<
void >(
"spherical,s",
"use spherical coords input (default false) ", &spherical );
55 double distance = 0.01;
56 opts.
addOpt<
double >( string(
"distance,d" ), string(
"distance " ), &distance );
65 if( MPI_Init( &argc, &argv ) )
return 1;
66 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
67 MPI_Comm_size( MPI_COMM_WORLD, &numProcesses );
69 readopts = string(
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION" );
82 cout <<
" reading file " << inputFile <<
" on " << numProcesses <<
" task";
83 if( numProcesses > 1 ) cout <<
"s";
100 std::cout <<
" use spherical coordinates on the sphere of radius 1.\n";
103 pos.
lat = lat * M_PI / 180;
104 pos.
lon = lon * M_PI / 180;
105 point = IntxUtils::spherical_to_cart( pos );
115 if( dist <= distance )
117 closeByCells.
insert( cell );
123 int numCells = (int)closeByCells.
size();
127 MPI_Reduce( &numCells, &globalCells, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD );
128 numCells = globalCells;
133 std::cout <<
" no close cells to the point " << point <<
" at distance less than " << distance <<
"\n";
138 std::cout <<
" write file " << outFile <<
" with cells closer than " << distance <<
" from " << point
141 if( numProcesses > 1 ) writeOpts = string(
"PARALLEL=WRITE_PART;" );
146 if( MPI_Finalize() )
return 1;
References moab::Core::add_entities(), ProgOptions::addOpt(), moab::Range::begin(), center(), moab::Core::create_meshset(), moab::Range::end(), ErrorCode, moab::Core::get_coords(), moab::Core::get_entities_by_dimension(), moab::Range::insert(), moab::IntxUtils::SphereCoords::lat, length(), moab::Core::load_file(), moab::IntxUtils::SphereCoords::lon, mb, MB_CHK_ERR, MB_CHK_SET_ERR, MESHSET_SET, ProgOptions::parseCommandLine(), moab::IntxUtils::SphereCoords::R, moab::Range::size(), moab::IntxUtils::spherical_to_cart(), test_file_name, and moab::Core::write_file().