fem::FEM Class Reference

this class drives the resolution of the pde using the Finite Element Method. More...

#include <femSolver.hpp>

List of all members.

Public Member Functions

 DECLARE_TYPE (femMesh::femPoint, femPoint)
 Typedefs.
 DECLARE_TYPE (femMesh::femTriangle, femTriangle)
 DECLARE_TYPE (creal *, cmatptr)
 DECLARE_TYPE (float *, matptr)
 FEM (femMeshPtr=0, int quadra=0)
 Constructors, destructor and methods.
 ~FEM ()
 destructor
float solvePDE (fcts *param, int how)
 solve the PDE
creal deriv (int m, creal *f, int ksolv, int i)
creal convect (creal *f, creal *u1, creal *u2, float dt, int i)
creal rhsConvect (creal *f, creal *u1, creal *u2, float dt, int i)
creal fctval (creal *f, float x, float y)
int getregion (int k)
creal gfemuser (creal what, creal *f, int i)
creal P1ctoP1 (creal *f, int i)
creal prodscalar (creal *f, creal *g)
creal ginteg (int, int, int, creal *, creal *, int)
creal binteg (int, int, int, creal *, creal *, int)
void initvarmat (int how, int flagcomplexe, int N, fcts *param)
void assemble (int how, int flagcomplexe, int N, int k, creal *a, creal *b, fcts *param)
void solvevarpde (int N, fcts *param, int how)

Public Attributes

float * normlx
float * normly
int N


Detailed Description

this class drives the resolution of the pde using the Finite Element Method.

Author:
Christophe Prud'homme <Christophe.Prudhomme@ann.jussieu.fr>
See also:
femMesh
Version:
#
Id
femSolver.hpp,v 1.2 2001/07/12 14:11:57 prudhomm Exp
#

Constructor & Destructor Documentation

fem::FEM::FEM ( femMeshPtr  __t = 0,
int  quadra = 0 
)

Constructors, destructor and methods.

default constructor

00072   :
00073   __mesh( __t ),
00074   __quadra( quadra ),
00075   bug( 0 ),
00076   nhow( 0 ),
00077   nhow1( 0 ),
00078   nhow2( 0 ),
00079   a1c(),
00080   rhsQuadra( 0 )
00081 {
00082   int             i, k, baux, nquad;
00083   
00084   ns = __mesh->getNumberOfPoints();
00085   nt = __mesh->getNumberOfCells();
00086   q = __mesh->rp;
00087   me = __mesh->tr;
00088   ng = __mesh->ng;
00089   ngt = __mesh->ngt;
00090   bdth = 0;
00091   nquad = __quadra ? 3 * nt : ns;
00092   for (k = 0; k < nt; k++)
00093     for (i = 0; i <= 2; i++)
00094        {
00095          baux = abss ((me[k][i] - me[k][next[i]]));
00096          bdth = (bdth > baux) ? bdth : baux;
00097        }
00098   a2.destroy();
00099   a2.init (nhowmax);
00100 
00101   for( int __i = 0; __i < nhowmax; __i++)
00102     {
00103       a1c[__i] = 0;
00104     }
00105   
00106   area = new float[nt];
00107   normlx = new float[nquad];
00108   normly = new float[nquad];
00109   for (i = 0;i < nquad;i++)
00110     {
00111       normlx[i] = 0.F;
00112       normly[i] = 0.F;
00113     } 
00114   nhow1 = 0;
00115   nhow2 = 0;
00116   connectiv ();
00117   flag.fem = 1;
00118   doedge ();
00119   buildarea();
00120 }


Member Function Documentation

float fem::FEM::solvePDE ( fcts param,
int  how 
)

solve the PDE

Parameters:
param contain all the possible data for computation
how defines if the P1 quadrature
01001 {
01002   long            nsl = ((long) ns) * (2 * ((long) bdth) + 1);
01003   int             factorize = 1;
01004 
01005   if (how > nhowmax)
01006     erreur ("Too many linear systems");
01007   if (how < 0)
01008      {
01009        factorize = 0;
01010        how = -how;
01011        if (((how > nhow1) && (N == 1)) || ((how > nhow2) && (N == 2)))
01012           {
01013             sprintf (errbuf, "solve(..,'-%d') refers to an inexistant system", how);
01014             erreur (errbuf);
01015           }
01016      }
01017   if (((how > nhow1) && (N == 1)) || ((how > nhow2) && (N == 2)))
01018      {
01019        switch (N)
01020           {
01021           case 1:
01022             if (flag.complexe)
01023               a1c[nhow1++] = new creal[nsl];
01024             else
01025               a1[nhow1++] = new float[nsl];
01026 
01027             break;
01028           case 2:
01029             a2[nhow2++].init (nsl);
01030             break;
01031           }
01032      }
01033   if (flag.complexe)
01034      {
01035        if (N == 1)
01036          return pdeian (a1c[how - 1], param->sol1c, param->f1c, param->g1c, param->p1c, param->b1c,
01037                         param->nuxx1c, param->nuxy1c, param->nuyx1c, param->nuyy1c, param->a11c,
01038                         param->a21c, param->c1c, factorize);
01039        else if (N == 2)
01040          return pdeian (a2[how - 1], param->sol2, param->f2, param->g2, param->p2, param->b2,
01041                         param->nuxx2, param->nuxy2, param->nuyx2, param->nuyy2, param->a12,
01042                         param->a22, param->c2, factorize); 
01043        else
01044          return -1.F;
01045 
01046      }
01047   else
01048      {
01049        if (N == 1)
01050          return pdeian (a1[how - 1], param->sol1, param->f1, param->g1, param->p1, param->b1,
01051                         param->nuxx1, param->nuxy1, param->nuyx1, param->nuyy1, param->a11,
01052                         param->a21, param->c1, factorize);
01053        else if (N == 2)
01054          return pdeian (a2[how - 1], param->sol2, param->f2, param->g2, param->p2, param->b2,
01055                         param->nuxx2, param->nuxy2, param->nuyx2, param->nuyy2, param->a12,
01056                         param->a22, param->c2, factorize); 
01057        else
01058          return -1.F;
01059      }
01060 }

int fem::FEM::getregion ( int  k  ) 

Returns:
the ngt of a femTriangle to which belongs vertex k
01277 {
01278   return __mesh->ngt[listHead[i]];
01279 
01280 }


The documentation for this class was generated from the following files:

This is the FreeFEM reference manual
Provided by The KFEM project