1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| char names[80];
double Xmax = 0., Ymax = 0.;
sprintf(names, "outt%d", pid());
FILE * fout = fopen (names, "w");
output_facets (f,fout);
fclose(fout);
system("cat outt* > all-out.dat");
if(pid() == 0.){
system("awk -F ' ' '{ if ($2 >= 1.5) {print ''} else {print $0} }' all-out.dat > all-out2.dat"); // fichier contenant (x,y)
system("(cut -f2 all-out2.dat | sort -n -r | head -1) >ligne"); // Je selectionne (x,ymax) dans le fichier all-out2.dat puis jecrit le résultat dans ligne.
system("cat ligne >> lignes"); // je fais une copie du fichier ligne dans lignes
FILE * fligne = fopen("ligne", "r");
rewind(fligne);
fscanf(fligne,"%lf %lf", &Xmax, &Ymax);
fclose(fligne);
}
//fprintf(gnuplotPipe, "refresh\n");
fprintf (gnuplotPipe, "set output 'plot%d.png'\n", frame);
fprintf (gnuplotPipe, "set title 't = %g, Xmax = %lf, Ymax =%lf' font ',25'\n",t, Xmax, Ymax);
fprintf (gnuplotPipe, "plot 'all-out2.dat' u 1:2 w l lt rgb'#11BB11' t 'interface',""'lignes' u 1:2 w l t 'Position max crête'\n");
fflush (gnuplotPipe);
frame++;
}
event stop (t = EndTime){
system("ffmpeg -r 25 -f image2 -i plot%d.png -c:v libx264 -vf format=yuv420p -y mov.mp4 && "
"rm -f plot* lignes ligne");
return 1;
} |
Partager