MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Table.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-2010 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 _TABLE_H
11 #define _TABLE_H
12 
13 #include <fstream>
14 
18 class Table: public TableBase
19 {
20 public:
21  Table();
22  ~Table();
23 
24  Table& operator= ( const Table& tab );
25 
27  // Field assignment stuff
29 
30  void setThreshold ( double v );
31  double getThreshold() const;
32 
33  void setFormat ( const string format );
34  string getFormat( ) const;
35 
36  void setColumnName( const string colname );
37  string getColumnName( ) const;
38 
39  void setUseStreamer ( bool status );
40  bool getUseStreamer ( void ) const;
41 
42  void setUseSpikeMode ( bool status );
43  bool getUseSpikeMode ( void ) const;
44 
45  void setOutfile ( string outfilepath );
46  string getOutfile ( void ) const;
47 
48  // Access the dt_ of table.
49  double getDt ( void ) const;
50 
51  void zipWithTime (
52  const vector<double>& yvec
53  , vector<double>& tvec
54  , const double& lasttime
55  );
56 
58  // Dest funcs
60 
61  void process ( const Eref& e, ProcPtr p );
62  void reinit ( const Eref& e, ProcPtr p );
63 
64  void input ( double v );
65  void spike ( double v );
66 
68  // Lookup funcs for table
70 
71  static const Cinfo* initCinfo();
72 
73 private:
74  double threshold_;
75  double lastTime_;
76  double input_;
77  bool fired_;
79 
84  vector<double> data_;
85  vector<string> columns_; /* Store the name of tables */
86 
87  string tablePath_;
88 
89 
94 
101 
105  string rootdir_;
106 
107  // On Table, set outfile to change this variable. By default it sets to,
108  // `pwd1/_tables_/table.path().
109  string outfile_;
110 
115 
119  string format_;
120 
124  string text_;
125 
129  double dt_;
130 
134  std::ofstream of_;
135 
136 };
137 
138 #endif // _TABLE_H
bool getUseStreamer(void) const
Definition: Table.cpp:405
Table()
Definition: Table.cpp:213
double input_
Definition: Table.h:76
void setUseStreamer(bool status)
Definition: Table.cpp:400
string text_
text_ to write.
Definition: Table.h:124
double lastTime_
Definition: Table.h:75
void reinit(const Eref &e, ProcPtr p)
Reinitialize.
Definition: Table.cpp:287
string format_
format of data. Default to csv.
Definition: Table.h:119
bool outfileIsSet_
Wheather or not outfile path is set by user.
Definition: Table.h:114
static const Cinfo * initCinfo()
Definition: Table.cpp:42
double getDt(void) const
Definition: Table.cpp:444
std::ofstream of_
Output stream.
Definition: Table.h:134
void setOutfile(string outfilepath)
Definition: Table.cpp:423
string getFormat() const
Definition: Table.cpp:383
string outfile_
Definition: Table.h:109
string tableColumnName_
Column name of this table. Use it when writing data to a datafile.
Definition: Table.h:93
bool fired_
Definition: Table.h:77
void zipWithTime(const vector< double > &yvec, vector< double > &tvec, const double &lasttime)
Take the vector from table and timestamp it. It must only be called when packing the data for writing...
Definition: Table.cpp:453
double dt_
dt of its clock. Needed for creating time co-ordinates,
Definition: Table.h:129
~Table()
Definition: Table.cpp:228
void process(const Eref &e, ProcPtr p)
Definition: Table.cpp:250
void setColumnName(const string colname)
Definition: Table.cpp:394
void setThreshold(double v)
Definition: Table.cpp:360
Definition: Eref.h:26
string rootdir_
Table directory into which dump the stream data.
Definition: Table.h:105
string getColumnName() const
Definition: Table.cpp:389
bool useSpikeMode_
Definition: Table.h:78
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100
double threshold_
Definition: Table.h:74
double getThreshold() const
Definition: Table.cpp:365
string tablePath_
Definition: Table.h:87
vector< string > columns_
Definition: Table.h:85
string getOutfile(void) const
Definition: Table.cpp:438
bool getUseSpikeMode(void) const
Definition: Table.cpp:416
Definition: Table.h:18
vector< double > data_
Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc. ...
Definition: Table.h:84
Table & operator=(const Table &tab)
Definition: Table.cpp:240
void setUseSpikeMode(bool status)
Definition: Table.cpp:411
void spike(double v)
Definition: Table.cpp:343
void input(double v)
Definition: Table.cpp:338
Definition: Cinfo.h:18
void setFormat(const string format)
Definition: Table.cpp:371