MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Streamer.h
Go to the documentation of this file.
1 /***
2  * Filename: Streamer.h
3  *
4  * Description: Stream table data to a stream.
5  *
6  * Version: 0.0.1
7  * Created: 2016-04-26
8 
9  * Revision: none
10  *
11  * Author: Dilawar Singh <dilawars@ncbs.res.in>
12  * Organization: NCBS Bangalore
13  *
14  * License: GNU GPL2
15  */
16 
17 #ifndef Streamer_INC
18 #define Streamer_INC
19 
20 #define STRINGSTREAM_DOUBLE_PRECISION 10
21 
22 #include <iostream>
23 #include <string>
24 #include <map>
25 #include <fstream>
26 #include <sstream>
27 
28 #include "StreamerBase.h"
29 #include "Table.h"
30 
31 using namespace std;
32 
33 class Streamer : public StreamerBase
34 {
35 
36 public:
37  Streamer();
38  ~Streamer();
39 
40  Streamer& operator=( const Streamer& st );
41 
42  /* Cleaup before quitting */
43  void cleanUp( void );
44 
45  string getOutFilepath( void ) const;
46  void setOutFilepath( string path );
47 
48  string getFormat( void ) const;
49  void setFormat( string format );
50 
51  size_t getNumTables( void ) const;
52 
53  void addTable( Id table );
54  void addTables( vector<Id> tables);
55 
56  void removeTable( Id table );
57  void removeTables( vector<Id> table );
58 
59  void zipWithTime( );
60 
64  void process(const Eref& e, ProcPtr p);
65 
69  void reinit(const Eref& e, ProcPtr p);
70 
71  static const Cinfo * initCinfo();
72 
73 private:
74 
75  string outfilePath_;
76  string format_;
78 
79  // dt_ and tick number of Table's clock
80  vector<double> tableDt_;
81  vector<unsigned int> tableTick_;
82 
83  // This currTime is not computed using the ProcPtr but rather using Tables
84  // dt_ and number of entries written.
85  double currTime_;
86 
87  // Used for adding or removing tables
88  vector<Id> tableIds_;
89  vector<Table*> tables_;
90  vector<string> columns_;
91 
92  /* Keep data in vector */
93  vector<double> data_;
94 
95 };
96 
97 #endif /* ----- #ifndef Streamer_INC ----- */
string format_
Definition: Streamer.h:76
vector< Id > tableIds_
Definition: Streamer.h:88
vector< Table * > tables_
Definition: Streamer.h:89
vector< double > tableDt_
Definition: Streamer.h:80
vector< double > data_
Definition: Streamer.h:93
vector< string > columns_
Definition: Streamer.h:90
string outfilePath_
Definition: Streamer.h:75
double currTime_
Definition: Streamer.h:85
Definition: Eref.h:26
vector< unsigned int > tableTick_
Definition: Streamer.h:81
bool isOutfilePathSet_
Definition: Streamer.h:77
Definition: Id.h:17
Definition: Cinfo.h:18
static char path[]
Definition: mfield.cpp:403