Aller au contenu

Mathc initiation/a453

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_pfs_ts.h
/* ---------------------------------- */
/* save as x_pfs_ts.h                 */
/* ---------------------------------- */
double paraFSint_ts(

double (*P_Rx)(double s, double t),
double (*P_Ry)(double s, double t),
double (*P_Rz)(double s, double t),

double (*P_fi)(double x, double y, double z),
double (*P_fj)(double x, double y, double z),
double (*P_fk)(double x, double y, double z),

double (*P_u)(double x),
double (*P_v)(double x),
   int    ny,
   
double     x
)
{
v3d  a;
pt2d p;

   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.;}

 p.y = ((*P_u)(x)) + i*(((*P_v)(x))-((*P_u)(x)))/ny;
 p.x = x;

 a = Rs_x_Rt((*P_Rx),(*P_Ry), (*P_Rz),p);

 M += m * (
           (*P_fi)((*P_Rx)(p.x,p.y), (*P_Ry)(p.x,p.y), (*P_Rz)(p.x,p.y))
                                   * a.i +
           (*P_fj)((*P_Rx)(p.x,p.y), (*P_Ry)(p.x,p.y), (*P_Rz)(p.x,p.y))
                                   * a.j +
           (*P_fk)((*P_Rx)(p.x,p.y), (*P_Ry)(p.x,p.y), (*P_Rz)(p.x,p.y))
                                   * a.k 
          );                       
 }

  return( ((((*P_v)(x)) -((*P_u)(x)))*M) / (3*ny) );
}
/* ---------------------------------- */
double parametricFS_ts(

double (*P_Rx)(double s, double t),
double (*P_Ry)(double s, double t),
double (*P_Rz)(double s, double t),

double (*P_fi)(double x, double y, double z),
double (*P_fj)(double x, double y, double z),
double (*P_fk)(double x, double y, double z),

double (*P_u)(double x),
double (*P_v)(double x),
   int    ny,

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 * paraFSint_ts( (*P_Rx),(*P_Ry),(*P_Rz),
                         (*P_fi),(*P_fj),(*P_fk),
                         (*P_u),(*P_v),ny,
                         (ax + i*(bx-ax)/nx));
 }

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