FreeFem  3.5.x
Public Attributes | List of all members
fem::FEM Class Reference

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

#include <femSolver.hpp>

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. More...
 
 ~FEM ()
 destructor
 
float solvePDE (fcts *param, int how)
 solve the PDE More...
 
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 Chris.nosp@m.toph.nosp@m.e.Pru.nosp@m.dhom.nosp@m.me@an.nosp@m.n.ju.nosp@m.ssieu.nosp@m..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

72  :
73  __mesh( __t ),
74  __quadra( quadra ),
75  bug( 0 ),
76  nhow( 0 ),
77  nhow1( 0 ),
78  nhow2( 0 ),
79  a1c(),
80  rhsQuadra( 0 )
81 {
82  int i, k, baux, nquad;
83 
84  ns = __mesh->getNumberOfPoints();
85  nt = __mesh->getNumberOfCells();
86  q = __mesh->rp;
87  me = __mesh->tr;
88  ng = __mesh->ng;
89  ngt = __mesh->ngt;
90  bdth = 0;
91  nquad = __quadra ? 3 * nt : ns;
92  for (k = 0; k < nt; k++)
93  for (i = 0; i <= 2; i++)
94  {
95  baux = abss ((me[k][i] - me[k][next[i]]));
96  bdth = (bdth > baux) ? bdth : baux;
97  }
98  a2.destroy();
99  a2.init (nhowmax);
100 
101  for( int __i = 0; __i < nhowmax; __i++)
102  {
103  a1c[__i] = 0;
104  }
105 
106  area = new float[nt];
107  normlx = new float[nquad];
108  normly = new float[nquad];
109  for (i = 0;i < nquad;i++)
110  {
111  normlx[i] = 0.F;
112  normly[i] = 0.F;
113  }
114  nhow1 = 0;
115  nhow2 = 0;
116  connectiv ();
117  flag.fem = 1;
118  doedge ();
119  buildarea();
120 }

Member Function Documentation

int fem::FEM::getregion ( int  k)
Returns
the ngt of a femTriangle to which belongs vertex k
1277 {
1278  return __mesh->ngt[listHead[i]];
1279 
1280 }
float fem::FEM::solvePDE ( fcts param,
int  how 
)

solve the PDE

Parameters
paramcontain all the possible data for computation
howdefines if the P1 quadrature
1001 {
1002  long nsl = ((long) ns) * (2 * ((long) bdth) + 1);
1003  int factorize = 1;
1004 
1005  if (how > nhowmax)
1006  erreur ("Too many linear systems");
1007  if (how < 0)
1008  {
1009  factorize = 0;
1010  how = -how;
1011  if (((how > nhow1) && (N == 1)) || ((how > nhow2) && (N == 2)))
1012  {
1013  sprintf (errbuf, "solve(..,'-%d') refers to an inexistant system", how);
1014  erreur (errbuf);
1015  }
1016  }
1017  if (((how > nhow1) && (N == 1)) || ((how > nhow2) && (N == 2)))
1018  {
1019  switch (N)
1020  {
1021  case 1:
1022  if (flag.complexe)
1023  a1c[nhow1++] = new creal[nsl];
1024  else
1025  a1[nhow1++] = new float[nsl];
1026 
1027  break;
1028  case 2:
1029  a2[nhow2++].init (nsl);
1030  break;
1031  }
1032  }
1033  if (flag.complexe)
1034  {
1035  if (N == 1)
1036  return pdeian (a1c[how - 1], param->sol1c, param->f1c, param->g1c, param->p1c, param->b1c,
1037  param->nuxx1c, param->nuxy1c, param->nuyx1c, param->nuyy1c, param->a11c,
1038  param->a21c, param->c1c, factorize);
1039  else if (N == 2)
1040  return pdeian (a2[how - 1], param->sol2, param->f2, param->g2, param->p2, param->b2,
1041  param->nuxx2, param->nuxy2, param->nuyx2, param->nuyy2, param->a12,
1042  param->a22, param->c2, factorize);
1043  else
1044  return -1.F;
1045 
1046  }
1047  else
1048  {
1049  if (N == 1)
1050  return pdeian (a1[how - 1], param->sol1, param->f1, param->g1, param->p1, param->b1,
1051  param->nuxx1, param->nuxy1, param->nuyx1, param->nuyy1, param->a11,
1052  param->a21, param->c1, factorize);
1053  else if (N == 2)
1054  return pdeian (a2[how - 1], param->sol2, param->f2, param->g2, param->p2, param->b2,
1055  param->nuxx2, param->nuxy2, param->nuyx2, param->nuyy2, param->a12,
1056  param->a22, param->c2, factorize);
1057  else
1058  return -1.F;
1059  }
1060 }

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

This is the FreeFEM reference manual
Provided by The KFEM project