Disable "hard" examples in CI
[qpms.git] / oldtests / test_latticegenxyweb.c
blob5a704393c7561e35c1d665460b2d8ceb8d6275dc
1 //c99 -o test_latticegenxyweb -ggdb -Wall -I ../ test_latticegenxyweb.c ../qpms/latticegens.c ../qpms/lattices2d.c -lm
2 #define QPMS_VECTORS_NICE_TRANSFORMATIONS
3 #include <qpms/lattices.h>
4 #include <stdio.h>
6 void fprint_PGenCart2ReturnData(FILE *f, PGenCart2ReturnData d) {
7 cart2_t c = d.point_cart2;
8 fprintf(f, "%g\t%g\tflags: %#xd\n",
9 c.x, c.y, d.flags);
12 void dump_PGenCart2(char *filename, PGen *g) {
13 FILE *out = fopen(filename, "w");
14 PGenCart2ReturnData d;
15 while ((d = PGen_next_cart2(g)).flags & PGEN_NOTDONE) {
16 fprint_PGenCart2ReturnData(out, d);
20 #if 0
21 void print_PGenSphReturnData(PGenSphReturnData d) {
22 sph_t s = d.point_sph;
23 cart3_t c = sph2cart(s);
24 printf("sph: (%g, %g π, %g π), cart: (%g, %g, %g), flags: %#xd\n",
25 s.r, s.theta / M_PI, s.phi / M_PI, c.x, c.y, c.z, d.flags);
28 void dump_PGenSph(PGen *g) {
29 PGenSphReturnData d;
30 do {
31 d = PGen_next_sph(g);
32 print_PGenSphReturnData(d);
33 } while (d.flags & PGEN_NOTDONE);
35 #endif
37 #define DO_AND_PRINT(label, s) printf(#label ":\n" #s "\n"); s ;
39 int main(int argc, char **argv) {
40 PGen g;
41 cart2_t b1 = {1.1,0}, b2 = {0,-1.3}, offset = {0.1, -0.1};
42 g = PGen_xyWeb_new(b1, b2, 1e-13, offset, 0, true, 5, false);
43 dump_PGenCart2("rect1.xydump", &g);
44 g = PGen_xyWeb_new(b1, b2, 1e-13, offset, 5, true, 8, false);
45 dump_PGenCart2("rect2.xydump", &g);
46 b1.x = 1.342, b1.y = 4.3121; b2.x = -1.83, b2.y = 1.4;
47 g = PGen_xyWeb_new(b1, b2, 1e-13, offset, 0, true, 8, false);
48 dump_PGenCart2("oblique1.xydump", &g);
49 g = PGen_xyWeb_new(b1, b2, 1e-13, offset, 0, false, 8, false);
50 dump_PGenCart2("oblique1_noorig.xydump", &g);
53 return 0;