Dissipation.h

00001 #ifndef gridripper_amr1d_Dissipation_h
00002 #define gridripper_amr1d_Dissipation_h
00003 
00004 #include <gridripper/config.h>
00005 #include <gridripper/lang/IllegalArgumentException.h>
00006 #include <gridripper/tvalarray.h>
00007 #include <string>
00008 #include "Sigma.h"
00009 
00010 namespace gridripper { namespace amr1d {
00011 
00012 class Grid;
00013 class PDE;
00014 class FieldWrapper;
00015 
00016 using namespace std;
00017 
00024 class Dissipation {
00025 
00026 private:
00027     const Sigma* sigma;
00028 
00029 public:
00030     Dissipation() {
00031         sigma = NULL;
00032     }
00033 
00034     virtual ~Dissipation() { }
00035 
00045     virtual void addDissipation(const Grid& g, const PDE* pde, int i,
00046                                 tvalarray<GReal_t>& dfdt, int exclude) =0;
00047 
00052     const Sigma& getSigma() const {
00053         return *sigma;
00054     }
00055 
00060     void setSigma(const Sigma& s) {
00061         sigma = &s;
00062     }
00063 
00068     virtual string toString() const =0;
00069 
00070 protected:
00077     GReal_t evalSigma(const Grid& g, int i) const;
00078 };
00079 
00083 class O2Dissipation: public Dissipation
00084 {
00085 private:
00086     FieldWrapper& fw0;
00087     FieldWrapper& fw1;
00088     FieldWrapper& fw2;
00089 
00093 public:
00094     O2Dissipation(const PDE& pde, int level);
00095     ~O2Dissipation();
00096 
00107     void addDissipation(const Grid& g, const PDE* pde, int i,
00108                         tvalarray<GReal_t>& dfdt, int exclude)
00109         throw(IllegalArgumentException&);
00110 
00115     string toString() const {
00116         return "Dissipation.O2";
00117     }
00118 
00119 private:
00120     void addExtendedFields(const Grid& g, const PDE* pde, int i,
00121                            tvalarray<GReal_t>& dfdt, GReal_t eps, int exclude);
00122 };
00123 
00127 class O4Dissipation: public Dissipation
00128 {
00129 private:
00130     FieldWrapper& fw0;
00131     FieldWrapper& fw1;
00132     FieldWrapper& fw2;
00133     FieldWrapper& fw3;
00134     FieldWrapper& fw4;
00135 
00136 public:
00140     O4Dissipation(const PDE& pde, int level);
00141     ~O4Dissipation();
00142 
00153     void addDissipation(const Grid& g, const PDE* pde, int i,
00154                         tvalarray<GReal_t>& dfdt, int exclude)
00155         throw(IllegalArgumentException&);
00156 
00161     string toString() const {
00162         return "Dissipation.O4";
00163     }
00164 
00165 private:
00166     void addExtendedFields(const Grid& g, const PDE* pde, int i,
00167                            tvalarray<GReal_t>& dfdt, GReal_t eps, int exclude);
00168 };
00169 
00173 class O6Dissipation: public Dissipation
00174 {
00175 private:
00176     FieldWrapper& fw0;
00177     FieldWrapper& fw1;
00178     FieldWrapper& fw2;
00179     FieldWrapper& fw3;
00180     FieldWrapper& fw4;
00181     FieldWrapper& fw5;
00182     FieldWrapper& fw6;
00183 
00184 public:
00188     O6Dissipation(const PDE& pde, int level);
00189     ~O6Dissipation();
00190 
00202     void addDissipation(const Grid& g, const PDE* pde, int i,
00203                         tvalarray<GReal_t>& dfdt, int exclude)
00204         throw(IllegalArgumentException&);
00205 
00210     string toString() const {
00211         return "Dissipation.O6";
00212     }
00213 
00214 private:
00215     void addExtendedFields(const Grid& g, const PDE* pde, int i,
00216                            tvalarray<GReal_t>& dfdt, GReal_t eps, int exclude);
00217 };
00218 
00219 } } // namespace gridripper::amr1d
00220 
00221 #endif /* gridripper_amr1d_Dissipation_h */

Generated on Wed Jun 17 18:46:47 2009 for GridRipper by  doxygen 1.5.6