next up previous contents
Next: La fonction buidmatlaplace() Up: Les fonctions propres Previous: Instantiation des types de

Structure du programme principal

La fonction main() appelle 3 fonctions pour

  1. la construction de la matrice, par exemple buildmatlaplace()
  2. le calcul du second membre: rhs()
  3. la résolution du système linéaire: gaussband()

void main()
{      
      Grid g;
      g.rectInit(15,15);  // triangulates the unit square with a 15x15 grid
      g.prepgrid();       // computes areas of triangles, neighbor points...
      Vector<vectNB> f(g.nv), sol(g.nv); //rhs of -Delta(sol)=f=1, sol=0 on bdy 
      for(int i=0;i< g.nv;i++) f[i] = 1 ;
      Bandmatrix<matNB,vectNB> aa(nv,g.bdth);
      buildmatlaplace(g,aa);
      for(int i=0;i< g.nv;i++)if(g.v[i].where) aa(i,i)= 1e10; // p=1e10
      sol = rhs(g,f);              // computes right hand side of linear system
      cout<< "pivot=" << gaussband(aa,sol,1) << endl;      
}



Pironneau Olivier
Jeudi 26 juin 1997 07:15:20