00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __FEMPARSER_H
00032 #define __FEMPARSER_H
00033
00034 #include <list>
00035 #include <femCommon.hpp>
00036
00037 #include <femMesh.hpp>
00038 #include <femDisk.hpp>
00039 #include <femTreeNode.hpp>
00040 #include <femIdentifier.hpp>
00041
00042 #include <cstring>
00043
00044 namespace fem
00045 {
00046
00054 const int refbdy = 60;
00055
00056
00057 DECLARE_CLASS(function);
00058 DECLARE_CLASS(var);
00059 DECLARE_CLASS(femGraphicDeviceIndependent);
00060 DECLARE_CLASS(FEM);
00061
00062 class ident;
00063 DECLARE_CLASS(femMesh);
00064
00072 struct var
00073 {
00074 ident *x, *y, *cursom, *t, *ng, *region, *ne, *I, *pi, *nx, *ny;
00075 };
00076
00077 extern int OPTION;
00078 extern var variables;
00079
00080
00081 DECLARE_CLASS(femParser);
00082
00093 class femParser
00094 {
00095 public:
00096
00100
00102 enum GraphicsType
00103 {
00104 FEM_GRAPHIC = 0,
00105 FEM_NO_GRAPHIC = 1
00106 };
00108
00112
00114
00117 femParser();
00118
00120 ~femParser();
00121
00123
00127
00129 void setGraphicType( GraphicsType gt )
00130 {
00131 __graphic_type = gt;
00132 }
00133
00135 void setText( const char* __t )
00136 {
00137 if ( __text != 0 )
00138 {
00139 delete[] __text;
00140 }
00141 __text = new char[strlen( __t )+1];
00142 strcpy( __text, __t );
00143 }
00144
00146
00149
00151 static femParser* New()
00152 {
00153 return new femParser;
00154 }
00155
00157 void parse();
00158
00160 void chvar(void);
00161
00163 noeudPtr instruction(void);
00164
00166 creal eval(noeudPtr);
00167
00169 void bucheron(noeudPtr);
00170
00172 void libere(void);
00173
00175 void showtree(noeudPtr t);
00176
00178 void initsyntax();
00179
00181 void libereparam(void);
00182
00184 void initparam();
00185
00187 inline femMeshCptr getMesh() const
00188 {
00189 return &__mesh;
00190 }
00192
00193 private:
00194
00195
00196 void plante (noeudPtr *, Symbol, creal, long, ident *, char *, noeud *, noeud *, noeud *, noeud *);
00197 void match (Symbol);
00198 noeudPtr facteur ();
00199 noeudPtr terme ();
00200 noeudPtr exprarith ();
00201 noeudPtr exprcomp ();
00202 noeudPtr expr ();
00203 noeudPtr fctfileproc ();
00204 noeudPtr symb_bdyproc ();
00205 noeudPtr symb_dchproc ();
00206 noeudPtr symb_solvproc ();
00207 noeudPtr diskmshproc ();
00208 noeudPtr preparesolve ();
00209 noeudPtr prepvarsolve ();
00210 noeudPtr symb_pdeproc ();
00211 void edp (noeudPtr s);
00212 void defbdybypoint (noeudPtr s);
00213 void defbdy (noeudPtr);
00214 void build (noeudPtr);
00215 void maketable (noeudPtr);
00216 void conddch (noeudPtr);
00217 void condfrr (noeudPtr);
00218 void solve (noeudPtr);
00219 void oppde (noeudPtr);
00220 void sauvefct (noeudPtr);
00221 void chargfct (noeudPtr);
00222 void plot (noeudPtr);
00223 void plot3d (noeudPtr);
00224 void chartrig (noeudPtr);
00225 void sauvtrig (noeudPtr);
00226 void showident (ident *);
00227 void showtreeaux (int, noeudPtr);
00228 void adapt(noeudPtr);
00229 void reinitialize ();
00230 int setgeom (int cursloc, int iloc, int precise);
00231 void varpde(noeudPtr s);
00232 void doconddch(int i, int cursloc,int iloc,int* ib,noeudPtr s);
00233 void opcondlim (noeudPtr s);
00234
00235 private:
00236
00237 noeudPtr __tree;
00238
00239
00240 std::list<function> __function_list;
00241 femMesh __mesh;
00242 femGraphicDeviceIndependentPtr __graph;
00243 FEMPtr __fem;
00244
00245 int OPTION;
00246 int i123;
00247
00248 int imdnu, thesgndnu;
00249 char* saveallname;
00250 int ihowsyst;
00251 char* pt;
00252 fcts param;
00253 int cursloc, cursom, numnoeuds;
00254 long nbsd;
00255 long nbs, nba;
00256
00257 noeudPtr* noeuds;
00258 long* sd;
00259 long* arete;
00260 int* ngbdy;
00261 float* cr;
00262 float* hh;
00263
00264 int NumOfIterations;
00265 int Iter;
00266
00267 var variables;
00268 int waitm ;
00269
00270 char* __text;
00271
00272 GraphicsType __graphic_type;
00273 };
00274 }
00275
00276
00277 #endif
00278
00279
00280
00281
00282