Mathc initiation/Fichiers h : c51fa


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_sphxyz.h
/* --------------------------------- */
/* save as x_sphxyz.h                */
/* --------------------------------- */
double spheric_x_dxdydz(

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

double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
   int nx,
   
double y,
   
double z
)
{
double x = 0;
   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.;}

  x = ((*Pux)(y,z)) + i*(((*Pvx)(y,z))-((*Pux)(y,z)))/nx;
  
  M += m * (*P_f)(x, y, z) * x*x * sin(y);
 }

  return( ((((*Pvx)(y,z)) -((*Pux)(y,z)))*M) / (3*nx) );
}
/* --------------------------------- */
double spheric_y_dxdydz(
double (*P_f)(double x, double y, double z),
   
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
   int    nx,

double (*Psy)(double x),
double (*Pty)(double x),
   int    ny,
   
double z
)
{
   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 * spheric_x_dxdydz(  (*P_f),
                           
                             (*Pux),
                             (*Pvx),
                               nx,
                               
                           (((*Psy)(z))+i*(((*Pty)(z))-((*Psy)(z)))/ny),
                               
                              z);
 }

 return( ((((*Pty)(z)) -((*Psy)(z)))*M) / (3*ny) );
}
/* --------------------------------- */
double spheric_dxdydz(
double (*P_f)(double x, double y, double z),
   
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
   int    nx,
   
double (*Psy)(double x),
double (*Pty)(double x),
   int    ny,

double az,
double bz,
   int nz
)
{
   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 *  spheric_y_dxdydz((*P_f),
                               
                             (*Pux),
                             (*Pvx),
                                nx,
                             
                             (*Psy),
                             (*Pty),
                                ny,
                                
                             (az+i*(bz-az)/nz));
 }

  return( ((bz -az)*M) / (3*nz) );
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.