Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

ReducedModel.h

Go to the documentation of this file.
00001 // Copyright (C) 2004 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __REDUCED_MODEL_H
00005 #define __REDUCED_MODEL_H
00006 
00007 #include <dolfin/constants.h>
00008 #include <dolfin/NewArray.h>
00009 #include <dolfin/ODE.h>
00010 
00011 namespace dolfin
00012 {
00013   class Vector;
00014   class Function;
00015 
00030   
00031   class ReducedModel : public ODE
00032   {
00033   public:
00034     
00036     ReducedModel(ODE& ode);
00037     
00039     ~ReducedModel();
00040 
00042     real f(const Vector& u, real t, unsigned int i);
00043 
00045     real u0(unsigned int i);
00046 
00048     Element::Type method(unsigned int i);
00049 
00051     unsigned int order(unsigned int i);
00052 
00054     real timestep(unsigned int i);
00055     
00057     void update(RHS& f, Function& u, real t);
00058 
00060     void update(Solution& u, Adaptivity& adaptivity, real t);
00061 
00063     void save(Sample& sample);
00064 
00065   private:
00066 
00067     // The component-specific model
00068     class Model
00069     {
00070     public:
00071       
00073       Model();
00074 
00076       ~Model();
00077 
00079       real operator() () const;
00080 
00082       bool active() const;
00083 
00085       void inactivate();
00086 
00088       void computeModel(Vector& ubar, Vector& fbar, unsigned int i, 
00089                         real tau, ODE& ode);
00090 
00091     private:
00092 
00093       real g;
00094       bool _active;
00095 
00096     };
00097 
00098     // Compute averages
00099     void computeAverages(RHS& f, Function& u, Vector& fbar, Vector& ubar);
00100     
00101     // The given model
00102     ODE& ode;
00103 
00104     // The reduced model
00105     NewArray<Model> g;
00106 
00107     // True if model has been reduced
00108     bool reduced;
00109 
00110     // Length of running average
00111     real tau;
00112 
00113     // Number of samples for running average
00114     unsigned int samples;
00115 
00116     // Tolerance for active components
00117     real tol;
00118     
00119     // Averages of u and f
00120     Vector ubar;
00121     Vector fbar;
00122 
00123   };
00124 
00125 }
00126 
00127 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.