31 std::vector<string>& tokens,
32 const string& delimiters );
53 int main(
int argc,
char * argv[] )
57 std::string inputFileName1, inputFileName2;
58 vector< halfsegment >v1, v2, result;
59 int minStrips, maxStrips;
62 std::cerr <<
"usage: exe [input file name 1] [input file name 2] [min strips][max strips]" << std::endl;
66 std::stringstream ss1;
68 ss1 >> inputFileName1;
71 std::stringstream ss1;
73 ss1 >> inputFileName2;
76 std::stringstream ss1;
81 std::stringstream ss1;
87 inFileStrm1.open( argv[1] );
90 cerr <<
"Error: could not open file: " << argv[1] << endl;
94 inFileStrm2.open( argv[2] );
97 cerr <<
"Error: could not open file: " << argv[2] << endl;
101 cerr <<
"Reading files: " << argv[1] <<
", " <<argv[2] << endl;
102 vector<string> splitLine;
107 while(inFileStrm1.good() )
109 getline(inFileStrm1, line);
110 if( inFileStrm1.good() )
112 if( line.size() == 0 || line[0] ==
'#' )
115 string delim(
" \t" );
122 stringstream ss1( splitLine[4] );
124 stringstream ss2( splitLine[5] );
132 v1.push_back( v1[i-1].getBrother() );
136 cerr <<
"file 1 finished reading"<<endl;
138 while(inFileStrm2.good() )
140 getline(inFileStrm2, line);
141 if( inFileStrm2.good() )
143 if( line.size() == 0 || line[0] ==
'#' )
146 string delim(
" \t" );
153 stringstream ss1( splitLine[4] );
155 stringstream ss2( splitLine[5] );
163 v2.push_back( v2[i-1].getBrother() );
167 cerr <<
"file 2 finished reading"<<endl;
170 std::sort( v1.begin(), v1.end() );
171 std::sort( v2.begin(), v2.end() );
172 if( minStrips < 1 ) {
175 for(
int i = minStrips; i <= maxStrips; i= (i==1)? 2: i*2 ){
177 cout <<
"TTT num strips: " << i << endl;
184 cout <<
"num segs: " << result.size()/2<<endl;
191 void tokenizeString(
const std::string& str, std::vector<string>& tokens,
const string& delimiters )
193 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
194 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
196 while (std::string::npos != pos || std::string::npos != lastPos)
198 tokens.push_back(str.substr(lastPos, pos - lastPos));
199 lastPos = str.find_first_not_of(delimiters, pos);
200 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[])