titerate.c - werner - cellular automata simulation of wind-driven sand transport
HTML git clone git://src.adamsgaard.dk/werner
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
titerate.c (828B)
---
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 // see https://www.gnu.org/software/gsl/manual/html_node/Matrices.html
5 #include <gsl/gsl_matrix.h>
6
7 #include "wernerparams.h"
8 #include "werner.h"
9
10 int main(int argc, char** argv)
11 {
12 // check if the user specified the number of times to iterate
13 int N_c = 1; // Number of cycles, default value
14 if (argc > 1)
15 N_c = atoi(argv[1]);
16
17 // Allocate matrix Z: number of sand slabs
18 gsl_matrix* Z = gsl_matrix_alloc(rows, cols);
19
20 // Read matrix from stdin
21 FILE* fp = fopen("tmp.mat", "r");
22 gsl_matrix_fscanf(fp, Z);
23 //gsl_matrix_fscanf(stdin, Z);
24
25 // Run N_c Werner iterations
26 werner_loop(Z, N_c, d_l, p_ns, p_s);
27
28 // Print result to stdout
29 gsl_matrix_fprintf(stdout, Z, "%f");
30
31 // End program
32 gsl_matrix_free(Z);
33 return 0;
34 }