Fix saving lists of arrays with recent versions of numpy
[qpms.git] / oldtests / lattice / 2d_3lat_rcount.c
blobe900873ef5105e703b6d710a18c4647fe2b0f611
1 #include <qpms/lattices.h>
2 #include <stdio.h>
3 #include <float.h>
5 void dump_points2d_rordered(const points2d_rordered_t *ps, char *filename) {
6 FILE *f = fopen(filename, "w");
7 for (size_t i = 0; i < ps->nrs; ++i) {
8 fprintf(f, "# r = %.16g\n", ps->rs[i]);
9 for (ptrdiff_t j = ps->r_offsets[i]; j < ps->r_offsets[i+1]; ++j)
10 fprintf(f, "%.16g %.16g\n", ps->base[j].x, ps->base[j].y);
12 fclose(f);
15 int main() {
16 triangular_lattice_gen_t *g = triangular_lattice_gen_init(1, TRIANGULAR_HORIZONTAL, false,0);
17 triangular_lattice_gen_extend_to_steps(g, 1000);
18 for(size_t i = 0; i < g->ps.nrs; ++i) {
19 printf("%zd %.16g %td\n", i, g->ps.rs[i], g->ps.r_offsets[i+1]);
21 triangular_lattice_gen_free(g);
23 return 0;