00001 #ifndef _VectorTable_H 00002 #define _VectorTable_H 00003 /********************************************************************** 00004 ** This program is part of 'MOOSE', the 00005 ** Messaging Object Oriented Simulation Environment. 00006 ** Copyright (C) 2003-2011 Upinder S. Bhalla. and NCBS 00007 ** It is made available under the terms of the 00008 ** GNU Lesser General Public License version 2.1 00009 ** See the file COPYING.LIB for the full notice. 00010 **********************************************************************/ 00011 00012 //Class : VectorTable 00013 //Author : Vishaka Datta S, 2011, NCBS 00014 //Extreme barebones implementation of a vector lookup table. 00015 //This is a minimal 1D equivalent of the Interpol2D class. Provides simple 00016 //functions for getting and setting up the table, along with a lookup function. 00017 //This class is to be used while supplying lookup tables to the MarkovChannel 00018 //class, in cases where the transition rate varies with either membrane voltage 00019 //or ligand concentration. 00020 00021 class VectorTable 00022 { 00023 public : 00024 VectorTable(); 00025 00026 double lookupByValue( double ) const; 00027 double lookupByIndex( unsigned int ) const; 00028 00029 //All members except table_ are read-only. Avoids the hassle of recomputing the table when one of the terms are changed. 00030 vector< double > getTable() const; 00031 00032 //Setting up the lookup table. 00033 void setTable( vector< double > ); 00034 00035 unsigned int getDiv() const; 00036 void setDiv( unsigned int ); 00037 double getMin() const; 00038 void setMin( double ); 00039 double getMax() const; 00040 void setMax( double ); 00041 double getInvDx() const; 00042 00043 bool tableIsEmpty() const; 00044 00045 static const Cinfo* initCinfo(); 00046 00047 friend istream& operator>>( istream&, VectorTable& ); 00048 00049 private : 00050 unsigned int xDivs_; 00051 double xMin_; 00052 double xMax_; 00053 double invDx_; 00054 00055 vector< double > table_; 00056 }; 00057 00058 #endif