FaberRudy2000Version3Optimised.hpp

Go to the documentation of this file.
00001 #ifndef _FaberRudy2000Version3Optimised
00002 #define _FaberRudy2000Version3Optimised
00003 
00015 #include <cmath>
00016 #include <cassert>
00017 #include "AbstractCardiacCell.hpp"
00018 #include "Exception.hpp"
00019 #include "AbstractStimulusFunction.hpp"
00020 #include "OdeSystemInformation.hpp"
00021 
00022 class FaberRudy2000Version3OptimisedLookupTables
00023 {
00024 public:
00025     static FaberRudy2000Version3OptimisedLookupTables* Instance()
00026     {
00027         if (mpInstance == NULL)
00028         {
00029             mpInstance = new FaberRudy2000Version3OptimisedLookupTables;
00030         }
00031         return mpInstance;
00032     }
00033 
00034     // Methods to look up values from lookup tables
00035     // using linear interpolation
00036     inline double _lookup_0(unsigned i, double factor)
00037     {
00038         double y1 = _lookup_table_0[i][0];
00039         double y2 = _lookup_table_0[i+1][0];
00040         return y1 + (y2-y1)*factor;
00041     }
00042 
00043     inline double _lookup_1(unsigned i, double factor)
00044     {
00045         double y1 = _lookup_table_0[i][1];
00046         double y2 = _lookup_table_0[i+1][1];
00047         return y1 + (y2-y1)*factor;
00048     }
00049 
00050     inline double _lookup_2(unsigned i, double factor)
00051     {
00052         double y1 = _lookup_table_0[i][2];
00053         double y2 = _lookup_table_0[i+1][2];
00054         return y1 + (y2-y1)*factor;
00055     }
00056 
00057     inline double _lookup_3(unsigned i, double factor)
00058     {
00059         double y1 = _lookup_table_0[i][3];
00060         double y2 = _lookup_table_0[i+1][3];
00061         return y1 + (y2-y1)*factor;
00062     }
00063 
00064     inline double _lookup_4(unsigned i, double factor)
00065     {
00066         double y1 = _lookup_table_0[i][4];
00067         double y2 = _lookup_table_0[i+1][4];
00068         return y1 + (y2-y1)*factor;
00069     }
00070 
00071     inline double _lookup_5(unsigned i, double factor)
00072     {
00073         double y1 = _lookup_table_0[i][5];
00074         double y2 = _lookup_table_0[i+1][5];
00075         return y1 + (y2-y1)*factor;
00076     }
00077 
00078     inline double _lookup_6(unsigned i, double factor)
00079     {
00080         double y1 = _lookup_table_0[i][6];
00081         double y2 = _lookup_table_0[i+1][6];
00082         return y1 + (y2-y1)*factor;
00083     }
00084 
00085     inline double _lookup_7(unsigned i, double factor)
00086     {
00087         double y1 = _lookup_table_0[i][7];
00088         double y2 = _lookup_table_0[i+1][7];
00089         return y1 + (y2-y1)*factor;
00090     }
00091 
00092     inline double _lookup_8(unsigned i, double factor)
00093     {
00094         double y1 = _lookup_table_0[i][8];
00095         double y2 = _lookup_table_0[i+1][8];
00096         return y1 + (y2-y1)*factor;
00097     }
00098 
00099     inline double _lookup_9(unsigned i, double factor)
00100     {
00101         double y1 = _lookup_table_0[i][9];
00102         double y2 = _lookup_table_0[i+1][9];
00103         return y1 + (y2-y1)*factor;
00104     }
00105 
00106     inline double _lookup_10(unsigned i, double factor)
00107     {
00108         double y1 = _lookup_table_0[i][10];
00109         double y2 = _lookup_table_0[i+1][10];
00110         return y1 + (y2-y1)*factor;
00111     }
00112 
00113     inline double _lookup_11(unsigned i, double factor)
00114     {
00115         double y1 = _lookup_table_0[i][11];
00116         double y2 = _lookup_table_0[i+1][11];
00117         return y1 + (y2-y1)*factor;
00118     }
00119 
00120     inline double _lookup_12(unsigned i, double factor)
00121     {
00122         double y1 = _lookup_table_0[i][12];
00123         double y2 = _lookup_table_0[i+1][12];
00124         return y1 + (y2-y1)*factor;
00125     }
00126 
00127     inline double _lookup_13(unsigned i, double factor)
00128     {
00129         double y1 = _lookup_table_0[i][13];
00130         double y2 = _lookup_table_0[i+1][13];
00131         return y1 + (y2-y1)*factor;
00132     }
00133 
00134     inline double _lookup_14(unsigned i, double factor)
00135     {
00136         double y1 = _lookup_table_0[i][14];
00137         double y2 = _lookup_table_0[i+1][14];
00138         return y1 + (y2-y1)*factor;
00139     }
00140 
00141     inline double _lookup_15(unsigned i, double factor)
00142     {
00143         double y1 = _lookup_table_0[i][15];
00144         double y2 = _lookup_table_0[i+1][15];
00145         return y1 + (y2-y1)*factor;
00146     }
00147 
00148     inline double _lookup_16(unsigned i, double factor)
00149     {
00150         double y1 = _lookup_table_0[i][16];
00151         double y2 = _lookup_table_0[i+1][16];
00152         return y1 + (y2-y1)*factor;
00153     }
00154 
00155     inline double _lookup_17(unsigned i, double factor)
00156     {
00157         double y1 = _lookup_table_0[i][17];
00158         double y2 = _lookup_table_0[i+1][17];
00159         return y1 + (y2-y1)*factor;
00160     }
00161 
00162     inline double _lookup_18(unsigned i, double factor)
00163     {
00164         double y1 = _lookup_table_0[i][18];
00165         double y2 = _lookup_table_0[i+1][18];
00166         return y1 + (y2-y1)*factor;
00167     }
00168 
00169     inline double _lookup_19(unsigned i, double factor)
00170     {
00171         double y1 = _lookup_table_0[i][19];
00172         double y2 = _lookup_table_0[i+1][19];
00173         return y1 + (y2-y1)*factor;
00174     }
00175 
00176     inline double _lookup_20(unsigned i, double factor)
00177     {
00178         double y1 = _lookup_table_0[i][20];
00179         double y2 = _lookup_table_0[i+1][20];
00180         return y1 + (y2-y1)*factor;
00181     }
00182 
00183     inline double _lookup_21(unsigned i, double factor)
00184     {
00185         double y1 = _lookup_table_0[i][21];
00186         double y2 = _lookup_table_0[i+1][21];
00187         return y1 + (y2-y1)*factor;
00188     }
00189 
00190     inline double _lookup_22(unsigned i, double factor)
00191     {
00192         double y1 = _lookup_table_0[i][22];
00193         double y2 = _lookup_table_0[i+1][22];
00194         return y1 + (y2-y1)*factor;
00195     }
00196 
00197     inline double _lookup_23(unsigned i, double factor)
00198     {
00199         double y1 = _lookup_table_0[i][23];
00200         double y2 = _lookup_table_0[i+1][23];
00201         return y1 + (y2-y1)*factor;
00202     }
00203 
00204     inline double _lookup_24(unsigned i, double factor)
00205     {
00206         double y1 = _lookup_table_0[i][24];
00207         double y2 = _lookup_table_0[i+1][24];
00208         return y1 + (y2-y1)*factor;
00209     }
00210 
00211     inline double _lookup_25(unsigned i, double factor)
00212     {
00213         double y1 = _lookup_table_0[i][25];
00214         double y2 = _lookup_table_0[i+1][25];
00215         return y1 + (y2-y1)*factor;
00216     }
00217 
00218     inline double _lookup_26(unsigned i, double factor)
00219     {
00220         double y1 = _lookup_table_0[i][26];
00221         double y2 = _lookup_table_0[i+1][26];
00222         return y1 + (y2-y1)*factor;
00223     }
00224 
00225     inline double _lookup_27(unsigned i, double factor)
00226     {
00227         double y1 = _lookup_table_0[i][27];
00228         double y2 = _lookup_table_0[i+1][27];
00229         return y1 + (y2-y1)*factor;
00230     }
00231 
00232     inline double _lookup_28(unsigned i, double factor)
00233     {
00234         double y1 = _lookup_table_0[i][28];
00235         double y2 = _lookup_table_0[i+1][28];
00236         return y1 + (y2-y1)*factor;
00237     }
00238 
00239     inline double _lookup_29(unsigned i, double factor)
00240     {
00241         double y1 = _lookup_table_0[i][29];
00242         double y2 = _lookup_table_0[i+1][29];
00243         return y1 + (y2-y1)*factor;
00244     }
00245 
00246     inline double _lookup_30(unsigned i, double factor)
00247     {
00248         double y1 = _lookup_table_0[i][30];
00249         double y2 = _lookup_table_0[i+1][30];
00250         return y1 + (y2-y1)*factor;
00251     }
00252 
00253     inline double _lookup_31(unsigned i, double factor)
00254     {
00255         double y1 = _lookup_table_0[i][31];
00256         double y2 = _lookup_table_0[i+1][31];
00257         return y1 + (y2-y1)*factor;
00258     }
00259 
00260     inline double _lookup_32(unsigned i, double factor)
00261     {
00262         double y1 = _lookup_table_0[i][32];
00263         double y2 = _lookup_table_0[i+1][32];
00264         return y1 + (y2-y1)*factor;
00265     }
00266 
00267     inline double _lookup_33(unsigned i, double factor)
00268     {
00269         double y1 = _lookup_table_0[i][33];
00270         double y2 = _lookup_table_0[i+1][33];
00271         return y1 + (y2-y1)*factor;
00272     }
00273 
00274     inline double _lookup_34(unsigned i, double factor)
00275     {
00276         double y1 = _lookup_table_0[i][34];
00277         double y2 = _lookup_table_0[i+1][34];
00278         return y1 + (y2-y1)*factor;
00279     }
00280 
00281     inline double _lookup_35(unsigned i, double factor)
00282     {
00283         double y1 = _lookup_table_0[i][35];
00284         double y2 = _lookup_table_0[i+1][35];
00285         return y1 + (y2-y1)*factor;
00286     }
00287 
00288     inline double _lookup_36(unsigned i, double factor)
00289     {
00290         double y1 = _lookup_table_0[i][36];
00291         double y2 = _lookup_table_0[i+1][36];
00292         return y1 + (y2-y1)*factor;
00293     }
00294 
00295     inline double _lookup_37(unsigned i, double factor)
00296     {
00297         double y1 = _lookup_table_0[i][37];
00298         double y2 = _lookup_table_0[i+1][37];
00299         return y1 + (y2-y1)*factor;
00300     }
00301 
00302     inline double _lookup_38(unsigned i, double factor)
00303     {
00304         double y1 = _lookup_table_0[i][38];
00305         double y2 = _lookup_table_0[i+1][38];
00306         return y1 + (y2-y1)*factor;
00307     }
00308 
00309 
00310 protected:
00311     FaberRudy2000Version3OptimisedLookupTables(const FaberRudy2000Version3OptimisedLookupTables&);
00312     FaberRudy2000Version3OptimisedLookupTables& operator= (const FaberRudy2000Version3OptimisedLookupTables&);
00313     FaberRudy2000Version3OptimisedLookupTables();
00314 private:
00316     static FaberRudy2000Version3OptimisedLookupTables *mpInstance;
00317     // Lookup tables
00318     double _lookup_table_0[20001][39];
00319 
00320 };
00321 
00322 class FaberRudy2000Version3Optimised : public AbstractCardiacCell
00323 {
00324 public:
00325     FaberRudy2000Version3Optimised(boost::shared_ptr<AbstractIvpOdeSolver> pSolver,
00326                                    boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
00327 
00328     ~FaberRudy2000Version3Optimised(void);
00329 
00330     // Lookup table indices
00331     unsigned _table_index_0;
00332     double _factor_0;
00333 
00334     double GetIIonic();
00335 
00336     void EvaluateYDerivatives (
00337             double var_environment__time,
00338             const std::vector<double> &rY,
00339             std::vector<double> &rDY);
00340 
00341 };
00342 
00343 #endif

Generated by  doxygen 1.6.2