54 std::vector<string>& tokens,
55 const string& delimiters );
75 int main(
int argc,
char * argv[] )
78 std::string inputFileName1, inputFileName2;
79 vector< halfsegment >v1, v2, result;
80 int minStrips, maxStrips;
83 std::cerr <<
"usage: exe [input file name 1] [input file name 2] [min strips][max strips]" << std::endl;
87 std::stringstream ss1;
89 ss1 >> inputFileName1;
92 std::stringstream ss1;
94 ss1 >> inputFileName2;
97 std::stringstream ss1;
102 std::stringstream ss1;
107 ifstream inFileStrm1;
108 inFileStrm1.open( argv[1] );
111 cerr <<
"Error: could not open file: " << argv[1] << endl;
114 ifstream inFileStrm2;
115 inFileStrm2.open( argv[2] );
118 cerr <<
"Error: could not open file: " << argv[2] << endl;
122 cerr <<
"Reading files: " << argv[1] <<
", " <<argv[2] << endl;
123 vector<string> splitLine;
128 while(inFileStrm1.good() )
130 getline(inFileStrm1, line);
131 if( inFileStrm1.good() )
133 if( line.size() == 0 || line[0] ==
'#' )
136 string delim(
" \t" );
143 stringstream ss1( splitLine[4] );
145 stringstream ss2( splitLine[5] );
153 v1.push_back( v1[i-1].getBrother() );
157 cerr <<
"file 1 finished reading"<<endl;
159 while(inFileStrm2.good() )
161 getline(inFileStrm2, line);
162 if( inFileStrm2.good() )
164 if( line.size() == 0 || line[0] ==
'#' )
167 string delim(
" \t" );
174 stringstream ss1( splitLine[4] );
176 stringstream ss2( splitLine[5] );
184 v2.push_back( v2[i-1].getBrother() );
188 cerr <<
"file 2 finished reading"<<endl;
191 std::sort( v1.begin(), v1.end() );
192 std::sort( v2.begin(), v2.end() );
193 if( minStrips < 1 ) {
196 for(
int i = minStrips; i <= maxStrips; i= (i==1)? 2: i*2 ){
197 cout <<
"*** num strips: " << i << endl;
206 cout <<
"num segs: " << result.size()/2<<endl;
212 void tokenizeString(
const std::string& str, std::vector<string>& tokens,
const string& delimiters )
214 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
215 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
217 while (std::string::npos != pos || std::string::npos != lastPos)
219 tokens.push_back(str.substr(lastPos, pos - lastPos));
220 lastPos = str.find_first_not_of(delimiters, pos);
221 pos = str.find_first_of(delimiters, lastPos);
holds a single halfsegment, along with labeling information and information indicating if the opposin...
void parallelOverlay(vector< halfsegment > &r1, vector< halfsegment > &r2, vector< halfsegment > &result, int numStrips, int numWorkerThreads)
void tokenizeString(const std::string &str, std::vector< string > &tokens, const string &delimiters)
void overlayPlaneSweep(const halfsegment r1[], int r1Size, const halfsegment r2[], int r2Size, vector< halfsegment > &result)
static double hex2d(const string &hexer)
int main(int argc, char *argv[])