FreeFem  3.5.x
femParser.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 //
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 09:49:43 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 
31 #ifndef __FEMPARSER_H
32 #define __FEMPARSER_H
33 
34 #include <list>
35 #include <femCommon.hpp>
36 #include <string.h>
37 
38 #include <femMesh.hpp>
39 #include <femDisk.hpp>
40 #include <femTreeNode.hpp>
41 #include <femIdentifier.hpp>
42 
43 namespace fem
44 {
45 
53  const int refbdy = 60;
54 
55 
56  DECLARE_CLASS(function);
57  DECLARE_CLASS(var);
58  DECLARE_CLASS(femGraphicDeviceIndependent);
59  DECLARE_CLASS(FEM);
60  //DECLARE_CLASS( ident );
61  class ident;
62  DECLARE_CLASS(femMesh);
63 
71  struct var
72  {
73  ident *x, *y, *cursom, *t, *ng, *region, *ne, *I, *pi, *nx, *ny;
74  };
75 
76  extern int OPTION;
77  extern var variables;
78 
79 
81 
92  class femParser
93  {
94  public:
95 
99 
102  {
105  };
107 
111 
113 
116  femParser();
117 
119  ~femParser();
120 
122 
126 
129  {
130  __graphic_type = gt;
131  }
132 
134  void setText( const char* __t )
135  {
136  if ( __text != 0 )
137  {
138  delete[] __text;
139  }
140  __text = new char[strlen( __t )+1];
141  strcpy( __text, __t );
142  }
143 
145 
148 
150  static femParser* New()
151  {
152  return new femParser;
153  }
154 
156  void parse();
157 
159  void chvar(void);
160 
162  noeudPtr instruction(void);
163 
165  creal eval(noeudPtr);
166 
168  void bucheron(noeudPtr);
169 
171  void libere(void);
172 
174  void showtree(noeudPtr t);
175 
177  void initsyntax();
178 
180  void libereparam(void);
181 
183  void initparam();
184 
186  inline femMeshCptr getMesh() const
187  {
188  return &__mesh;
189  }
191 
192  private:
193 
194  /* femParser.c prototypes for routines not used elsewhere */
195  void plante (noeudPtr *, Symbol, creal, long, ident *, char *, noeud *, noeud *, noeud *, noeud *);
196  void match (Symbol);
197  noeudPtr facteur ();
198  noeudPtr terme ();
199  noeudPtr exprarith ();
200  noeudPtr exprcomp ();
201  noeudPtr expr ();
202  noeudPtr fctfileproc ();
203  noeudPtr symb_bdyproc ();
204  noeudPtr symb_dchproc ();
205  noeudPtr symb_solvproc ();
206  noeudPtr diskmshproc ();
207  noeudPtr preparesolve ();
208  noeudPtr prepvarsolve ();
209  noeudPtr symb_pdeproc ();
210  void edp (noeudPtr s);
211  void defbdybypoint (noeudPtr s);
212  void defbdy (noeudPtr);
213  void build (noeudPtr);
214  void maketable (noeudPtr);
215  void conddch (noeudPtr);
216  void condfrr (noeudPtr);
217  void solve (noeudPtr);
218  void oppde (noeudPtr);
219  void sauvefct (noeudPtr);
220  void chargfct (noeudPtr);
221  void plot (noeudPtr);
222  void plot3d (noeudPtr);
223  void chartrig (noeudPtr);
224  void sauvtrig (noeudPtr);
225  void showident (ident *);
226  void showtreeaux (int, noeudPtr);
227  void adapt(noeudPtr);
228  void reinitialize ();
229  int setgeom (int cursloc, int iloc, int precise);
230  void varpde(noeudPtr s);
231  void doconddch(int i, int cursloc,int iloc,int* ib,noeudPtr s);
232  void opcondlim (noeudPtr s);
233 
234  private:
235 
236  noeudPtr __tree;
237 
238 
239  std::list<function> __function_list;
240  femMesh __mesh;
241  femGraphicDeviceIndependentPtr __graph;
242  FEMPtr __fem;
243 
244  int OPTION;
245  int i123;
246 
247  int imdnu, thesgndnu; // carries info on sign of dnu(u) and address of u
248  char* saveallname; // file name for saveall
249  int ihowsyst; // matrix identifyer for the system
250  char* pt;
251  fcts param;
252  int cursloc, cursom, numnoeuds;
253  long nbsd;
254  long nbs, nba;
255 
256  noeudPtr* noeuds;
257  long* sd;
258  long* arete;
259  int* ngbdy;
260  float* cr;
261  float* hh;
262 
263  int NumOfIterations; // used to store the number of iterations (for xgfem)
264  int Iter; // Iteration numero
265 
266  var variables;
267  int waitm ;
268 
269  char* __text;
270 
271  GraphicsType __graphic_type;
272  };
273 }
274 
275 
276 #endif /* __FEMPARSER_H */
277 // Common rcs information do not modify
278 // $Author: prudhomm $
279 // $Revision: 206 $
280 // $Date: 2006-07-30 18:52:02 +0200 (Sun, 30 Jul 2006) $
281 // $Locker: $
Definition: femIdentifier.hpp:71
static femParser * New()
create a new instance
Definition: femParser.hpp:150
femParser()
default constructor
Definition: femParser.cpp:123
~femParser()
destructor
Definition: femParser.cpp:155
#define DECLARE_CLASS(tag)
Declare class , class pointer , const pointer, class reference and const class reference types for cl...
Definition: femCommon.hpp:64
creal eval(noeudPtr)
evaluate the node
Definition: femParser.cpp:2855
void bucheron(noeudPtr)
kill the node
Definition: femParser.cpp:3282
void setText(const char *__t)
set the buffer to be parsed
Definition: femParser.hpp:134
Definition: femDisk.cpp:50
Definition: femTreeNode.hpp:60
provides the syntaxical analysis
Definition: femParser.hpp:92
Mesh class.
Definition: femMesh.hpp:52
show the graphics
Definition: femParser.hpp:103
void initparam()
init the parameters
Definition: femParser.cpp:1417
defines a language variable
Definition: femParser.hpp:71
GraphicsType
graphics type
Definition: femParser.hpp:101
void parse()
parse the buffer
Definition: femParser.cpp:172
void initsyntax()
initialise the parser
void libereparam(void)
free the parameters
Definition: femParser.cpp:3300
do not show the graphics
Definition: femParser.hpp:104
void libere(void)
free everything
Definition: femParser.cpp:3388
Definition: femMisc.hpp:86
femMeshCptr getMesh() const
get the mesh
Definition: femParser.hpp:186
provide a pool for all the PDE data
Definition: femDisk.hpp:62
void setGraphicType(GraphicsType gt)
set the graphic type
Definition: femParser.hpp:128
void showtree(noeudPtr t)
show the tree
Definition: femParser.cpp:3444

This is the FreeFEM reference manual
Provided by The KFEM project