flowmodel.h

00001 /*************************************************************************************
00002  * MechSys - A C++ library to simulate (Continuum) Mechanical Systems                *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>       *
00004  * Copyright (C) 2005 Raul Dario Durand Farfan  <raul.durand at gmail.com>           *
00005  *                                                                                   *
00006  * This file is part of MechSys.                                                     *
00007  *                                                                                   *
00008  * MechSys is free software; you can redistribute it and/or modify it under the      *
00009  * terms of the GNU General Public License as published by the Free Software         *
00010  * Foundation; either version 2 of the License, or (at your option) any later        *
00011  * version.                                                                          *
00012  *                                                                                   *
00013  * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY        *
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   *
00015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.          *
00016  *                                                                                   *
00017  * You should have received a copy of the GNU General Public License along with      *
00018  * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
00019  * Fifth Floor, Boston, MA 02110-1301, USA                                           *
00020  *************************************************************************************/
00021 
00022 #ifndef MECHSYS_FLOWMODEL_H
00023 #define MECHSYS_FLOWMODEL_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026     #include "config.h"
00027 #endif
00028 #ifndef REAL
00029     #define REAL double
00030 #endif
00031 
00032 // STL
00033 #include <map>
00034 #include <string>
00035 
00036 // Blitz++
00037 #include <blitz/tinyvec-et.h>
00038 
00039 // MechSys
00040 #include "util/array.h"
00041 #include "tensors/tensors.h"
00042 
00043 using Tensors::Tensor2;
00044 
00045 class FlowModel
00046 {
00047 public:
00048     // Destructor
00049     virtual ~FlowModel() {}
00050 
00051     // Methods
00052     virtual String Name           () const =0;
00053     virtual void   TgPermeability (Tensor2 & K) const =0;
00054     virtual void   FlowVelocity   (Tensor1 const & Grad, Tensor1 & Vel) const =0;
00055     virtual void   FlowUpdate     (REAL const & DPp) =0;
00056     virtual void   BackupState    () =0;
00057     virtual void   RestoreState   () =0;
00058 
00059     // Access methods
00060     virtual REAL Pp     () const =0; 
00061     virtual REAL GammaW () const =0;
00062     virtual int  nInternalStateValues () const =0;
00063     virtual void InternalStateValues  (Array<REAL>   & IntStateVals ) const =0;
00064     virtual void InternalStateNames   (Array<String> & IntStateNames) const =0;
00065 
00066 }; // class FlowModel
00067 
00068 
00070 
00071 // Define a pointer to a function that makes (allocate) a new FlowModel
00072 typedef FlowModel * (*FlowModelMakerPtr)(Array<REAL> const & Prms, Array<REAL> const & IniData);
00073 
00074 // Typdef of the array map that contains all the pointers to the functions that makes FlowModels
00075 typedef std::map<String, FlowModelMakerPtr, std::less<String> > FlowModelFactory_t;
00076 
00077 // Instantiate the array map that contains all the pointers to the functions that makes FlowModels
00078 FlowModelFactory_t FlowModelFactory;
00079 
00080 // Allocate a new FlowModel according to a string giving the name of the FlowModel
00081 FlowModel * AllocFlowModel(String const & Name, Array<REAL> const & Prms, Array<REAL> const & IniData)
00082 {
00083     FlowModelMakerPtr ptr=NULL;
00084     ptr = FlowModelFactory[Name];
00085     if (ptr==NULL)
00086         throw new Fatal(_("FEM::AllocFlowModel: There is no < %s > implemented in this library\n"),Name.c_str());
00087     return (*ptr)(Prms, IniData);
00088 }
00089 
00090 // }}}
00091 
00092 #endif // MECHSYS_FLOWMODEL_H
00093 
00094 // vim:fdm=marker

Generated on Wed Jan 24 15:56:27 2007 for MechSys by  doxygen 1.4.7