MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Interpol Class Reference

#include <Interpol.h>

+ Inheritance diagram for Interpol:
+ Collaboration diagram for Interpol:

Public Member Functions

double getXmax () const
 
double getXmin () const
 
double getY () const
 
void handleInput (double x)
 
 Interpol ()
 
 Interpol (double xmin, double xmax)
 
void process (const Eref &e, ProcPtr p)
 
void reinit (const Eref &e, ProcPtr p)
 
void setXmax (double value)
 
void setXmin (double value)
 
- Public Member Functions inherited from TableBase
void clearVec ()
 
void compareVec (vector< double > other, string op)
 
void compareXplot (string fname, string plotname, string op)
 
const vector< double > & data ()
 
double getOutputValue () const
 
string getPlotDump () const
 
vector< double > getVec () const
 
unsigned int getVecSize () const
 
double getY (unsigned int index) const
 
double interpolate (double x, double xmin, double xmax) const
 
void linearTransform (double scale, double offset)
 
void loadCSV (string fname, int startLine, int colNum, char separator)
 
void loadXplot (string fname, string plotname)
 
void loadXplotRange (string fname, string plotname, unsigned int start, unsigned int end)
 
double * lookupVec (unsigned int index)
 
void plainPlot (string file)
 
void setOutputValue (double val)
 
void setPlotDump (string v)
 
void setVec (vector< double > val)
 
void setVecSize (unsigned int num)
 
 TableBase ()
 
void xplot (string file, string plotname)
 

Static Public Member Functions

static const CinfoinitCinfo ()
 
- Static Public Member Functions inherited from TableBase
static const CinfoinitCinfo ()
 

Static Public Attributes

static const unsigned int MAX_DIVS
 

Protected Attributes

double x_
 
double xmax_
 
double xmin_
 
double y_
 

Additional Inherited Members

- Protected Member Functions inherited from TableBase
vector< double > & vec ()
 

Detailed Description

1 Dimensional table, with interpolation. The internal vector is accessed like this: table_[ xIndex ] with the x-coordinate used as the index.

Definition at line 56 of file Interpol.h.

Constructor & Destructor Documentation

Interpol::Interpol ( )

Definition at line 148 of file Interpol.cpp.

148  : xmin_(0.0), xmax_(1.0)
149 {
150 }
double xmin_
Definition: Interpol.h:82
double xmax_
Definition: Interpol.h:83
Interpol::Interpol ( double  xmin,
double  xmax 
)

Definition at line 152 of file Interpol.cpp.

153  : xmin_(xmin),
154  xmax_(xmax)
155 {}
double xmin_
Definition: Interpol.h:82
double xmax_
Definition: Interpol.h:83

Member Function Documentation

double Interpol::getXmax ( ) const

Definition at line 180 of file Interpol.cpp.

References xmax_.

Referenced by initCinfo().

181 {
182  return xmax_;
183 }
double xmax_
Definition: Interpol.h:83

+ Here is the caller graph for this function:

double Interpol::getXmin ( ) const

Definition at line 166 of file Interpol.cpp.

References xmin_.

Referenced by initCinfo().

167 {
168  return xmin_;
169 }
double xmin_
Definition: Interpol.h:82

+ Here is the caller graph for this function:

double Interpol::getY ( ) const

Definition at line 185 of file Interpol.cpp.

References y_.

Referenced by initCinfo().

186 {
187  return y_;
188 }
double y_
Definition: Interpol.h:84

+ Here is the caller graph for this function:

void Interpol::handleInput ( double  x)

Definition at line 209 of file Interpol.cpp.

References x_.

Referenced by initCinfo().

210 {
211  x_ = v;
212 }
double x_
Definition: Interpol.h:81

+ Here is the caller graph for this function:

const Cinfo * Interpol::initCinfo ( )
static

Definition at line 61 of file Interpol.cpp.

References getXmax(), getXmin(), getY(), handleInput(), TableBase::initCinfo(), interpolCinfo, lookupOut(), process(), reinit(), setXmax(), and setXmin().

62 {
64  // Field Definitions
67  "xmin",
68  "Minimum value of x. x below this will result in y[0] being returned.",
71  );
73  "xmax",
74  "Maximum value of x. x above this will result in y[last] being"
75  " returned.",
78 
80  "y",
81  "Looked up value.",
84  // MsgDest Definitions
86 
87  static DestFinfo input( "input",
88  "Interpolates using the input as x value.",
90 
91  static DestFinfo process( "process",
92  "Handles process call, updates internal time stamp.",
94  static DestFinfo reinit( "reinit",
95  "Handles reinit call.",
98  // SharedMsg Definitions
100  static Finfo* procShared[] = {
101  &process, &reinit
102  };
103  static SharedFinfo proc( "proc",
104  "Shared message for process and reinit",
105  procShared, sizeof( procShared ) / sizeof( const Finfo* )
106  );
107 
109  // Field Element for the vector data
110  // Use a limit of 2^20 entries for the tables, about 1 million.
112 
113  static Finfo* interpolFinfos[] = {
114  &xmin, // Value
115  &xmax, // Value
116  &y,
117  // &xdivs, // Value
118  lookupOut(),
119  &input, // DestFinfo
120  &proc, // SharedFinfo
121  };
122 
123  static string doc[] =
124  {
125  "Name", "Interpol",
126  "Author", "Upinder Bhalla, Subhasis Ray, 2014, NCBS",
127  "Description", "Interpol: Interpolation class. "
128  "Handles lookup from a 1-dimensional array of real-numbered values."
129  "Returns 'y' value based on given 'x' value. "
130  "Can either use interpolation or roundoff to the nearest index.",
131  };
132 
133  static Dinfo< Interpol > dinfo;
134  static Cinfo interpolCinfo (
135  "Interpol",
137  interpolFinfos,
138  sizeof( interpolFinfos ) / sizeof ( Finfo* ),
139  &dinfo,
140  doc,
141  sizeof(doc) / sizeof(string));
142 
143  return &interpolCinfo;
144 }
static const Cinfo * interpolCinfo
Definition: Interpol.cpp:146
void setXmin(double value)
Definition: Interpol.cpp:157
Definition: Dinfo.h:60
void handleInput(double x)
Definition: Interpol.cpp:209
void process(const Eref &e, ProcPtr p)
Definition: Interpol.cpp:194
static SrcFinfo1< double > * lookupOut()
Definition: Interpol.cpp:54
void reinit(const Eref &e, ProcPtr p)
Definition: Interpol.cpp:200
static const Cinfo * initCinfo()
Definition: TableBase.cpp:15
Definition: OpFunc.h:27
void setXmax(double value)
Definition: Interpol.cpp:171
double getXmin() const
Definition: Interpol.cpp:166
double getY() const
Definition: Interpol.cpp:185
Definition: Cinfo.h:18
double getXmax() const
Definition: Interpol.cpp:180
Definition: Finfo.h:12

+ Here is the call graph for this function:

void Interpol::process ( const Eref e,
ProcPtr  p 
)

Definition at line 194 of file Interpol.cpp.

References TableBase::interpolate(), lookupOut(), x_, xmax_, xmin_, and y_.

Referenced by initCinfo().

195 {
196  y_ = interpolate(xmin_, xmax_, x_);
197  lookupOut()->send( e, y_ );
198 }
double xmin_
Definition: Interpol.h:82
double interpolate(double x, double xmin, double xmax) const
Definition: TableBase.cpp:440
static SrcFinfo1< double > * lookupOut()
Definition: Interpol.cpp:54
double xmax_
Definition: Interpol.h:83
double x_
Definition: Interpol.h:81
double y_
Definition: Interpol.h:84

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Interpol::reinit ( const Eref e,
ProcPtr  p 
)

Definition at line 200 of file Interpol.cpp.

References x_.

Referenced by initCinfo().

201 {
202  x_ = 0.0;
203 }
double x_
Definition: Interpol.h:81

+ Here is the caller graph for this function:

void Interpol::setXmax ( double  value)

Definition at line 171 of file Interpol.cpp.

References almostEqual(), value, xmax_, and xmin_.

Referenced by initCinfo().

172 {
173  if (almostEqual(value, xmin_)){
174  cerr << "Error: Interpol::setXmax: Xmin ~= Xmax : Assignment failed\n";
175  return;
176  }
177  xmax_ = value;
178 }
uint32_t value
Definition: moosemodule.h:42
bool almostEqual(float x, float y, float epsilon)
Definition: numutil.cpp:27
double xmin_
Definition: Interpol.h:82
double xmax_
Definition: Interpol.h:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Interpol::setXmin ( double  value)

Definition at line 157 of file Interpol.cpp.

References almostEqual(), value, xmax_, and xmin_.

Referenced by initCinfo().

158 {
159  if (almostEqual(value, xmax_)){
160  cerr << "Error: Interpol::setXmin: Xmin ~= Xmax : Assignment failed\n";
161  return;
162  }
163  xmin_ = value;
164 }
uint32_t value
Definition: moosemodule.h:42
bool almostEqual(float x, float y, float epsilon)
Definition: numutil.cpp:27
double xmin_
Definition: Interpol.h:82
double xmax_
Definition: Interpol.h:83

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

const unsigned int Interpol::MAX_DIVS
static

Definition at line 79 of file Interpol.h.

double Interpol::x_
protected

Definition at line 81 of file Interpol.h.

Referenced by handleInput(), process(), and reinit().

double Interpol::xmax_
protected

Definition at line 83 of file Interpol.h.

Referenced by getXmax(), process(), setXmax(), and setXmin().

double Interpol::xmin_
protected

Definition at line 82 of file Interpol.h.

Referenced by getXmin(), process(), setXmax(), and setXmin().

double Interpol::y_
protected

Definition at line 84 of file Interpol.h.

Referenced by getY(), and process().


The documentation for this class was generated from the following files: