Installer ces fichiers dans votre répertoire de travail.

Ces fichiers sont spécifiques pour ce travail. Ils ne doivent pas être conservés avec la librairie..

dstrct.h
déclaration des structures
/* ------------------------------------ */
/*  Save as :   dstrct.h                */
/* ------------------------------------ */
typedef struct
{
    double  xmini;
    double  xmaxi;
    double  ymini;
    double  ymaxi;

}W_Ctrl, *PW_Ctrl;
/* ------------------------------------ */
W_Ctrl i_WGnuplot(
double  xmini,
double  xmaxi,
double  ymini,
double  ymaxi
)
{
W_Ctrl w = {xmini,xmaxi,ymini,ymaxi};

return (w);
}


dg_uv.h
fonction pour gnuplot
/* ------------------------------------ */
/*  Save as :   dg_uv.h                 */
/* ------------------------------------ */
void G_points2D_mR(
W_Ctrl w,
double **A,
double **B
)
{
FILE *fp;
int c;

         fp = fopen("a_main.plt","w");
 fprintf(fp, " reset\n"
             " set zeroaxis\n"
             " set size ratio -1\n"
             " plot[%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
             " \"aU.plt\" with line,\\\n"
             " \"aV.plt\" with line\n",
             w.xmini,w.xmaxi,w.ymini,w.ymaxi);
 fclose(fp);

              fp = fopen("aU.plt","w");
   for(c=C1; c<A[C_SIZE][C0]; c++)
      fprintf(fp,"  %+.3f  %+.3f \n",A[1][c],A[2][c]);
       fclose(fp);

              fp = fopen("aV.plt","w");
   for(c=C1; c<B[C_SIZE][C0]; c++)
      fprintf(fp,"  %+.3f  %+.3f \n",B[1][c],B[2][c]);
       fclose(fp);
       
       
  printf("  * open the file main.plt with Gnuplot.\n"
         "  * Press Return in this window."
         " (To create a new value for u) \n"
         "  * Use the command Replot in Gnuplot"
         " to draw the news u and v.\n\n");       
}
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.