femParser.hpp

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 
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   //DECLARE_CLASS( ident );
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     /* femParser.c prototypes for routines not used elsewhere */
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;   // carries info on sign of dnu(u) and address of u
00247     char*           saveallname;        // file name for saveall
00248     int             ihowsyst;   // matrix identifyer for the system
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; // used to store the number of iterations (for xgfem)
00263     int Iter; // Iteration numero
00264   
00265     var             variables;
00266     int             waitm ;
00267 
00268     char* __text;
00269 
00270     GraphicsType __graphic_type;
00271   };
00272 }
00273 
00274 
00275 #endif /* __FEMPARSER_H */
00276 // Common rcs information do not modify
00277 // $Author: prudhomm $
00278 // $Revision: 206 $
00279 // $Date: 2006-07-30 18:52:02 +0200 (Sun, 30 Jul 2006) $
00280 // $Locker:  $

This is the FreeFEM reference manual
Provided by The KFEM project