Mathc initiation/Fichiers h : c54a7
Installer ce fichier dans votre répertoire de travail.
x_gdxdy.h |
---|
/* ---------------------------------- */
/* save as x_gdxdy.h */
/* ---------------------------------- */
double gint_dx(
double (*P_M)(double x, double y),
double (*P_N)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
int nx,
double y
)
{
int i = 0;
double m = 0.;
double M = 0.;
pt2d t;
for(i = 0; i <= nx; i++)
{
if(i ==0 || i== nx){m = 1.;}
else if(fmod(i,2) == 0 ){m = 2.;}
else {m = 4.;}
t.x = ( ((*P_u)(y)) + i*(((*P_v)(y))-((*P_u)(y)))/nx );
t.y = y;
M += m * (fxy_x((*P_N),H,t) -
fxy_y((*P_M),H,t) );
}
return( ((((*P_v)(y)) -((*P_u)(y)))*M) / (3*nx) );
}
/* ---------------------------------- */
double green_dxdy(
double (*P_M)(double x, double y),
double (*P_N)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
int nx,
double ay,
double by,
int ny
)
{
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.;}
M += m * gint_dx((*P_M),(*P_N), (*P_u),(*P_v),nx,(ay+i*(by-ay)/ny));
}
return( ((by-ay)*M) / (3*ny) );
}
/* ---------------------------------- */
Déclaration des fichiers h.