---
name: "fem_FEM"
section: "3"
platform: "linux"
package: "libfreefem-dev"
version: "3.5.7-3"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/fem_FEM"
---

# fem\_FEM(3)

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

## NAME

fem::FEM - this class drives the resolution of the pde using the Finite Element Method.

## SYNOPSIS

`#include <femSolver.hpp>`

### Public Member Functions

**DECLARE\_TYPE** (**femMesh::femPoint**, femPoint)\
 **DECLARE\_TYPE** (**femMesh::femTriangle**, femTriangle)\
 **DECLARE\_TYPE** (creal \*, cmatptr)\
 **DECLARE\_TYPE** (float \*, matptr)\

**FEM** (femMeshPtr=0, int quadra=0)\
 *default constructor*  **~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**\

## 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**.RS 4 **femSolver.hpp**,v 1.2 2001/07/12 14:11:57 prudhomm Exp

\#

## 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:**

*param* contain all the possible data for computation \
 *how* defines 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 }
```

## Author

Generated automatically by Doxygen for FreeFem from the source code.
