FreeFem 3.5.x
|
00001 // Emacs will be in -*- Mode: c++ -*- 00002 // 00003 // ********** DO NOT REMOVE THIS BANNER ********** 00004 // 00005 // SUMMARY: Language for a Finite Element Method 00006 // RELEASE: 00007 // AUTHORS: C. Prud'homme 00008 // ORG : 00009 // E-MAIL : prudhomm@users.sourceforge.net 00010 // 00011 // ORIG-DATE: June-94 00012 // LAST-MOD: 12-Jul-01 at 10:01:47 by 00013 // 00014 // DESCRIPTION: 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; either version 2 of the License, or 00018 // (at your option) any later version. 00019 00020 // This program is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 // GNU General Public License for more details. 00024 00025 // You should have received a copy of the GNU General Public License 00026 // along with this program; if not, write to the Free Software 00027 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 // DESCRIP-END. 00029 // 00030 #ifndef __FEM_H 00031 #ifdef __GNUG__ 00032 #pragma interface 00033 #endif 00034 #define __FEM_H 1 00035 00036 #define nhowmax 20 00037 00038 #include <femCommon.hpp> 00039 00040 #include <femMisc.hpp> 00041 00042 namespace fem 00043 { 00044 DECLARE_CLASS( FEM ); 00045 DECLARE_CLASS( femMesh ); 00046 00055 class FEM 00056 { 00057 public: 00058 00062 DECLARE_TYPE( femMesh::femPoint, femPoint ); 00063 DECLARE_TYPE( femMesh::femTriangle, femTriangle ); 00064 00065 DECLARE_TYPE( creal*, cmatptr ); 00066 DECLARE_TYPE( float*, matptr ); 00068 00072 00074 FEM( femMeshPtr = 0, int quadra = 0 ); 00075 00077 ~FEM(); 00078 00084 float solvePDE( fcts *param, int how); 00085 00088 creal deriv (int m, creal * f, int ksolv, int i); 00089 00092 creal convect(creal* f, creal* u1, creal* u2, float dt, int i); 00093 00096 creal rhsConvect(creal* f, creal* u1, creal* u2, float dt, int i); 00097 00100 creal fctval(creal* f,float x,float y); 00101 00105 int getregion(int k); 00106 00107 creal gfemuser( creal what, creal *f, int i); 00108 creal P1ctoP1(creal* f, int i); 00109 creal prodscalar(creal* f, creal* g); 00110 00111 creal ginteg(int, int, int, creal*, creal*, int); 00112 creal binteg(int, int, int, creal*, creal*, int); 00113 00114 void initvarmat ( int how, int flagcomplexe,int N, fcts* param); 00115 void assemble ( int how, int flagcomplexe,int N, int k, creal* a, creal* b, fcts* param); 00116 void solvevarpde(int N, fcts* param, int how); 00117 00119 00120 private: 00121 00122 float norm( float, float ) const; 00123 00124 int doedge (void); 00125 int Tconvect (int k, double u1k, double u2k, double x, double y, double *mu, double *nu); 00126 int xtoX (creal * u1, creal * u2, float *dt, float *x, float *y, int *k); 00127 int barycoor (float x, float y, int k, float *xl0, float *xl1, float *xl2); 00128 void rhsPDE(Acvect & fw, Acvect & f, Acvect & g); 00129 int buildarea(); 00130 void connectiv (void); 00131 00134 cmat id(cvect& x); 00135 00136 void pdemat (Acmat & a, Acmat & alpha, 00137 Acmat & rho11, Acmat & rho12, Acmat & rho21, Acmat & rho22, 00138 Acmat & u1, Acmat & u2, Acmat & beta); 00139 float gaussband (Acmat & a, Acvect & x, long n, long bdth, int first, float eps); 00140 float pdeian (Acmat & a, Acvect & u, Acvect & f, Acvect & g, Acvect & u0, 00141 Acmat & alpha, Acmat & rho11, Acmat & rho12, Acmat & rho21, Acmat & rho22, 00142 Acmat & u1, Acmat & u2, Acmat & beta, int factorize); 00143 00144 00147 float id(float x); 00148 00155 void rhsPDE(float* fw, float* f, float* g); 00156 00164 float gaussband (float* a, float* x, long n, long bdthl, int first, float eps); 00165 00166 void pdemat (float* a, float* alpha, 00167 float* rho11, float* rho12, float* rho21, float* rho22, 00168 float* u1, float* u2, float* beta); 00175 float pdeian(float* a, float* u, float* f, float* g, float* u0, 00176 float* alpha, float* rho11, float* rho12, float* rho21, float* rho22, 00177 float* u1, float* u2, float* beta, int factorize); 00178 00181 void rhsPDE(creal* fw, creal* f, creal* g); 00182 00183 float gaussband (creal* a, creal* x, long n, long bdthl, int first, float eps); 00184 00185 float pdeian(creal* a, creal* u, creal* f, creal* g, creal* u0, 00186 creal* alpha, creal* rho11, creal* rho12, creal* rho21, creal* rho22, 00187 creal* u1, creal* u2, creal* beta, int factorize); 00188 00189 void pdemat (creal* a, creal* alpha, 00190 creal* rho11, creal* rho12, creal* rho21, creal* rho22, 00191 creal* u1, creal* u2, creal* beta); 00192 00196 creal binteg_t (int k, int ref1, int ref2, int ref3, creal* f, creal* g); 00197 creal ginteg_t (int k, creal* f, creal* g); 00198 00199 public: 00200 00201 float* normlx; 00202 float* normly; 00203 00204 private: 00205 00206 femMeshPtr __mesh; 00207 int __quadra; 00208 00209 int ns, nt; 00210 femPoint *q; 00211 femTriangle *me; 00212 int *ng; 00213 int *ngt; 00214 00215 int bug; 00216 int nhow; 00217 int nhow1; 00218 int nhow2; 00219 00220 struct 00221 { 00222 int N; 00223 int nhow; 00224 }whatmat[nhowmax]; 00225 00226 float *area; 00227 AAcmat a2; 00228 creal *a1c[nhowmax]; 00229 creal *gconvect; 00230 int rhsQuadra; 00231 float *a1[nhowmax]; 00232 int *triauptr; 00233 int *triaunb; 00234 long bdth; 00235 00236 int *Tleft; 00237 int *Tright; 00238 int *lowV; 00239 int *highV; 00240 int *listHead; 00241 femTriangle *edgeT; 00242 int ne; 00243 00244 }; 00245 } 00246 #endif /* __FEM_H */