Aller au contenu

Mathc initiation/Fichiers h : c63a7

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_fluyzx.h
/* --------------------------------- */
/* save as x_fluyzx.h                */
/* --------------------------------- */
double flux_y_dydzdx(

double (*P_f)(double x, double y, double z),

double (*P_fxyz_n)( double (*P_f)(double x, double y, double z), double h, pt3d n),

double (*P_u)(double x, double z),
double (*P_v)(double x, double z),
   int ny,
   
double z,
   
double x
)
{
pt3d n;

   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= ny; i++)
 {
       if(i ==0 || i== ny){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

          n.x = x;
          n.y = ((*P_u)(x,z)) + i*(((*P_v)(x,z))-((*P_u)(x,z)))/ny;
          n.z = z;

  M += m *  (*P_fxyz_n)((*P_f),H,n);

  }

  return( ((((*P_v)(x,z)) -((*P_u)(x,z)))*M) / (3*ny) );
}
/* --------------------------------- */
double flux_z_dydzdx(

double (*P_f)(double x, double y, double z),

double (*P_fxyz_n)( double (*P_f)(double x, double y, double z), double h, pt3d nz),

double (*P_u)(double x, double z),
double (*P_v)(double x, double z),
   int ny,
   
double (*P_s)(double x),
double (*P_t)(double x),
   int nz,
   
double x
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= nz; i++)
 {
       if(i ==0 || i== nz){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * flux_y_dydzdx(    (*P_f),
                             (*P_fxyz_n),
                             (*P_u),(*P_v),ny,
                           (((*P_s)(x))+i*(((*P_t)(x))-((*P_s)(x)))/nz),
                               x);
 }

 return( ((((*P_t)(x)) -((*P_s)(x)))*M) / (3*nz) );
}
/* --------------------------------- */
/* -------------------------------------------------------------------------- */
double flux_dydzdx(

double (*P_f)(double x, double y, double z),

double (*P_fxyz_n)( double (*P_f)(double x, double y, double z), double h, pt3d nz),

double (*P_u)(double x, double z),
double (*P_v)(double x, double z),
   int ny,
   
double (*P_s)(double x),
double (*P_t)(double x),
   int nz,
   
double ax,
double bx,
   int nx
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= nx; i++)
 {
       if(i ==0 || i== nx){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * flux_z_dydzdx(    (*P_f),
                             (*P_fxyz_n),
                             (*P_u),(*P_v),ny,
                             (*P_s),(*P_t),nz,
                             (ax+i*(bx-ax)/nx));
 }

  return( ((bx -ax)*M) / (3*nx) );
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.