6 void add(std::vector<std::pair<int,int> >& v, int i1, int i2)
8 v.push_back(std::make_pair<int,int>(i1,i2));
11 std::vector<std::pair<int,int> > make_pattern(const std::string& what)
13 std::vector<std::pair<int,int> > cols;
15 if ( what == "L5" || what == "L23" )
17 cols.push_back(std::make_pair<int,int>(0,40)); // starting at zero, length = 40
18 cols.push_back(std::make_pair<int,int>(0,24));
20 else if ( what == "Z1" || what == "Z5" || what == "Z8" )
22 cols.push_back(std::make_pair<int,int>(24,16));
23 cols.push_back(std::make_pair<int,int>(0,40));
24 cols.push_back(std::make_pair<int,int>(0,8));
26 else if ( what == "O9" || what == "O10" || what == "O11" || what == "O12"
27 || what == "O18" || what == "O19" || what == "O20" ||
28 what == "O23" || what == "O24" )
33 else if ( what == "Z2" || what == "Z7" )
35 cols.push_back(std::make_pair<int,int>(0,8));
36 cols.push_back(std::make_pair<int,int>(0,40));
37 cols.push_back(std::make_pair<int,int>(24,16));
39 else if ( what == "L6" )
41 cols.push_back(std::make_pair<int,int>(0,24));
42 cols.push_back(std::make_pair<int,int>(0,40));
44 else if ( what == "L7" || what == "L21" )
46 cols.push_back(std::make_pair<int,int>(0,40));
47 cols.push_back(std::make_pair<int,int>(16,24));
49 else if ( what == "Z3" || what == "Z6" )
51 cols.push_back(std::make_pair<int,int>(0,16));
52 cols.push_back(std::make_pair<int,int>(0,40));
53 cols.push_back(std::make_pair<int,int>(32,8));
55 else if ( what == "Z4" )
57 cols.push_back(std::make_pair<int,int>(32,8));
58 cols.push_back(std::make_pair<int,int>(0,40));
59 cols.push_back(std::make_pair<int,int>(0,16));
61 else if ( what == "L8" )
63 cols.push_back(std::make_pair<int,int>(16,24));
64 cols.push_back(std::make_pair<int,int>(0,40));
66 else if ( what == "L3" )
68 for ( int i = 0; i < 4; ++i ) add(cols,0,4);
69 for ( int i = 0; i < 16; ++i ) add(cols,1,3);
71 else if ( what == "O4" )
73 for ( int i = 0; i < 16; ++i ) add(cols,0,4);
75 else if ( what == "L4" )
77 for ( int i = 0; i < 16; ++i ) add(cols,1,3);
78 for ( int i = 0; i < 4; ++i ) add(cols,0,4);
80 else if ( what == "P3" )
82 for ( int i = 0; i < 4; ++i ) add(cols,0,4);
83 for ( int i = 0; i < 8; ++i ) add(cols,0,5);
84 for ( int i = 0; i < 2; ++i ) add(cols,0,4);
86 else if ( what == "Q3" )
88 for ( int i = 0; i < 2; ++i ) add(cols,4,1);
89 for ( int i = 0; i < 6; ++i ) add(cols,0,5);
90 for ( int i = 0; i < 8; ++i ) add(cols,0,4);
92 else if ( what == "Q4" )
94 for ( int i = 0; i < 8; ++i ) add(cols,0,4);
95 for ( int i = 0; i < 6; ++i ) add(cols,0,5);
96 for ( int i = 0; i < 2; ++i ) add(cols,4,1);
99 else if ( what == "P4" )
101 for ( int i = 0; i < 2; ++i ) add(cols,0,4);
102 for ( int i = 0; i < 8; ++i ) add(cols,0,5);
103 for ( int i = 0; i < 4; ++i ) add(cols,0,4);
105 else if ( what == "O1" || what == "O2" || what == "O13" ||
106 what == "O15" || what == "O16" || what == "O21" || what == "O22" )
108 for ( int i = 0; i < 8; ++i ) add(cols,0,8);
110 else if ( what == "O5" || what == "O6" || what == "O7" || what == "O8" )
112 for ( int i = 0; i < 28; ++i ) add(cols,0,2);
114 else if ( what == "L9" )
119 else if ( what == "L10" )
124 else if ( what == "O14" )
126 for ( int i = 0; i < 4; ++i )
131 else if ( what == "R1" )
140 else if ( what == "R2" )
153 else if ( what == "R3" )
167 else if ( what == "R4" )
180 else if ( what == "R5" )
191 else if ( what == "R6" )
204 else if ( what == "R7" )
217 else if ( what == "R8" )
228 else if ( what == "R9" )
237 else if ( what == "R10" )
244 else if ( what == "R11" )
251 else if ( what == "R12" )
258 else if ( what == "R13" )
271 else if ( what == "R14" )
273 for ( int i = 0; i < 5; ++i ) add(cols,1,8);
274 for ( int i = 0; i < 3; ++i ) add(cols,0,8);
276 else if ( what == "R15" )
278 for ( int i = 0; i < 3; ++i ) add(cols,9,1);
279 for ( int i = 0; i < 4; ++i ) add(cols,1,9);
280 for ( int i = 0; i < 2; ++i ) add(cols,1,8);
281 for ( int i = 0; i < 1; ++i ) add(cols,0,9);
283 else if ( what == "R16" )
285 for ( int i = 0; i < 3; ++i ) add(cols,10,1);
286 for ( int i = 0; i < 3; ++i ) add(cols,1,10);
287 for ( int i = 0; i < 2; ++i ) add(cols,1,9);
288 for ( int i = 0; i < 1; ++i ) add(cols,0,10);
289 for ( int i = 0; i < 1; ++i ) add(cols,0,3);
291 else if ( what == "R17" )
293 for ( int i = 0; i < 3; ++i ) add(cols,11,1);
295 for ( int i = 0; i < 2; ++i ) add(cols,1,11);
296 for ( int i = 0; i < 2; ++i ) add(cols,0,11);
297 for ( int i = 0; i < 1; ++i ) add(cols,0,9);
299 else if ( what == "R18" )
301 for ( int i = 0; i < 2; ++i ) add(cols,13,1);
304 for ( int i = 0; i < 3; ++i ) add(cols,1,13);
307 else if ( what == "R19" )
310 for ( int i = 0; i < 2; ++i ) add(cols,1,14);
311 for ( int i = 0; i < 2; ++i ) add(cols,0,15);
313 else if ( what == "R20" )
315 for ( int i = 0; i < 5; ++i ) add(cols,0,11);
318 else if ( what == "R21" )
321 for ( int i = 0; i < 5; ++i ) add(cols,0,11);
324 else if ( what == "R22" )
327 for ( int i = 0; i < 2; ++i ) add(cols,1,11);
328 for ( int i = 0; i < 3; ++i ) add(cols,0,12);
331 else if ( what == "R23" )
334 for ( int i = 0; i < 4; ++i ) add(cols,0,12);
337 else if ( what == "R24" )
340 for ( int i = 0; i < 4; ++i ) add(cols,0,13);
343 else if ( what == "R25" )
346 for ( int i = 0; i < 3; ++i ) add(cols,0,14);
349 else if ( what == "R26" )
352 for ( int i = 0; i < 2; ++i ) add(cols,1,7);
353 for ( int i = 0; i < 6; ++i ) add(cols,0,8);
355 else if ( what == "R27" )
360 else if ( what == "R28" )
365 else if ( what == "R29" )
370 else if ( what == "L11" )
375 else if ( what == "R31" )
380 else if ( what == "R32" )
385 else if ( what == "R33" )
390 else if ( what == "L12" || what == "L14" || what == "L16" )
395 else if ( what == "R34" )
400 else if ( what == "L13" || what == "L15" || what == "L17" )
405 else if ( what == "R30" )
411 else if ( what == "R35" )
413 for ( int i = 0; i < 3; ++i ) add(cols,9,1);
414 for ( int i = 0; i < 2; ++i ) add(cols,8,2);
416 for ( int i = 0; i < 2; ++i ) add(cols,6,4);
418 for ( int i = 0; i < 4; ++i ) add(cols,0,10);
420 else if ( what == "R36" )
422 for ( int i = 0; i < 6; ++i ) add(cols,0,10);
425 else if ( what == "R37" )
428 for ( int i = 0; i < 4; ++i ) add(cols,0,10);
429 for ( int i = 0; i < 2; ++i ) add(cols,1,9);
431 else if ( what == "R38" )
433 for ( int i = 0; i < 3; ++i ) add(cols,0,1);
434 for ( int i = 0; i < 2; ++i ) add(cols,0,2);
436 for ( int i = 0; i < 2; ++i ) add(cols,0,4);
437 for ( int i = 0; i < 7; ++i ) add(cols,0,6);
440 else if ( what == "R39" )
443 for ( int i = 0; i < 8; ++i ) add(cols,0,6);
444 for ( int i = 0; i < 2; ++i ) add(cols,0,7);
446 else if ( what == "R40" )
452 else if ( what == "R41" )
458 else if ( what == "R42" )
463 else if ( what == "I1" )
467 else if ( what == "L18" )
472 else if ( what == "L22" )
477 else if ( what == "L19" )
482 else if ( what == "L20" )
487 else if ( what == "D1" ) // dummy big motif of 16x80 to test
489 for ( int i = 0; i < 16; ++i )
494 else if ( what == "R43" )
500 else if ( what == "L24")
505 else if ( what == "R44" )
510 else if ( what == "L25" )
515 else if ( what == "R45" )
521 else if ( what == "A1" )
523 for ( int i = 0; i < 6; ++i )
527 for ( int i = 0; i < 2; ++i )
533 else if ( what == "A2" )
536 for ( int i = 0; i < 3; ++i )
542 else if ( what == "A3" )
545 for ( int i = 0; i < 4; ++i )
551 else if ( what == "A4" )
554 for ( int i = 0; i < 4; ++i )
560 else if ( what == "A5" )
563 for ( int i = 0; i < 3; ++i )
571 else if ( what == "A6" )
574 for ( int i = 0; i < 5; ++i )
580 else if ( what == "A7" )
583 for ( int i = 0; i < 5; ++i )
588 else if ( what == "A8" )
594 else if ( what == "A9" )
599 else if ( what == "A18" || what == "A19" )
604 else if ( what == "A17" )
609 else if ( what == "A19" || what == "A16" )
614 else if ( what == "A15" )
619 else if ( what == "A14" )
624 else if ( what == "A13" )
629 else if ( what == "A12" )
634 else if ( what == "A11" )
639 else if ( what == "A10" )
644 else if ( what == "C1" )
654 else if ( what == "C2" )
657 for ( int i = 0; i < 6; ++i )
662 else if ( what == "C3" )
664 for ( int i = 0; i < 4; ++i )
678 else if ( what == "C4" )
681 for ( int i = 0; i < 7; ++i )
694 else if ( what == "C5" )
698 for ( int i = 0; i < 8; ++i )
704 else if ( what == "C6" )
709 else if ( what == "C7" )
714 else if ( what == "C8" )
719 else if ( what == "C9" )
725 else if ( what == "C10" )
731 else if ( what == "O25" )
736 else if ( what == "O26" )
738 for ( int i = 0; i < 4; ++i )
743 else if ( what == "E1" )
751 else if ( what == "E2" )
762 else if ( what == "E3" )
774 else if ( what == "E4" )
787 else if ( what == "E5" )
800 else if ( what == "E6" )
802 for (int i = 0; i < 3; ++ i )
806 for (int i = 0; i < 5; ++ i )
811 else if ( what == "O27" )
813 for (int i = 0; i < 8; ++ i )
818 else if ( what == "E7" )
826 else if ( what == "E8" )
832 else if ( what == "E9" )
840 else if ( what == "E10" )
848 else if ( what == "E11" )
856 else if ( what == "E12" )
863 else if ( what == "E13" )
871 else if ( what == "E14" )
879 else if ( what == "E15" )
886 else if ( what == "E16" )
892 else if ( what == "E17" )
897 else if ( what == "E18" )
902 else if ( what == "E19" )
907 else if ( what == "S0" )
912 else if ( what == "S1" )
918 else if ( what == "S2" || what == "S6" )
923 else if ( what == "S3" )
929 else if ( what == "S4" )
933 else if ( what == "S5" )
938 else if ( what == "S7" )
944 else if ( what == "S8" )
952 void makePadPos(const char* padposfile /*="padPosTest.dat"*/, const char* type)
954 std::ofstream out(padposfile);
958 std::vector<std::pair<int,int> > cols = make_pattern(type);
962 for ( size_t i = 0; i < cols.size(); ++i )
964 std::pair<int,int> p = cols[i];
965 if ( p.first < 0 ) --c;
966 for ( int j = abs(p.first); j < abs(p.first)+p.second; ++j )
968 out << n << "\t" << c << "\t" << j << std::endl;
976 int main(int argc, char** argv)
978 makePadPos(argv[1],argv[2]);