Mathc initiation/Fichiers h : c63a8
Apparence
Installer ce fichier dans votre répertoire de travail.
x_fluzxy.h |
---|
/* --------------------------------- */
/* save as x_fluzxy.h */
/* --------------------------------- */
double flux_z_dzdxdy(
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 y),
double (*P_v)(double x, double y),
int nz,
double x,
double y
)
{
pt3d n;
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.;}
n.x = x;
n.y = y;
n.z = ((*P_u)(x,y)) + i*(((*P_v)(x,y))-((*P_u)(x,y)))/nz;
M += m * (*P_fxyz_n)((*P_f),H,n);
}
return( ((((*P_v)(x,y)) -((*P_u)(x,y)))*M) / (3*nz) );
}
/* --------------------------------- */
double flux_x_dzdxdy(
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 nx),
double (*P_u)(double x, double y),
double (*P_v)(double x, double y),
int nz,
double (*P_s)(double y),
double (*P_t)(double y),
int nx,
double y
)
{
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_dzdxdy( (*P_f),
(*P_fxyz_n),
(*P_u),(*P_v),nz,
(((*P_s)(y))+i*(((*P_t)(y))-((*P_s)(y)))/nx),
y);
}
return( ((((*P_t)(y)) -((*P_s)(y)))*M) / (3*nx) );
}
/* --------------------------------- */
double flux_dzdxdy(
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 nx),
double (*P_u)(double x, double y),
double (*P_v)(double x, double y),
int nz,
double (*P_s)(double y),
double (*P_t)(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 * flux_x_dzdxdy( (*P_f),
(*P_fxyz_n),
(*P_u),(*P_v),nz,
(*P_s),(*P_t),nx,
(ay+i*(by-ay)/ny));
}
return( ((by -ay)*M) / (3*ny) );
}
/* --------------------------------- */
/* --------------------------------- */
Déclaration des fichiers h.