Orbiter 2022
Combinatorial Objects
data_input_stream.cpp
Go to the documentation of this file.
1/*
2 * data_input_stream.cpp
3 *
4 * Created on: Nov 27, 2021
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13using namespace std;
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace data_structures {
19
20
22{
23 Descr = NULL;
24
26
27 // Objects;
28
29}
30
32{
33}
34
36{
37 int f_v = (verbose_level >= 1);
38
39 if (f_v) {
40 cout << "data_input_stream::init" << endl;
41 }
42
44
46
47 if (f_v) {
48 cout << "data_input_stream::init nb_objects_to_test=" << nb_objects_to_test << endl;
49 }
50
51 if (f_v) {
52 cout << "data_input_stream::init before read_objects" << endl;
53 }
54
55 read_objects(verbose_level);
56
57 if (f_v) {
58 cout << "data_input_stream::init after read_objects" << endl;
59 }
60
61 if (f_v) {
62 cout << "data_input_stream::init done" << endl;
63 }
64}
65
67{
68 int f_v = (verbose_level >= 1);
69 int input_idx, nb_obj;
72
73 if (f_v) {
74 cout << "data_input_stream::count_number_of_objects_to_test" << endl;
75 }
77 for (input_idx = 0; input_idx < Descr->nb_inputs; input_idx++) {
78 cout << "input " << input_idx << " / " << Descr->nb_inputs
79 << " is:" << endl;
80
81 if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_points) {
82 if (f_v) {
83 cout << "input set of points "
84 << Descr->Input[input_idx].input_string << ":" << endl;
85 }
86
88
89 }
90 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_lines) {
91 if (f_v) {
92 cout << "input set of lines "
93 << Descr->Input[input_idx].input_string << ":" << endl;
94 }
95
97
98 }
99 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_points_and_lines) {
100 if (f_v) {
101 cout << "input set of points and lines "
102 << Descr->Input[input_idx].input_string << " "
103 << Descr->Input[input_idx].input_string2 << ":" << endl;
104 }
105
107
108 }
109 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_packing) {
110 if (f_v) {
111 cout << "input set of packing "
112 << Descr->Input[input_idx].input_string << ":" << endl;
113 }
114
116
117 }
118 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_points) {
119 if (f_v) {
120 cout << "input sets of points from file "
121 << Descr->Input[input_idx].input_string << ":" << endl;
122 }
124 Descr->Input[input_idx].input_string, 0 /* verbose_level*/);
125 if (f_v) {
126 cout << "The file " << Descr->Input[input_idx].input_string
127 << " has " << nb_obj << " objects" << endl;
128 }
129
130 nb_objects_to_test += nb_obj;
131 }
132 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_lines) {
133 if (f_v) {
134 cout << "input sets of lines from file "
135 << Descr->Input[input_idx].input_string << ":" << endl;
136 }
138 Descr->Input[input_idx].input_string, 0 /* verbose_level*/);
139 if (f_v) {
140 cout << "The file " << Descr->Input[input_idx].input_string
141 << " has " << nb_obj << " objects" << endl;
142 }
143
144 nb_objects_to_test += nb_obj;
145 }
146 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_packings) {
147 if (f_v) {
148 cout << "input sets of packings from file "
149 << Descr->Input[input_idx].input_string << ":" << endl;
150 }
152 Descr->Input[input_idx].input_string, 0 /* verbose_level*/);
153 if (f_v) {
154 cout << "The file " << Descr->Input[input_idx].input_string
155 << " has " << nb_obj << " objects" << endl;
156 }
157
158 nb_objects_to_test += nb_obj;
159 }
160 else if (Descr->Input[input_idx].input_type ==
162 if (f_v) {
163 cout << "input sets of packings from file "
164 << Descr->Input[input_idx].input_string << endl;
165 cout << "through spread table "
166 << Descr->Input[input_idx].input_string2 << " :" << endl;
167 }
168 //nb_obj = Fio.count_number_of_orbits_in_file(
169 // Descr->input_string[input_idx], 0 /* verbose_level*/);
170
171 set_of_sets *SoS;
172
173 SoS = NEW_OBJECT(set_of_sets);
174
175 int underlying_set_size = 0;
176
177 if (f_v) {
178 cout << "data_input_stream::count_number_of_objects_to_test "
179 "Reading the file " << Descr->Input[input_idx].input_string << endl;
180 }
181 SoS->init_from_file(
182 underlying_set_size,
183 Descr->Input[input_idx].input_string, verbose_level);
184 if (f_v) {
185 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
186 }
187
188 nb_obj = SoS->nb_sets;
189
190 FREE_OBJECT(SoS);
191
192
193 if (f_v) {
194 cout << "The file " << Descr->Input[input_idx].input_string
195 << " has " << nb_obj << " objects" << endl;
196 }
197
198 nb_objects_to_test += nb_obj;
199 }
200 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_point_set) {
201 if (f_v) {
202 cout << "input set of points from file "
203 << Descr->Input[input_idx].input_string << ":" << endl;
204 }
205 nb_obj = 1;
206 if (f_v) {
207 cout << "The file " << Descr->Input[input_idx].input_string
208 << " has " << nb_obj << " objects" << endl;
209 }
210
211 nb_objects_to_test += nb_obj;
212 }
213 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_designs) {
214 if (f_v) {
215 cout << "input designs from file "
216 << Descr->Input[input_idx].input_string << ":" << endl;
217 }
218 {
219 set_of_sets *SoS;
220 int nck;
222
223 nck = Combi.int_n_choose_k(Descr->Input[input_idx].input_data1, Descr->Input[input_idx].input_data3);
224 SoS = NEW_OBJECT(set_of_sets);
225
226 cout << "classify_objects_using_nauty Reading the file " << Descr->Input[input_idx].input_string
227 << " which contains designs on " << Descr->Input[input_idx].input_data1 << " points, nck=" << nck << endl;
228 SoS->init_from_file(
229 nck /* underlying_set_size */,
230 Descr->Input[input_idx].input_string, verbose_level);
231 cout << "Read the file " << Descr->Input[input_idx].input_string << endl;
232 nb_obj = SoS->nb_sets;
233 FREE_OBJECT(SoS);
234 }
235 if (f_v) {
236 cout << "The file " << Descr->Input[input_idx].input_string
237 << " has " << nb_obj << " objects" << endl;
238 }
239
240 nb_objects_to_test += nb_obj;
241 }
242 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_incidence_geometries) {
243 if (f_v) {
244 cout << "input incidence geometries from file "
245 << Descr->Input[input_idx].input_string << ":" << endl;
246 }
248 int m, n, nb_flags;
249
250 std::vector<std::vector<int> > Geos;
251
252 Fio.read_incidence_file(Geos, m, n, nb_flags, Descr->Input[input_idx].input_string, verbose_level);
253 if (f_v) {
254 cout << "input incidence geometries from file "
255 "the file contains " << Geos.size() << "incidence geometries" << endl;
256 }
257 nb_objects_to_test += Geos.size();
258 if (Descr->Input[input_idx].input_data1 != m) {
259 cout << "v does not match" << endl;
260 exit(1);
261 }
262 if (Descr->Input[input_idx].input_data2 != n) {
263 cout << "b does not match" << endl;
264 exit(1);
265 }
266 if (Descr->Input[input_idx].input_data3 != nb_flags) {
267 cout << "nb_flags does not match" << endl;
268 exit(1);
269 }
270 }
272 if (f_v) {
273 cout << "input incidence geometries by row ranks from file "
274 << Descr->Input[input_idx].input_string << ":" << endl;
275 }
277 int m, n, r;
278
279 std::vector<std::vector<int> > Geos;
280
281 Fio.read_incidence_by_row_ranks_file(Geos, m, n, r, Descr->Input[input_idx].input_string, verbose_level);
282 if (f_v) {
283 cout << "input incidence geometries from file "
284 "the file contains " << Geos.size() << "incidence geometries" << endl;
285 }
286 nb_objects_to_test += Geos.size();
287 if (Descr->Input[input_idx].input_data1 != m) {
288 cout << "v does not match" << endl;
289 exit(1);
290 }
291 if (Descr->Input[input_idx].input_data2 != n) {
292 cout << "b does not match" << endl;
293 exit(1);
294 }
295 if (Descr->Input[input_idx].input_data3 != r) {
296 cout << "r does not match" << endl;
297 exit(1);
298 }
299 }
300 else if (Descr->Input[input_idx].input_type == t_data_input_stream_incidence_geometry) {
301 if (f_v) {
302 cout << "input incidence geometry directly "
303 << Descr->Input[input_idx].input_string << ":" << endl;
304 }
306 }
307 else if (Descr->Input[input_idx].input_type == t_data_input_stream_incidence_geometry_by_row_ranks) {
308 if (f_v) {
309 cout << "input incidence geometry directly "
310 << Descr->Input[input_idx].input_string << ":" << endl;
311 }
313 }
314 else if (Descr->Input[input_idx].input_type == t_data_input_stream_from_parallel_search) {
315 if (f_v) {
316 cout << "input from parallel search" << endl;
317 }
318
319 int nb_cases = Descr->Input[input_idx].input_data1;
320 string mask;
321 string cases_fname;
322
323 mask.assign(Descr->Input[input_idx].input_string);
324 cases_fname.assign(Descr->Input[input_idx].input_string2);
325
326 if (f_v) {
327 cout << "input from parallel search, mask=" << mask << endl;
328 cout << "input from parallel search, nb_cases=" << nb_cases << endl;
329 cout << "input from parallel search, cases_fname=" << cases_fname << endl;
330 }
331
333 int i;
334
335
336 for (i = 0; i < nb_cases; i++) {
337
338
339 char str[1000];
340 string fname;
341
342
343 sprintf(str, mask.c_str(), i);
344 fname.assign(str);
345
346 set_of_sets *SoS;
347 int underlying_set_size = 0;
348 int nb_sol;
349
350 SoS = NEW_OBJECT(set_of_sets);
351 SoS->init_from_orbiter_file(underlying_set_size,
352 fname, 0 /*verbose_level*/);
353 nb_sol = SoS->nb_sets;
354 if (f_v) {
355 cout << "objects from file " << i << " / " << nb_cases <<
356 " the file contains " << nb_sol << " sets" << endl;
357 }
358 nb_objects_to_test += nb_sol;
359 FREE_OBJECT(SoS);
360 }
361 }
362 else {
363 cout << "unknown input type" << endl;
364 exit(1);
365 }
366 }
367
368 if (f_v) {
369 cout << "data_input_stream::count_number_of_objects_to_test done" << endl;
370 }
371 return nb_objects_to_test;
372}
373
374void data_input_stream::read_objects(int verbose_level)
375{
376 int f_v = (verbose_level >= 1);
377 int input_idx;
378
379
380 if (f_v) {
381 cout << "data_input_stream::read_objects" << endl;
382 }
383
384 for (input_idx = 0; input_idx < Descr->nb_inputs; input_idx++) {
385 if (f_v) {
386 cout << "data_input_stream::read_objects "
387 "input " << input_idx << " / " << Descr->nb_inputs
388 << " is:" << endl;
389 }
390
391 if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_points) {
392
393 if (f_v) {
394 cout << "data_input_stream::read_objects "
395 "input set of points "
396 << Descr->Input[input_idx].input_string << ":" << endl;
397 }
398
400
401
403
405 Descr->Input[input_idx].input_string /*set_text*/,
406 verbose_level);
407
408 Objects.push_back(OwCF);
409
410 }
411 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_point_set) {
412
414 long int *the_set;
415 int set_size;
417
418 Fio.read_set_from_file(Descr->Input[input_idx].input_string, the_set, set_size, verbose_level);
419
421
422 OwCF->init_point_set(the_set, set_size, verbose_level);
423
424 FREE_lint(the_set);
425
426 Objects.push_back(OwCF);
427
428 }
429 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_lines) {
430
432
434
436 Descr->Input[input_idx].input_string /*set_text*/,
437 verbose_level);
438
439 Objects.push_back(OwCF);
440
441 }
442 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_points_and_lines) {
443
445
446
448
450 Descr->Input[input_idx].input_string /*set_text*/,
451 Descr->Input[input_idx].input_string2 /*set2_text*/,
452 verbose_level);
453
454 Objects.push_back(OwCF);
455
456 }
457 else if (Descr->Input[input_idx].input_type == t_data_input_stream_set_of_packing) {
458
460 int q;
461
462 q = Descr->Input[input_idx].input_data1;
463
464
466
468 Descr->Input[input_idx].input_string /*packing_text*/,
469 q,
470 verbose_level);
471
472 Objects.push_back(OwCF);
473
474 }
475 else if (Descr->Input[input_idx].input_type == t_data_input_stream_incidence_geometry) {
476
478
479
481
483 Descr->Input[input_idx].input_string,
484 Descr->Input[input_idx].input_data1 /*v*/,
485 Descr->Input[input_idx].input_data2 /*b*/,
486 Descr->Input[input_idx].input_data3 /*nb_flags*/,
487 verbose_level);
488
489 Objects.push_back(OwCF);
490
491 }
492 else if (Descr->Input[input_idx].input_type == t_data_input_stream_incidence_geometry_by_row_ranks) {
493
495
496
498
500 Descr->Input[input_idx].input_string,
501 Descr->Input[input_idx].input_data1 /*v*/,
502 Descr->Input[input_idx].input_data2 /*b*/,
503 Descr->Input[input_idx].input_data3 /*r*/,
504 verbose_level);
505
506 Objects.push_back(OwCF);
507
508 }
509 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_incidence_geometries) {
510 if (f_v) {
511 cout << "input incidence geometries from file "
512 << Descr->Input[input_idx].input_string << ":" << endl;
513 }
515 int m, n, nb_flags;
516
517 std::vector<std::vector<int> > Geos;
518
519 Fio.read_incidence_file(Geos, m, n, nb_flags, Descr->Input[input_idx].input_string, verbose_level);
520 if (f_v) {
521 cout << "input incidence geometries from file "
522 "the file contains " << Geos.size() << "incidence geometries" << endl;
523 }
524 int h;
525
526 if (Descr->Input[input_idx].input_data1 != m) {
527 cout << "v does not match" << endl;
528 exit(1);
529 }
530 if (Descr->Input[input_idx].input_data2 != n) {
531 cout << "b does not match" << endl;
532 exit(1);
533 }
534 if (Descr->Input[input_idx].input_data3 != nb_flags) {
535 cout << "f does not match" << endl;
536 exit(1);
537 }
538
539 for (h = 0; h < Geos.size(); h++) {
541
542
544
546 Geos[h],
547 Descr->Input[input_idx].input_data1 /*v*/,
548 Descr->Input[input_idx].input_data2 /*b*/,
549 Descr->Input[input_idx].input_data3 /*nb_flags*/,
550 verbose_level);
551
552 Objects.push_back(OwCF);
553
554 }
555 }
557 if (f_v) {
558 cout << "input incidence geometries from file "
559 << Descr->Input[input_idx].input_string << " by row ranks:" << endl;
560 }
562 int m, n, r;
563
564 std::vector<std::vector<int> > Geos;
565
566 Fio.read_incidence_by_row_ranks_file(Geos, m, n, r, Descr->Input[input_idx].input_string, verbose_level);
567 if (f_v) {
568 cout << "input incidence geometries from file "
569 "the file contains " << Geos.size() << "incidence geometries" << endl;
570 }
571 int h;
572
573 if (Descr->Input[input_idx].input_data1 != m) {
574 cout << "v does not match" << endl;
575 exit(1);
576 }
577 if (Descr->Input[input_idx].input_data2 != n) {
578 cout << "b does not match" << endl;
579 exit(1);
580 }
581 if (Descr->Input[input_idx].input_data3 != r) {
582 cout << "r does not match" << endl;
583 exit(1);
584 }
585
586 for (h = 0; h < Geos.size(); h++) {
588
589
591
593 Geos[h],
594 Descr->Input[input_idx].input_data1 /*v*/,
595 Descr->Input[input_idx].input_data2 /*b*/,
596 Geos[h].size() /*nb_flags*/,
597 verbose_level);
598
599 Objects.push_back(OwCF);
600
601 }
602 }
603 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_designs) {
604
605 int v, b, k, design_sz;
606
607 v = Descr->Input[input_idx].input_data1;
608 b = Descr->Input[input_idx].input_data2;
609 k = Descr->Input[input_idx].input_data3;
610 design_sz = Descr->Input[input_idx].input_data4;
611
612 set_of_sets *SoS;
613
614 SoS = NEW_OBJECT(set_of_sets);
615
616 int underlying_set_size = 0;
617
618 if (f_v) {
619 cout << "data_input_stream::read_objects "
620 "Reading the file " << Descr->Input[input_idx].input_string << endl;
621 }
622 SoS->init_from_file(
623 underlying_set_size,
624 Descr->Input[input_idx].input_string, verbose_level);
625 if (f_v) {
626 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
627 }
628
629 int h;
630
631 for (h = 0; h < SoS->nb_sets; h++) {
632
633 if ((h % 1000) == 0) {
634 cout << "data_input_stream::read_objects " << h << " / " << SoS->nb_sets << endl;
635 }
636
638
639
641
642 OwCF->init_large_set(
643 SoS->Sets[h], SoS->Set_size[h], v, b, k, design_sz,
644 0 /*verbose_level*/);
645
646 Objects.push_back(OwCF);
647 }
648
649 FREE_OBJECT(SoS);
650 }
651
652 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_packings_through_spread_table) {
653
654 int q;
655
656 q = Descr->Input[input_idx].input_data1;
657
659 long int *Spread_table;
660 int nb_spreads;
661 int spread_size;
662
663 if (f_v) {
664 cout << "data_input_stream::read_objects "
665 "Reading spread table from file "
666 << Descr->Input[input_idx].input_string2 << endl;
667 }
668
669 Fio.lint_matrix_read_csv(Descr->Input[input_idx].input_string2,
670 Spread_table, nb_spreads, spread_size,
671 0 /* verbose_level */);
672
673 if (f_v) {
674 cout << "Reading spread table from file "
675 << Descr->Input[input_idx].input_string2 << " done" << endl;
676 cout << "The spread table contains " << nb_spreads
677 << " spreads" << endl;
678 }
679
680
681 set_of_sets *SoS;
682
683 SoS = NEW_OBJECT(set_of_sets);
684
685 int underlying_set_size = 0;
686
687 if (f_v) {
688 cout << "data_input_stream::read_objects "
689 "Reading the file " << Descr->Input[input_idx].input_string << endl;
690 }
691 SoS->init_from_file(
692 underlying_set_size,
693 Descr->Input[input_idx].input_string, verbose_level);
694 if (f_v) {
695 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
696 }
697
698 int h;
699
700 for (h = 0; h < SoS->nb_sets; h++) {
701
702
704
705
707
709 SoS->Sets[h],
710 Spread_table, nb_spreads, spread_size,
711 q,
712 verbose_level);
713
714 Objects.push_back(OwCF);
715 }
716 FREE_lint(Spread_table);
717
718 FREE_OBJECT(SoS);
719
720 }
721
722
723 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_packings) {
724
725 set_of_sets *SoS;
726
727 SoS = NEW_OBJECT(set_of_sets);
728
729 int underlying_set_size = 0;
730
731 if (f_v) {
732 cout << "data_input_stream::read_objects "
733 "Reading the file " << Descr->Input[input_idx].input_string << endl;
734 }
735 SoS->init_from_file(
736 underlying_set_size,
737 Descr->Input[input_idx].input_string, verbose_level);
738 if (f_v) {
739 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
740 }
741
742
743 int h;
744
745 for (h = 0; h < SoS->nb_sets; h++) {
746
747
749
750
752
754 SoS->Sets[h], SoS->Set_size[h], verbose_level);
755
756
757 Objects.push_back(OwCF);
758 }
759
760 FREE_OBJECT(SoS);
761
762 }
763
764
765 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_lines) {
766
767 set_of_sets *SoS;
768
769 SoS = NEW_OBJECT(set_of_sets);
770
771 int underlying_set_size = 0;
772
773 if (f_v) {
774 cout << "data_input_stream::read_objects "
775 "Reading the file " << Descr->Input[input_idx].input_string << endl;
776 }
777 SoS->init_from_file(
778 underlying_set_size,
779 Descr->Input[input_idx].input_string, verbose_level);
780 if (f_v) {
781 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
782 }
783
784
785 int h;
786
787 for (h = 0; h < SoS->nb_sets; h++) {
788
789
791
792
794
795 OwCF->init_line_set(
796 SoS->Sets[h], SoS->Set_size[h], verbose_level);
797
798
799 Objects.push_back(OwCF);
800 }
801
802 FREE_OBJECT(SoS);
803
804 }
805
806
807 else if (Descr->Input[input_idx].input_type == t_data_input_stream_file_of_points) {
808
809 set_of_sets *SoS;
810
811 SoS = NEW_OBJECT(set_of_sets);
812
813 int underlying_set_size = 0;
814
815 if (f_v) {
816 cout << "projective_space_object_classifier::process_multiple_objects_from_file "
817 "Reading the file " << Descr->Input[input_idx].input_string << endl;
818 }
819 SoS->init_from_file(
820 underlying_set_size,
821 Descr->Input[input_idx].input_string, verbose_level);
822 if (f_v) {
823 cout << "Read the file " << Descr->Input[input_idx].input_string << ", underlying_set_size=" << underlying_set_size << endl;
824 }
825
826
827 int h;
828
829 for (h = 0; h < SoS->nb_sets; h++) {
830
831
833
834
836
837 OwCF->init_point_set(
838 SoS->Sets[h], SoS->Set_size[h], verbose_level);
839
840
841 Objects.push_back(OwCF);
842 }
843
844 FREE_OBJECT(SoS);
845
846 }
847
848 else if (Descr->Input[input_idx].input_type == t_data_input_stream_from_parallel_search) {
849 if (f_v) {
850 cout << "input from parallel search" << endl;
851 }
852
853 int nb_cases = Descr->Input[input_idx].input_data1;
854 string mask;
855 string cases_fname;
856
857 mask.assign(Descr->Input[input_idx].input_string);
858 cases_fname.assign(Descr->Input[input_idx].input_string2);
859
860 if (f_v) {
861 cout << "input from parallel search, mask=" << mask << endl;
862 cout << "input from parallel search, nb_cases=" << nb_cases << endl;
863 cout << "input from parallel search, cases_fname=" << cases_fname << endl;
864 }
865
867 int c;
868
869 set_of_sets *Reps;
870 string col_label;
871 int prefix_sz;
872
873 col_label.assign("REP");
874
875
876 Fio.read_column_and_parse(cases_fname,
877 col_label,
878 Reps, verbose_level);
879 if (!Reps->has_constant_size_property()) {
880 cout << "data_input_stream::read_objects the sets have different sizes" << endl;
881 exit(1);
882 }
883 prefix_sz = Reps->Set_size[0];
884
885 for (c = 0; c < nb_cases; c++) {
886
887
888 if (f_v) {
889 cout << "case " << c << " / " << nb_cases << " prefix=";
890 Lint_vec_print(cout, Reps->Sets[c], prefix_sz);
891 }
892
893 char str[1000];
894 string fname;
895
896
897 sprintf(str, mask.c_str(), c);
898 fname.assign(str);
899
900 set_of_sets *SoS;
901 int underlying_set_size = 0;
902 int nb_sol;
903 int sol_width;
904
905 SoS = NEW_OBJECT(set_of_sets);
906 SoS->init_from_orbiter_file(underlying_set_size,
907 fname, 0 /*verbose_level*/);
908 nb_sol = SoS->nb_sets;
909 if (f_v) {
910 cout << "objects from file " << c << " / " << nb_cases <<
911 " the file contains " << nb_sol << " sets" << endl;
912 }
913 if (nb_sol) {
914 if (!SoS->has_constant_size_property()) {
915 cout << "data_input_stream::read_objects the sets have different sizes" << endl;
916 exit(1);
917 }
918 sol_width = SoS->Set_size[0];
919 long int *Sol_idx;
920 int i, j;
921 long int *set;
922
923 Sol_idx = NEW_lint(nb_sol * sol_width);
924 set = NEW_lint(prefix_sz + sol_width);
925 for (i = 0; i < nb_sol; i++) {
926 for (j = 0; j < sol_width; j++) {
927 Sol_idx[i * sol_width + j] = SoS->Sets[i][j];
928 }
929 }
930
931 for (i = 0; i < nb_sol; i++) {
933
934
935 Lint_vec_copy(Reps->Sets[c], set, prefix_sz);
936 Lint_vec_copy(Sol_idx + i * sol_width, set + prefix_sz, sol_width);
937
939
940 OwCF->init_point_set(
941 set, prefix_sz + sol_width,
942 0 /*verbose_level*/);
943
944 Objects.push_back(OwCF);
945 }
946 FREE_lint(Sol_idx);
947 FREE_lint(set);
948 }
949 //nb_objects_to_test += nb_sol;
950 FREE_OBJECT(SoS);
951 }
952 }
953
954 else {
955 cout << "data_input_stream::read_objects "
956 "unknown input type " << Descr->Input[input_idx].input_type << endl;
957 exit(1);
958 }
959 }
960
961 if (nb_objects_to_test != Objects.size()) {
962 cout << "data_input_stream::read_objects nb_objects_to_test != Objects.size()" << endl;
963 exit(1);
964 }
965
966 if (f_v) {
967 cout << "data_input_stream::read_objects done" << endl;
968 }
969
970}
971
972}}}
973
description of input data for classification of geometric objects from the command line
std::vector< data_input_stream_description_element > Input
void init(data_input_stream_description *Descr, int verbose_level)
void init_from_file(int &underlying_set_size, std::string &fname, int verbose_level)
void init_from_orbiter_file(int underlying_set_size, std::string &fname, int verbose_level)
a combinatorial object for which a canonical form can be computed using Nauty
Definition: geometry.h:1487
void init_packing_from_string(std::string &packing_text, int q, int verbose_level)
void init_packing_from_set(long int *packing, int sz, int verbose_level)
void init_point_set_from_string(std::string &set_text, int verbose_level)
void init_incidence_geometry_from_vector(std::vector< int > &Flags, int v, int b, int nb_flags, int verbose_level)
void init_line_set_from_string(std::string &set_text, int verbose_level)
void init_points_and_lines_from_string(std::string &set_text, std::string &set2_text, int verbose_level)
void init_large_set(long int *data, int data_sz, int v, int b, int k, int design_sz, int verbose_level)
void init_incidence_geometry_from_string_of_row_ranks(std::string &data, int v, int b, int r, int verbose_level)
void init_incidence_geometry_from_string(std::string &data, int v, int b, int nb_flags, int verbose_level)
void init_packing_from_spread_table(long int *data, long int *Spread_table, int nb_spreads, int spread_size, int q, int verbose_level)
int count_number_of_orbits_in_file(std::string &fname, int verbose_level)
Definition: file_io.cpp:1918
void read_incidence_by_row_ranks_file(std::vector< std::vector< int > > &Geos, int &m, int &n, int &r, std::string &inc_file_name, int verbose_level)
Definition: file_io.cpp:2988
void read_column_and_parse(std::string &fname, std::string &col_label, data_structures::set_of_sets *&SoS, int verbose_level)
Definition: file_io.cpp:1633
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1558
void read_incidence_file(std::vector< std::vector< int > > &Geos, int &m, int &n, int &nb_flags, std::string &inc_file_name, int verbose_level)
Definition: file_io.cpp:2900
void read_set_from_file(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
Definition: file_io.cpp:2374
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
@ t_data_input_stream_incidence_geometry_by_row_ranks
Definition: foundations.h:849
@ t_data_input_stream_file_of_packings_through_spread_table
Definition: foundations.h:843
@ t_data_input_stream_file_of_incidence_geometries_by_row_ranks
Definition: foundations.h:847
the orbiter library for the classification of combinatorial objects