Orbiter 2022
Combinatorial Objects
geometry_builder.cpp
Go to the documentation of this file.
1/*
2 * geometry_builder.cpp
3 *
4 * Created on: Aug 16, 2021
5 * Author: betten
6 */
7
8
9#include "foundations.h"
10
11using namespace std;
12
13
14
15namespace orbiter {
16namespace layer1_foundations {
17namespace geometry_builder {
18
19
20
22{
23 Descr = NULL;
24
25 //II = 0;
26 //JJ = 0;
27
28 v = NULL;
29 v_len = 0;
30
31 b = NULL;
32 b_len = 0;
33
34 fuse = NULL;
35 fuse_len = 0;
36
37 TDO = NULL;
38 TDO_len = 0;
39
40 V = 0;
41 B = 0;
42 R = NULL;
43
46 //std::string fname;
47
48 //control_file_name;
49 no = 0;
50 flag_numeric = 0;
52
53 gg = NULL;
54
55
56}
57
58geometry_builder::~geometry_builder()
59{
60 if (v) {
61 FREE_int(v);
62 }
63 if (b) {
64 FREE_int(b);
65 }
66 if (fuse) {
68 }
69 if (TDO) {
71 }
72 if (R) {
73 FREE_int(R);
74 }
75 if (gg) {
77 }
78}
79
80void geometry_builder::init_description(geometry_builder_description *Descr,
81 int verbose_level)
82{
83 int f_v = (verbose_level >= 1);
84 int i;
85
86 if (f_v) {
87 cout << "geometry_builder::init_description" << endl;
88 }
90
91 if (!Descr->f_V) {
92 cout << "please use option -V to specify the row partition" << endl;
93 exit(1);
94 }
96 V = 0;
97 for (i = 0; i < v_len; i++) {
98 V += v[i];
99 }
100
101 if (!Descr->f_B) {
102 cout << "please use option -B to specify the column partition" << endl;
103 exit(1);
104 }
106 B = 0;
107 for (i = 0; i < b_len; i++) {
108 B += b[i];
109 }
110
111
112 if (f_v) {
113 cout << "geometry_builder::init_description V=" << V << endl;
114 cout << "geometry_builder::init_description B=" << B << endl;
115 }
116
117 if (!Descr->f_TDO) {
118 cout << "please use option -TDO to specify the TDO row-scheme" << endl;
119 exit(1);
120 }
122
123 if (Descr->f_fuse) {
125 int f;
126
127 f = 0;
128 for (i = 0; i < fuse_len; i++) {
129 f += fuse[i];
130 }
131 if (f != v_len) {
132 cout << "the sum of the fuse values must equal the number of rows of the TDO" << endl;
133 cout << "f=" << f << endl;
134 cout << "v_len=" << v_len << endl;
135 exit(1);
136 }
137 }
138
141
142
143 if (f_v) {
144 cout << "geometry_builder::init_description before compute_VBR" << endl;
145 }
146
147 compute_VBR(verbose_level);
148
149 if (f_v) {
150 cout << "geometry_builder::init_description after compute_VBR" << endl;
151 }
152
153
155
156 if (f_v) {
157 cout << "geometry_builder::init_description before gg->init" << endl;
158 }
159 gg->init(this, verbose_level);
160 if (f_v) {
161 cout << "geometry_builder::init_description after gg->init" << endl;
162 }
163
164
165
166
167 if (f_v) {
168 cout << "geometry_builder::init_description set_flush_to_inc_file" << endl;
169 }
170
171
172 //gg->print_conf();
173
174
175
176 if (Descr->f_fname_GEO) {
177
179
180
181 if (f_v) {
182 cout << "geometry_builder::init_description inc_file_name = " << gg->inc_file_name << endl;
183 }
184 }
185
186 if (f_v) {
187 cout << "geometry_builder::init_description setting up tests:" << endl;
188 for (i = 0; i < Descr->test_lines.size(); i++) {
189 cout << "-test " << Descr->test_lines[i] << endl;
190 }
191 }
192
193
194 if (f_v) {
195 cout << "geometry_builder::init_description allocating arrays" << endl;
196 }
197
198 int *s_type = NULL;
199 int *s_flag = NULL;
200
201 s_type = NEW_int(V + 1);
202 s_flag = NEW_int(V + 1);
203
204 for (i = 0; i <= V; i++) {
205 s_type[i] = 0;
206 s_flag[i] = 0;
207 }
208
209
210 if (f_v) {
211 cout << "geometry_builder::init_description reading test_lines" << endl;
212 }
213
214 for (i = 0; i < Descr->test_lines.size(); i++) {
215 int *lines;
216 int lines_len;
217 int a, j;
218
219 //cout << "-test " << Descr->test_lines[i] << " " << Descr->test_flags[i] << endl;
220
221 orbiter_kernel_system::Orbiter->get_vector_from_label(Descr->test_lines[i], lines, lines_len, 0 /* verbose_level*/);
222 //Orbiter->Int_vec.scan(Descr->test_lines[i], lines, lines_len);
223
224 for (j = 0; j < lines_len; j++) {
225 a = lines[j];
226 s_type[a] = 1;
227 }
228 }
229
230
231 if (f_v) {
232 cout << "geometry_builder::init_description reading test2_lines" << endl;
233 }
234
235 for (i = 0; i < Descr->test2_lines.size(); i++) {
236 int *lines;
237 int lines_len;
238 int a, j;
239
240 //cout << "-test " << Descr->test_lines[i] << " " << Descr->test_flags[i] << endl;
241 Int_vec_scan(Descr->test2_lines[i], lines, lines_len);
242 //flags = true_false_string_numeric(Descr->test_flags[i].c_str());
243 for (j = 0; j < lines_len; j++) {
244 a = lines[j];
245 }
246 }
247
248 if (f_v) {
249 cout << "geometry_builder::init_description installing tests" << endl;
250 }
251
252 for (i = 1; i <= V; i++) {
253 if (f_v) {
254 cout << "geometry_builder::init_description installing test on line " << i << endl;
255 }
256
257 if (s_type[i] == 1) {
258 isot(i, verbose_level);
259 }
260 else if (s_type[i] == 2) {
261 isot2(i, verbose_level);
262 }
263
264 }
265
266
267 if (Descr->f_split) {
268 if (f_v) {
269 cout << "geometry_builder::init_description installing split on line " << Descr->split_line << endl;
270 cout << "geometry_builder::init_description remainder " << Descr->split_remainder << endl;
271 cout << "geometry_builder::init_description modulo " << Descr->split_modulo << endl;
272 }
274
275 }
276
277
278
279
280 if (f_v) {
281 cout << "geometry_builder::init_description done" << endl;
282 }
283}
284
285
286
287void geometry_builder::compute_VBR(int verbose_level)
288{
289 int f_v = (verbose_level >= 1);
290 int i, j, row, h;
291
292 if (f_v) {
293 cout << "geometry_builder::compute_VBR v_len = " << v_len << " b_len = " << b_len << endl;
294 }
295 B = 0;
296 for (j = 0; j < b_len; j++) {
297 B += b[j];
298 }
299 V = 0;
300 for (i = 0; i < v_len; i++) {
301 V += v[i];
302 }
303
304 R = NEW_int(V);
305 row = 0;
306 for (i = 0; i < v_len; i++) {
307 for (h = 0; h < v[i]; h++, row++) {
308 R[row] = 0;
309 for (j = 0; j < b_len; j++) {
310 R[row] += TDO[i * b_len + j];
311 }
312 }
313 }
314
315 print_tdo();
316
317 if (f_v) {
318 cout << "geometry_builder::compute_VBR done" << endl;
319 }
320}
321
322void geometry_builder::print_tdo()
323{
324 int i, j;
325
326 cout << " | ";
327 for (j = 0; j < b_len; j++) {
328 cout << setw(2) << b[j] << " ";
329 }
330 cout << endl;
331 cout << "---| ";
332 for (j = 0; j < b_len; j++) {
333 cout << "---";
334 }
335 cout << endl;
336 for (i = 0; i < v_len; i++) {
337 cout << setw(2) << v[i] << " ";
338 for (j = 0; j < b_len; j++) {
339 cout << setw(2) << TDO[i * b_len + j] << " ";
340 }
341 cout << endl;
342 }
343}
344
345void geometry_builder::isot(int line, int verbose_level)
346{
348 line, Descr->f_orderly, verbose_level);
349}
350
351void geometry_builder::isot_no_vhbars(int verbose_level)
352{
354 gg->inc->iso_type_no_vhbars->init(gg, V, Descr->f_orderly, verbose_level);
355}
356
357void geometry_builder::isot2(int line, int verbose_level)
358{
360 line, Descr->f_orderly, verbose_level);
361}
362
363void geometry_builder::set_split(int line, int remainder, int modulo)
364{
365 gg->inc->set_split(line, remainder, modulo);
366}
367
368
369
370}}}
371
classification of geometries with a given row-tactical decomposition
void init(geometry_builder *GB, int verbose_level)
Definition: gen_geo.cpp:75
void set_split(int row, int remainder, int modulo)
Definition: incidence.cpp:305
void install_isomorphism_test_after_a_given_row(int i, int f_orderly, int verbose_level)
Definition: incidence.cpp:259
void install_isomorphism_test_of_second_kind_after_a_given_row(int i, int f_orderly, int verbose_level)
Definition: incidence.cpp:281
classification of geometries based on canonical forms
void init(gen_geo *gg, int v, int f_orderly, int verbose_level)
Definition: iso_type.cpp:55
void get_vector_from_label(std::string &label, int *&v, int &sz, int verbose_level)
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define FALSE
Definition: foundations.h:234
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects