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
namespace fem
00043 {
00044
00052
const int refbdy = 60;
00053
00054
00055
DECLARE_CLASS(function);
00056
DECLARE_CLASS(var);
00057
DECLARE_CLASS(femGraphicDeviceIndependent);
00058
DECLARE_CLASS(FEM);
00059
00060
class ident;
00061
DECLARE_CLASS(femMesh);
00062
00070 struct var
00071 {
00072
ident *x, *y, *cursom, *t, *ng, *region, *ne, *I, *pi, *nx, *ny;
00073 };
00074
00075
extern int OPTION;
00076
extern var variables;
00077
00078
00079
DECLARE_CLASS(
femParser);
00080
00091 class femParser
00092 {
00093
public:
00094
00098
00100 enum GraphicsType
00101 {
00102
FEM_GRAPHIC = 0,
00103
FEM_NO_GRAPHIC = 1
00104 };
00106
00110
00112
00115
femParser();
00116
00118
~femParser();
00119
00121
00125
00127 void setGraphicType( GraphicsType gt )
00128 {
00129 __graphic_type = gt;
00130 }
00131
00133 void setText(
const char* __t )
00134 {
00135
if ( __text != 0 )
00136 {
00137
delete[] __text;
00138 }
00139 __text =
new char[strlen( __t )+1];
00140 strcpy( __text, __t );
00141 }
00142
00144
00147
00149 static femParser*
New()
00150 {
00151
return new femParser;
00152 }
00153
00155
void parse();
00156
00158
void chvar(
void);
00159
00161 noeudPtr instruction(
void);
00162
00164 creal eval(noeudPtr);
00165
00167
void bucheron(noeudPtr);
00168
00170
void libere(
void);
00171
00173
void showtree(noeudPtr t);
00174
00176
void initsyntax();
00177
00179
void libereparam(
void);
00180
00182
void initparam();
00183
00185 inline femMeshCptr
getMesh()
const
00186
{
00187
return &__mesh;
00188 }
00190
00191
private:
00192
00193
00194
void plante (noeudPtr *, Symbol, creal,
long,
ident *,
char *,
noeud *,
noeud *,
noeud *,
noeud *);
00195
void match (Symbol);
00196 noeudPtr facteur ();
00197 noeudPtr terme ();
00198 noeudPtr exprarith ();
00199 noeudPtr exprcomp ();
00200 noeudPtr expr ();
00201 noeudPtr fctfileproc ();
00202 noeudPtr symb_bdyproc ();
00203 noeudPtr symb_dchproc ();
00204 noeudPtr symb_solvproc ();
00205 noeudPtr diskmshproc ();
00206 noeudPtr preparesolve ();
00207 noeudPtr prepvarsolve ();
00208 noeudPtr symb_pdeproc ();
00209
void edp (noeudPtr s);
00210
void defbdybypoint (noeudPtr s);
00211
void defbdy (noeudPtr);
00212
void build (noeudPtr);
00213
void maketable (noeudPtr);
00214
void conddch (noeudPtr);
00215
void condfrr (noeudPtr);
00216
void solve (noeudPtr);
00217
void oppde (noeudPtr);
00218
void sauvefct (noeudPtr);
00219
void chargfct (noeudPtr);
00220
void plot (noeudPtr);
00221
void plot3d (noeudPtr);
00222
void chartrig (noeudPtr);
00223
void sauvtrig (noeudPtr);
00224
void showident (
ident *);
00225
void showtreeaux (
int, noeudPtr);
00226
void adapt(noeudPtr);
00227
void reinitialize ();
00228
int setgeom (
int cursloc,
int iloc,
int precise);
00229
void varpde(noeudPtr s);
00230
void doconddch(
int i,
int cursloc,
int iloc,
int* ib,noeudPtr s);
00231
void opcondlim (noeudPtr s);
00232
00233
private:
00234
00235 noeudPtr __tree;
00236
00237
00238 std::list<function> __function_list;
00239
femMesh __mesh;
00240 femGraphicDeviceIndependentPtr __graph;
00241 FEMPtr __fem;
00242
00243
int OPTION;
00244
int i123;
00245
00246
int imdnu, thesgndnu;
00247
char* saveallname;
00248
int ihowsyst;
00249
char* pt;
00250
fcts param;
00251
int cursloc, cursom, numnoeuds;
00252
long nbsd;
00253
long nbs, nba;
00254
00255 noeudPtr* noeuds;
00256
long* sd;
00257
long* arete;
00258
int* ngbdy;
00259
float* cr;
00260
float* hh;
00261
00262
int NumOfIterations;
00263
int Iter;
00264
00265
var variables;
00266
int waitm ;
00267
00268
char* __text;
00269
00270 GraphicsType __graphic_type;
00271 };
00272 }
00273
00274
00275
#endif
00276
00277
00278
00279
00280