45 string bd_name = string(
MESH_DIR ) + string(
"/../examples/earth/boundary_points.dat" );
46 string loops = string(
MESH_DIR ) + string(
"/../examples/earth/SaveLoopCounts" );
59 lon = atan2( p[1], p[0] );
63 return 2.0 * M_PI + lon;
74 bool interior_point( vector< double >& coords,
int& startLoop,
int& endLoop,
double lat,
double lon )
78 double totalAngle = 0;
79 for(
int i = startLoop; i <= endLoop; i++ )
81 double x1 = coords[2 * i], y1 = coords[2 * i + 1];
83 if( i == endLoop ) i2 = startLoop;
84 double x2 = coords[2 * i2], y2 = coords[2 * i2 + 1];
85 CartVect P1( x1 - lat, y1 - lon, 0. );
86 CartVect P2( x2 - lat, y2 - lon, 0. );
88 double angle1 =
angle( P1, P2 );
89 if(
cross[2] < 0 ) angle1 = -angle1;
92 if( fabs( totalAngle + 2 * M_PI ) < 0.1 || fabs( totalAngle - 2 * M_PI ) < 0.1 )
return true;
96 int main(
int argc,
char** argv )
100 if( NULL ==
mb )
return 1;
108 cout <<
"input file : " <<
input_file <<
"\n";
109 std::vector< double > coords;
110 ifstream bdFile(
bd_name.c_str() );
113 cout << endl <<
"Failed to open file " <<
bd_name << endl;
118 while( !bdFile.eof() )
122 coords.push_back( co );
124 cout <<
" number of boundary points:" << coords.size() / 3 <<
"\n";
126 vector< int > loopsindx;
127 ifstream loopFile(
loops.c_str() );
128 while( !loopFile.eof() )
132 loopsindx.push_back( indx );
134 cout <<
"number of loops: " << loopsindx.size() / 2 <<
"\n";
138 vector< double > coords2d;
139 coords2d.resize( coords.size() / 3 * 2 );
140 for(
int i = 0; i < (int)coords.size() / 3; i++ )
142 CartVect p( coords[3 * i], coords[3 * i + 1], coords[3 * i + 2] );
143 coords2d[2 * i] =
getLat( p );
144 coords2d[2 * i + 1] =
getLon( p );
153 cout <<
"number of cells: " << cells.
size() <<
"\n";
159 "Trouble creating continent tag" );
161 for(
int loop_index = 0; loop_index < 6; loop_index++ )
164 int startLoop = loopsindx[2 * loop_index];
165 int endLoop = loopsindx[2 * loop_index + 1];
167 vector< EntityHandle > interiorCells;
181 interiorCells.push_back( cell );
187 "Can't add entities to set" );
190 std::stringstream islandFile;
192 islandFile <<
"map.h5m";