nicer debug log output

This commit is contained in:
Zeno Rogue committed 2026-08-19 23:26:49 +02:00
1 parent afd70baf06
commit ad5abcfae9
5 files changed
+40 -22

No files matched your search

+6 -3
View File
@@ -205,6 +205,7 @@ void archimedean_tiling::compute_sum() {
void archimedean_tiling::prepare() {
indenter_finish iprep(debug_geometry, "arcm::prepare");
compute_sum();
for(int i: faces) if(i > MAX_EDGE_ARCM) {
@@ -310,7 +311,7 @@ void archimedean_tiling::prepare() {
else at = (at+N-1) % N;
}
if(!inv) make_match(2*i, 0, inv ? (2*at+2*N-1) % 2*N : 2*at, 0);
if(debug_geometry) print(hlog, "-> ", tie(at, inv));
if(debug_geometry) println(hlog, "-> ", tie(at, inv));
}
}
for(int i=0; i<N; i++) {
@@ -417,7 +418,7 @@ void archimedean_tiling::regroup() {
if(debug_geometry) {
for(int i=0; i<M; i+=(have_symmetry?1:2))
print(hlog, hr::format("tiling group of %2d: [%2d]%2d+Z%2d", i, tilegroup[i], groupoffset[i], periods[i]));
println(hlog, hr::format("tiling group of %2d: [%2d]%2d+Z%2d", i, tilegroup[i], groupoffset[i], periods[i]));
}
}
@@ -432,6 +433,8 @@ void archimedean_tiling::compute_geometry() {
if(embedded_plane && geometry != gArchimedean) return;
if(embedded_plane) return IPF(compute_geometry());
indenter_finish icg(debug_geometry, "arcm::compute geometry");
auto gg = get_geometry();
for(int a=0; a<2; a++) {
@@ -446,7 +449,7 @@ void archimedean_tiling::compute_geometry() {
}
if(debug_geometry)
println(hlog, "euclidean_angle_sum = ", euclidean_angle_sum);
println(hlog, "symbol ", symbol, ", euclidean_angle_sum = ", euclidean_angle_sum);
bool infake = fake::in_ext();
+1
View File
@@ -588,6 +588,7 @@ EX debugflag debug_init_cells = {"init_cells", true};
/** create a map in the current geometry */
EX void initcells() {
indenter_finish dif(debug_init_cells, "initcells");
if(debug_init_cells) println(hlog, "creating the map for geometry: ", full_geometry_name());
if(embedded_plane) {
geom3::swap_direction = -1;
+1
View File
@@ -2147,6 +2147,7 @@ map<string, shared_ptr<parameter> > allconfigs;
EX void parseline(const string& str) {
if(str[0] == '#') return;
DEBBI(debug_init_config, ("config line: ", str));
for(int i=0; i<isize(str); i++) if(str[i] == '=') {
string cname = str.substr(0, i);
if(!allconfigs.count(cname)) {
+25 -16
View File
@@ -283,6 +283,7 @@ struct fpattern {
int distflower0;
vector<eItem> markers;
eVariation current_variation;
int getdist(pair<int,bool> a, vector<char>& dists);
int getdist(pair<int,bool> a, pair<int,bool> b);
@@ -300,6 +301,7 @@ struct fpattern {
// 1+z+z^7 == 1+z+z^2(z^5) == 1+z+z^2(1+z^2) = 1+z+z^2+z^4
void init(int p) {
indenter_finish iinit(debug_geometry, "initializing a fieldpattern");
Prime = p;
if(solve()) {
printf("error: could not solve the fieldpattern\n");
@@ -675,6 +677,8 @@ void fpattern::set_field(int p, int sq) {
int fpattern::solve() {
indenter_finish isolve(debug_field, "fpattern::solve");
for(int a=0; a<MWDIM; a++) for(int b=0; b<MWDIM; b++) Id[a][b] = a==b?1:0;
if(!isprime(Prime)) {
@@ -859,6 +863,7 @@ vector<triplet_info> fpattern::find_triplets() {
void fpattern::build() {
if(WDIM == 3) return;
indenter_finish ibuild(debug_geometry, "fpattern::build");
for(int i=0; i<isize(qpaths); i++) {
matrix M = strtomatrix(qpaths[i]);
@@ -887,10 +892,10 @@ void fpattern::build() {
connections.push_back(matcode[PM]);
}
if(debug_field) println(hlog, "Computing inverses...\n");
if(debug_field) println(hlog, "Computing inverses...");
int N = isize(matrices);
if(debug_field) println(hlog, "Number of heptagons: %d\n", N);
if(debug_field) println(hlog, "Number of heptagons: ", N);
if(WDIM == 3) return;
@@ -933,7 +938,7 @@ void fpattern::build() {
}
}
if(debug_field) println(hlog, "Built.\n");
if(debug_field) println(hlog, "Built.");
}
int fpattern::getdist(pair<int,bool> a, vector<char>& dists) {
@@ -988,6 +993,8 @@ int fpattern::dijkstra(vector<char>& dists, vector<int> indist[MAXDIST]) {
void fpattern::analyze() {
indenter_finish dif(debug_geometry, "fpattern::analyze");
if(MWDIM == 4) {
/* we need to compute inverses */
int N = isize(matrices);
@@ -998,8 +1005,9 @@ void fpattern::analyze() {
inverses[i] = matcode[M2];
}
}
if(debug_field) println(hlog, "variation = %d\n", int(variation));
if(debug_field) println(hlog, "variation = ", int(variation), " (", full_geometry_name(), ")");
current_variation = variation;
int N = isize(connections);
markers.resize(N);
@@ -1047,7 +1055,7 @@ void fpattern::analyze() {
if(disthep[connections[i]] < disthep[i] && disthep[connections[btspin(i,u)]] < disthep[i])
circrad = disthep[i];
if(debug_field) println(hlog, "maxdist = %d otherpole = %d circrad = %d\n", maxdist, otherpole, circrad);
if(debug_field) println(hlog, "maxdist = ", maxdist, " otherpole = ", otherpole, " circrad = ", circrad);
matrix PRRR = strtomatrix("PRRR");
matrix PRRPRRRRR = strtomatrix("PRRPRRRRR");
@@ -1059,7 +1067,7 @@ void fpattern::analyze() {
wallorder = order(Wall);
wallid = matcode[Wall];
if(debug_field) println(hlog, "wall order = %d\n", wallorder);
if(debug_field) println(hlog, "wall order = ", wallorder);
#define SETDIST(X, d, it) {int c = matcode[X]; indist[d].push_back(c); if(it == itNone) ; else if(markers[c] && markers[c] != it) markers[c] = itBuggy; else markers[c] = it; }
@@ -1075,7 +1083,7 @@ void fpattern::analyze() {
}
int walldist = dijkstra(distwall, indist);
if(debug_field) println(hlog, "wall dist = %d\n", walldist);
if(debug_field) println(hlog, "wall dist = ", walldist);
W = strtomatrix("RRRRPR");
for(int j=0; j<wallorder; j++) {
@@ -1096,7 +1104,7 @@ void fpattern::analyze() {
int ipush = gmul(rpushid, i);
for(int k=0; k<wallorder; k++) {
if(ipush == j) {
if(debug_field) println(hlog, "River found at %d:%d\n", i, k);
if(debug_field) println(hlog, "River found at ", i, ":", k);
riverid = i;
goto riveridfound;
}
@@ -1138,7 +1146,7 @@ void fpattern::analyze() {
W = mmul(W, Wall);
}
int riverdist = dijkstra(PURE ? distflower : distriver, indist);
if(debug_field) println(hlog, "river dist = %d\n", riverdist);
if(debug_field) println(hlog, "river dist = ", riverdist);
for(int i=0; i<isize(matrices); i++)
if(distflower[i] == 0) {
@@ -1201,8 +1209,7 @@ void fpattern::analyze() {
dijkstra(distriverright, indist);
}
if(debug_field) println(hlog, "wall-river distance = %d\n", distwall[riverid]);
if(debug_field) println(hlog, "river-wall distance = %d\n", distriver[0]);
if(debug_field) println(hlog, "wall-river distance = ", distwall[riverid], " river-wall distance = ", distriver[0]);
}
int fpattern::orderstats() {
@@ -1223,9 +1230,11 @@ int fpattern::orderstats() {
}
}
printf("Listing:\n");
for(int i=0; i<MAXORD; i++) if(ordcount[i])
printf("Found %4d matrices of order %3d: %s\n", ordcount[i], i, decodepath(ordsample[i]).c_str());
if(debug_field) {
println(hlog, "Listing:\n");
for(int i=0; i<MAXORD; i++) if(ordcount[i])
println(hlog, format("Found %4d matrices of order %3d: ", ordcount[i], i), decodepath(ordsample[i]));
}
return ordsample[Prime];
}
@@ -1236,7 +1245,7 @@ void fpattern::findsubpath() {
if(gpow(i, Prime) == 0) {
subpathid = i;
subpathorder = Prime;
if(debug_field) println(hlog, "Subpath found: %s\n", decodepath(i).c_str());
if(debug_field) println(hlog, "Subpath found: ", decodepath(i));
return;
}
}
+7 -3
View File
@@ -652,6 +652,7 @@ void geometry_information::generate_faces() {
void geometry_information::prepare_basics() {
indenter_finish dif(debug_geometry, "prepare_basics");
if(debug_geometry) println(hlog, "geometry: ", full_geometry_name());
hexshift = 0;
@@ -796,7 +797,7 @@ void geometry_information::prepare_basics() {
}
if(debug_geometry) println(hlog,
hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF, S7, S6, hexf, hcrossf, tessf, hexshift,
hexhexdist, hexvdist));
hybrid_finish:
@@ -962,8 +963,11 @@ void geometry_information::prepare_basics() {
#endif
prepare_compute3();
if(hyperbolic && &currfp != &fieldpattern::fp_invalid)
currfp.analyze();
auto& c = currfp; /* note: this can actually build the fpattern */
if(hyperbolic && &c != &fieldpattern::fp_invalid && variation != c.current_variation)
c.analyze();
heptmove.resize(S7);
hexmove.resize(S7);