41 string bd_name = string(
MESH_DIR ) + string(
"/../examples/earth/boundary_points.dat" );
42 string loops = string(
MESH_DIR ) + string(
"/../examples/earth/SaveLoopCounts" );
54 lon = atan2( p[1], p[0] );
57 return 2.0 * M_PI + lon;
65 int main(
int argc,
char** argv )
69 if( NULL ==
mb )
return 1;
82 std::vector< double > coords;
83 ifstream bdFile(
bd_name.c_str() );
86 cout << endl <<
"Failed to open file " <<
bd_name << endl;
91 while( !bdFile.eof() )
95 coords.push_back( co );
97 cout <<
" number of boundary points:" << coords.size() / 3 <<
"\n";
99 vector< int > loopsindx;
100 ifstream loopFile(
loops.c_str() );
101 while( !loopFile.eof() )
105 loopsindx.push_back( indx );
107 cout <<
"number of loops: " << loopsindx.size() / 2 <<
"\n";
117 for(
size_t i = 0; i < loopsindx.size() / 2; i++ )
119 num_edges += ( loopsindx[2 * i + 1] - loopsindx[2 * i] + 1 );
125 for(
size_t i = 0; i < loopsindx.size() / 2; i++ )
127 for(
int j = loopsindx[2 * i]; j <= loopsindx[2 * i + 1]; j++ )
131 if( j == loopsindx[2 * i + 1] ) j2 = loopsindx[2 * i] - 1;
132 conn_array[2 * i1] = verts[j - 1];
133 conn_array[2 * i1 + 1] = verts[j2];
139 Range bedges( handle, handle + num_edges - 1 );
147 gids.resize( verts.
size() );
148 for(
int j = 0; j < (int)verts.
size(); j++ )
160 std::vector< CartVect > co3;
161 co3.resize( verts.
size() );
163 for(
size_t i = 0; i < verts.
size(); i++ )
166 double lat1 =
getLat( p );
167 double lon1 =
getLon( p );
168 co3[i] =
CartVect( lon1, lat1, 0. );