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 // 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 09:49:43 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 00031 #ifndef __FEMPARSER_H 00032 #define __FEMPARSER_H 00033 00034 #include <list> 00035 #include <femCommon.hpp> 00036 #include <string.h> 00037 00038 #include <femMesh.hpp> 00039 #include <femDisk.hpp> 00040 #include <femTreeNode.hpp> 00041 #include <femIdentifier.hpp> 00042 00043 namespace fem 00044 { 00045 00053 const int refbdy = 60; 00054 00055 00056 DECLARE_CLASS(function); 00057 DECLARE_CLASS(var); 00058 DECLARE_CLASS(femGraphicDeviceIndependent); 00059 DECLARE_CLASS(FEM); 00060 //DECLARE_CLASS( ident ); 00061 class ident; 00062 DECLARE_CLASS(femMesh); 00063 00071 struct var 00072 { 00073 ident *x, *y, *cursom, *t, *ng, *region, *ne, *I, *pi, *nx, *ny; 00074 }; 00075 00076 extern int OPTION; 00077 extern var variables; 00078 00079 00080 DECLARE_CLASS(femParser); 00081 00092 class femParser 00093 { 00094 public: 00095 00099 00101 enum GraphicsType 00102 { 00103 FEM_GRAPHIC = 0, 00104 FEM_NO_GRAPHIC = 1 00105 }; 00107 00111 00113 00116 femParser(); 00117 00119 ~femParser(); 00120 00122 00126 00128 void setGraphicType( GraphicsType gt ) 00129 { 00130 __graphic_type = gt; 00131 } 00132 00134 void setText( const char* __t ) 00135 { 00136 if ( __text != 0 ) 00137 { 00138 delete[] __text; 00139 } 00140 __text = new char[strlen( __t )+1]; 00141 strcpy( __text, __t ); 00142 } 00143 00145 00148 00150 static femParser* New() 00151 { 00152 return new femParser; 00153 } 00154 00156 void parse(); 00157 00159 void chvar(void); 00160 00162 noeudPtr instruction(void); 00163 00165 creal eval(noeudPtr); 00166 00168 void bucheron(noeudPtr); 00169 00171 void libere(void); 00172 00174 void showtree(noeudPtr t); 00175 00177 void initsyntax(); 00178 00180 void libereparam(void); 00181 00183 void initparam(); 00184 00186 inline femMeshCptr getMesh() const 00187 { 00188 return &__mesh; 00189 } 00191 00192 private: 00193 00194 /* femParser.c prototypes for routines not used elsewhere */ 00195 void plante (noeudPtr *, Symbol, creal, long, ident *, char *, noeud *, noeud *, noeud *, noeud *); 00196 void match (Symbol); 00197 noeudPtr facteur (); 00198 noeudPtr terme (); 00199 noeudPtr exprarith (); 00200 noeudPtr exprcomp (); 00201 noeudPtr expr (); 00202 noeudPtr fctfileproc (); 00203 noeudPtr symb_bdyproc (); 00204 noeudPtr symb_dchproc (); 00205 noeudPtr symb_solvproc (); 00206 noeudPtr diskmshproc (); 00207 noeudPtr preparesolve (); 00208 noeudPtr prepvarsolve (); 00209 noeudPtr symb_pdeproc (); 00210 void edp (noeudPtr s); 00211 void defbdybypoint (noeudPtr s); 00212 void defbdy (noeudPtr); 00213 void build (noeudPtr); 00214 void maketable (noeudPtr); 00215 void conddch (noeudPtr); 00216 void condfrr (noeudPtr); 00217 void solve (noeudPtr); 00218 void oppde (noeudPtr); 00219 void sauvefct (noeudPtr); 00220 void chargfct (noeudPtr); 00221 void plot (noeudPtr); 00222 void plot3d (noeudPtr); 00223 void chartrig (noeudPtr); 00224 void sauvtrig (noeudPtr); 00225 void showident (ident *); 00226 void showtreeaux (int, noeudPtr); 00227 void adapt(noeudPtr); 00228 void reinitialize (); 00229 int setgeom (int cursloc, int iloc, int precise); 00230 void varpde(noeudPtr s); 00231 void doconddch(int i, int cursloc,int iloc,int* ib,noeudPtr s); 00232 void opcondlim (noeudPtr s); 00233 00234 private: 00235 00236 noeudPtr __tree; 00237 00238 00239 std::list<function> __function_list; 00240 femMesh __mesh; 00241 femGraphicDeviceIndependentPtr __graph; 00242 FEMPtr __fem; 00243 00244 int OPTION; 00245 int i123; 00246 00247 int imdnu, thesgndnu; // carries info on sign of dnu(u) and address of u 00248 char* saveallname; // file name for saveall 00249 int ihowsyst; // matrix identifyer for the system 00250 char* pt; 00251 fcts param; 00252 int cursloc, cursom, numnoeuds; 00253 long nbsd; 00254 long nbs, nba; 00255 00256 noeudPtr* noeuds; 00257 long* sd; 00258 long* arete; 00259 int* ngbdy; 00260 float* cr; 00261 float* hh; 00262 00263 int NumOfIterations; // used to store the number of iterations (for xgfem) 00264 int Iter; // Iteration numero 00265 00266 var variables; 00267 int waitm ; 00268 00269 char* __text; 00270 00271 GraphicsType __graphic_type; 00272 }; 00273 } 00274 00275 00276 #endif /* __FEMPARSER_H */ 00277 // Common rcs information do not modify 00278 // $Author: prudhomm $ 00279 // $Revision: 206 $ 00280 // $Date: 2006-07-30 18:52:02 +0200 (Sun, 30 Jul 2006) $ 00281 // $Locker: $