MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Interpol2D.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2011 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _Interpol2D_h
11 #define _Interpol2D_h
12 
19 {
20  public:
21  Interpol2D();
22  Interpol2D(
23  unsigned int xdivs, double xmin, double xmax,
24  unsigned int ydivs, double ymin, double ymax );
25 
27  // Here are the interface functions for the MOOSE class
29  void setXmin( double value );
30  double getXmin() const;
31  void setXmax( double value );
32  double getXmax() const;
33  void setXdivs( unsigned int value );
34  unsigned int getXdivs() const;
35  void setDx( double value );
36  double getDx() const;
37 
38  void setYmin( double value );
39  double getYmin() const;
40  void setYmax( double value );
41  double getYmax() const;
42  void setYdivs( unsigned int value );
43  unsigned int getYdivs() const;
44  void setDy( double value );
45  double getDy() const;
46 
47  void setSy( double value );
48  double getSy() const;
49 
50  double getInterpolatedValue(vector<double> xy) const;
51 
53  // Here are the Interpol2D Destination functions
55 
59  void lookupReturn( const Eref& e, double v1, double v2 );
60  void lookup( double v1, double v2 );
61 
62  void appendTableVector( vector< vector< double > > value );
63 
65  // Here are the internal functions
67  double interpolate( double x, double y ) const;
68  double indexWithoutCheck( double x, double y ) const;
69  double innerLookup( double x, double y ) const;
70  bool operator==( const Interpol2D& other ) const;
71  bool operator<( const Interpol2D& other ) const;
72 
73  //Overloading the >> operator to allow use in OpFunc.
74  friend istream& operator>>( istream&, Interpol2D& );
75 
76  double invDy() const {
77  return invDy_;
78  }
79 
80  void setTableValue( vector< unsigned int > index, double value );
81  double getTableValue( vector< unsigned int > index ) const;
82 
83  void setTableVector( vector< vector< double > > value );
84  vector< vector < double > > getTableVector() const;
85  void appendTableVector(
86  const vector< vector< double > >& value );
87 
92  void resize( unsigned int xsize, unsigned int ysize, double init = 0.0 );
93 
94  unsigned int xdivs() const;
95  unsigned int ydivs() const;
96 
97  void print( const string& fname, bool doAppend ) const;
98  void load( const string& fname, unsigned int skiplines );
99 
100  static const Cinfo* initCinfo();
101  static const unsigned int MAX_DIVS;
102  private:
103  double xmin_;
104  double xmax_;
105  double invDx_;
106  double ymin_;
107  double ymax_;
108  double invDy_;
109  double sy_;
110  vector< vector< double > > table_;
111 };
112 
113 
114 #endif // _Interpol2D_h
void lookupReturn(const Eref &e, double v1, double v2)
Definition: Interpol2D.cpp:478
Id init(int argc, char **argv, bool &doUnitTests, bool &doRegressionTests, unsigned int &benchmark)
Definition: main.cpp:150
bool operator<(const Interpol2D &other) const
Definition: Interpol2D.cpp:604
uint32_t value
Definition: moosemodule.h:42
double getTableValue(vector< unsigned int > index) const
Definition: Interpol2D.cpp:402
void lookup(double v1, double v2)
void load(const string &fname, unsigned int skiplines)
Definition: Interpol2D.cpp:699
void setXmin(double value)
Definition: Interpol2D.cpp:229
double xmax_
Definition: Interpol2D.h:104
void setYdivs(unsigned int value)
Definition: Interpol2D.cpp:321
double ymax_
Definition: Interpol2D.h:107
double ymin_
Definition: Interpol2D.h:106
double invDy_
Definition: Interpol2D.h:108
double getXmin() const
Definition: Interpol2D.cpp:238
vector< vector< double > > getTableVector() const
Definition: Interpol2D.cpp:379
void setXdivs(unsigned int value)
Definition: Interpol2D.cpp:257
void setSy(double value)
Definition: Interpol2D.cpp:364
unsigned int getXdivs() const
Definition: Interpol2D.cpp:262
void resize(unsigned int xsize, unsigned int ysize, double init=0.0)
Definition: Interpol2D.cpp:200
double indexWithoutCheck(double x, double y) const
Definition: Interpol2D.cpp:489
friend istream & operator>>(istream &, Interpol2D &)
double getSy() const
Definition: Interpol2D.cpp:359
double getInterpolatedValue(vector< double > xy) const
Definition: Interpol2D.cpp:443
double getYmin() const
Definition: Interpol2D.cpp:302
unsigned int xdivs() const
Definition: Interpol2D.cpp:427
unsigned int ydivs() const
Definition: Interpol2D.cpp:434
void setTableVector(vector< vector< double > > value)
Definition: Interpol2D.cpp:420
double getYmax() const
Definition: Interpol2D.cpp:316
unsigned int getYdivs() const
Definition: Interpol2D.cpp:325
void setYmax(double value)
Definition: Interpol2D.cpp:307
void setTableValue(vector< unsigned int > index, double value)
Definition: Interpol2D.cpp:384
Definition: Eref.h:26
double innerLookup(double x, double y) const
Definition: Interpol2D.cpp:574
void appendTableVector(vector< vector< double > > value)
vector< vector< double > > table_
Definition: Interpol2D.h:110
void print(const string &fname, bool doAppend) const
Definition: Interpol2D.cpp:680
static const Cinfo * initCinfo()
Definition: Interpol2D.cpp:25
bool operator==(const Interpol2D &other) const
Definition: Interpol2D.cpp:594
double xmin_
Definition: Interpol2D.h:103
void setDy(double value)
Definition: Interpol2D.cpp:336
void setDx(double value)
Definition: Interpol2D.cpp:268
double interpolate(double x, double y) const
Definition: Interpol2D.cpp:508
double getDy() const
Definition: Interpol2D.cpp:352
static const unsigned int MAX_DIVS
Definition: Interpol2D.h:101
double invDy() const
Definition: Interpol2D.h:76
double sy_
Definition: Interpol2D.h:109
void setYmin(double value)
Definition: Interpol2D.cpp:293
double getDx() const
Definition: Interpol2D.cpp:282
double getXmax() const
Definition: Interpol2D.cpp:252
Definition: Cinfo.h:18
void setXmax(double value)
Definition: Interpol2D.cpp:243
double invDx_
Definition: Interpol2D.h:105