| Date: Fri, 19 Mar 2021 18:32:00 +0100
simulation.c: add VTK export for grains
Diffstat:
M simulation.c | 51 ++++++++++++++++++++++++++++++-
M simulation.h | 5 +----
2 files changed, 51 insertions(+), 5 deletions(-)
--- |
| t@@ -13,7 +13,56 @@ print_grains(FILE *stream, const struct grain *grains, size_t n)
{
size_t i;
- /* fprintf(stream, "N = %zu\n", n); */
for (i = 0; i < n; i++)
grain_print(stream, &grains[i]);
}
+
+void
+print_grains_vtk(FILE *stream, const struct grain *grains, size_t n)
+{
+ size_t i;
+
+ fprintf(stream,
+ "\n"
+ "\n"
+ "\t\n"
+ "\t\t\n", n);
+ fprintf(stream,
+ "\t\t\t\n"
+ "\t\t\t\t\n");
+ for (i = 0; i < n; i++)
+ fprintf(stream, "%.17g %.17g %.17g ",
+ grains[i].pos[0], grains[i].pos[1], grains[i].pos[2]);
+ fprintf(stream, "\n");
+ fprintf(stream,
+ "\t\t\t\t\n"
+ "\t\t\t\n");
+
+ fprintf(stream,
+ "\t\t\t\n"
+ "\t\t\t\t\n"
+ "\t\t\t\t\n"
+ "\t\t\t\t\n"
+ "\t\t\t\n");
+
+ fprintf(stream,
+ "\t\t\t\n"
+ "\t\t\t\t\n");
+ for (i = 0; i < n; i++)
+ fprintf(stream, "%.17g ", grains[i].radius * 2.0);
+ fprintf(stream,
+ "\n"
+ "\t\t\t\t\n"
+ "\t\t\t\n");
+
+ fprintf(stream,
+ "\t\t\n"
+ "\t\n"
+ "\n");
+} |
| t@@ -37,12 +37,9 @@ struct simulation {
struct grain *grains;
};
-void init_sim(struct simulation *sim);
void free_sim(struct simulation *sim);
void print_grains(FILE *stream, const struct grain *grains, size_t n);
-
-void write_output_file(struct simulation *sim, const int normalize);
-void print_output(FILE *stream, struct simulation *sim);
+void print_grains_vtk(FILE *stream, const struct grain *grains, size_t n);
#endif |