FreeFem  3.5.x
femSolver.hpp
1 // Emacs will be in -*- Mode: c++ -*-
2 //
3 // ********** DO NOT REMOVE THIS BANNER **********
4 //
5 // SUMMARY: Language for a Finite Element Method
6 // RELEASE:
7 // AUTHORS: C. Prud'homme
8 // ORG :
9 // E-MAIL : prudhomm@users.sourceforge.net
10 //
11 // ORIG-DATE: June-94
12 // LAST-MOD: 12-Jul-01 at 10:01:47 by
13 //
14 // DESCRIPTION:
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; either version 2 of the License, or
18 // (at your option) any later version.
19 
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 
25 // You should have received a copy of the GNU General Public License
26 // along with this program; if not, write to the Free Software
27 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 // DESCRIP-END.
29 //
30 #ifndef __FEM_H
31 #ifdef __GNUG__
32 #pragma interface
33 #endif
34 #define __FEM_H 1
35 
36 #define nhowmax 20
37 
38 #include <femCommon.hpp>
39 
40 #include <femMisc.hpp>
41 
42 namespace fem
43 {
44 DECLARE_CLASS( FEM );
45 DECLARE_CLASS( femMesh );
46 
55 class FEM
56 {
57 public:
58 
62  DECLARE_TYPE( femMesh::femPoint, femPoint );
63  DECLARE_TYPE( femMesh::femTriangle, femTriangle );
64 
65  DECLARE_TYPE( creal*, cmatptr );
66  DECLARE_TYPE( float*, matptr );
68 
72 
74  FEM( femMeshPtr = 0, int quadra = 0 );
75 
77  ~FEM();
78 
84  float solvePDE( fcts *param, int how);
85 
88  creal deriv (int m, creal * f, int ksolv, int i);
89 
92  creal convect(creal* f, creal* u1, creal* u2, float dt, int i);
93 
96  creal rhsConvect(creal* f, creal* u1, creal* u2, float dt, int i);
97 
100  creal fctval(creal* f,float x,float y);
101 
105  int getregion(int k);
106 
107  creal gfemuser( creal what, creal *f, int i);
108  creal P1ctoP1(creal* f, int i);
109  creal prodscalar(creal* f, creal* g);
110 
111  creal ginteg(int, int, int, creal*, creal*, int);
112  creal binteg(int, int, int, creal*, creal*, int);
113 
114  void initvarmat ( int how, int flagcomplexe,int N, fcts* param);
115  void assemble ( int how, int flagcomplexe,int N, int k, creal* a, creal* b, fcts* param);
116  void solvevarpde(int N, fcts* param, int how);
117 
119 
120 private:
121 
122  float norm( float, float ) const;
123 
124  int doedge (void);
125  int Tconvect (int k, double u1k, double u2k, double x, double y, double *mu, double *nu);
126  int xtoX (creal * u1, creal * u2, float *dt, float *x, float *y, int *k);
127  int barycoor (float x, float y, int k, float *xl0, float *xl1, float *xl2);
128  void rhsPDE(Acvect & fw, Acvect & f, Acvect & g);
129  int buildarea();
130  void connectiv (void);
131 
134  cmat id(cvect& x);
135 
136  void pdemat (Acmat & a, Acmat & alpha,
137  Acmat & rho11, Acmat & rho12, Acmat & rho21, Acmat & rho22,
138  Acmat & u1, Acmat & u2, Acmat & beta);
139  float gaussband (Acmat & a, Acvect & x, long n, long bdth, int first, float eps);
140  float pdeian (Acmat & a, Acvect & u, Acvect & f, Acvect & g, Acvect & u0,
141  Acmat & alpha, Acmat & rho11, Acmat & rho12, Acmat & rho21, Acmat & rho22,
142  Acmat & u1, Acmat & u2, Acmat & beta, int factorize);
143 
144 
147  float id(float x);
148 
155  void rhsPDE(float* fw, float* f, float* g);
156 
164  float gaussband (float* a, float* x, long n, long bdthl, int first, float eps);
165 
166  void pdemat (float* a, float* alpha,
167  float* rho11, float* rho12, float* rho21, float* rho22,
168  float* u1, float* u2, float* beta);
175  float pdeian(float* a, float* u, float* f, float* g, float* u0,
176  float* alpha, float* rho11, float* rho12, float* rho21, float* rho22,
177  float* u1, float* u2, float* beta, int factorize);
178 
181  void rhsPDE(creal* fw, creal* f, creal* g);
182 
183  float gaussband (creal* a, creal* x, long n, long bdthl, int first, float eps);
184 
185  float pdeian(creal* a, creal* u, creal* f, creal* g, creal* u0,
186  creal* alpha, creal* rho11, creal* rho12, creal* rho21, creal* rho22,
187  creal* u1, creal* u2, creal* beta, int factorize);
188 
189  void pdemat (creal* a, creal* alpha,
190  creal* rho11, creal* rho12, creal* rho21, creal* rho22,
191  creal* u1, creal* u2, creal* beta);
192 
196  creal binteg_t (int k, int ref1, int ref2, int ref3, creal* f, creal* g);
197  creal ginteg_t (int k, creal* f, creal* g);
198 
199 public:
200 
201  float* normlx;
202  float* normly;
203 
204 private:
205 
206  femMeshPtr __mesh;
207  int __quadra;
208 
209  int ns, nt;
210  femPoint *q;
211  femTriangle *me;
212  int *ng;
213  int *ngt;
214 
215  int bug;
216  int nhow;
217  int nhow1;
218  int nhow2;
219 
220  struct
221  {
222  int N;
223  int nhow;
224  }whatmat[nhowmax];
225 
226  float *area;
227  AAcmat a2;
228  creal *a1c[nhowmax];
229  creal *gconvect;
230  int rhsQuadra;
231  float *a1[nhowmax];
232  int *triauptr;
233  int *triaunb;
234  long bdth;
235 
236  int *Tleft;
237  int *Tright;
238  int *lowV;
239  int *highV;
240  int *listHead;
241  femTriangle *edgeT;
242  int ne;
243 
244 };
245 }
246 #endif /* __FEM_H */
Definition: femMisc.hpp:342
#define DECLARE_CLASS(tag)
Declare class , class pointer , const pointer, class reference and const class reference types for cl...
Definition: femCommon.hpp:64
float femPoint[2]
node type
Definition: femMesh.hpp:67
this class drives the resolution of the pde using the Finite Element Method.
Definition: femSolver.hpp:55
Definition: femMisc.hpp:377
~FEM()
destructor
Definition: femSolver.cpp:122
Definition: femMisc.hpp:175
Definition: femMisc.hpp:212
DECLARE_TYPE(femMesh::femPoint, femPoint)
Typedefs.
long femTriangle[3]
cell type
Definition: femMesh.hpp:70
Definition: femMisc.hpp:357
float solvePDE(fcts *param, int how)
solve the PDE
Definition: femSolver.cpp:1000
Definition: femMisc.hpp:86
FEM(femMeshPtr=0, int quadra=0)
Constructors, destructor and methods.
Definition: femSolver.cpp:71
provide a pool for all the PDE data
Definition: femDisk.hpp:62
int getregion(int k)
Definition: femSolver.cpp:1276

This is the FreeFEM reference manual
Provided by The KFEM project