/* See {salamic_section.h}. */ /* Last edited on 2015-10-18 01:43:18 by stolfilocal */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include /* ??? eps should be {double} ??? */ void salamic_section_write_section_header(FILE *wr, stmesh_t mesh, int32_t pZ, uint32_t mf) { float eps = stmesh_get_eps(mesh); filefmt_write_header(wr, "salamic_section", salamic_section_VERSION); fprintf(wr, "eps = %23.15e\n", (double)eps); fprintf(wr, "planeZ = %+23.15e\n", ((double)pZ)*(double)eps); fprintf(wr, "planeQ = %+11d\n", pZ); fprintf(wr, "nSegs = %u\n", mf); fflush(wr); } void salamic_section_write_path_or_loop(FILE *wr, stmesh_t mesh, int32_t pZ, uint32_t me, stmesh_edge_t e[]) { float eps = stmesh_get_eps(mesh); fprintf(wr, "\n"); fprintf(wr, "path\n"); fprintf(wr, "nPoints = %u\n", me); uint32_t ie; for(ie = 0; ie < me; ie++) { r2_t vi = stmesh_edge_plane_intersection(e[ie], pZ, eps); fprintf(wr, " %+.3f %+.3f\n", (float)vi.c[0], (float)vi.c[1]); } fprintf(wr, "end path\n"); } void salamic_section_write_section_footer(FILE *wr) { filefmt_write_footer(wr, "salamic_section"); }