00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef EO_eoGnuplot1DSnapshot_H
00029 #define EO_eoGnuplot1DSnapshot_H
00030
00031 #include <fstream>
00032 #include <sstream>
00033 #include <string>
00034
00035 #include <eoObject.h>
00036 #include "eoRealVectorBounds.h"
00037 #include <utils/pipecom.h>
00038 #include <utils/eoFileSnapshot.h>
00039 #include <utils/eoGnuplot.h>
00040
00051 class eoGnuplot1DSnapshot: public eoFileSnapshot, public eoGnuplot
00052 {
00053 public:
00054
00055 eoGnuplot1DSnapshot(std::string _dirname, unsigned _frequency = 1,
00056 std::string _filename = "gen", std::string _delim = " ",
00057 unsigned _counter = 0, bool _rmFiles = true) :
00058 eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
00059 eoGnuplot(_filename,"set data style points"),
00060 pointSize(5)
00061 {}
00062
00063
00064 eoGnuplot1DSnapshot(std::string _dirname, eoRealVectorBounds & _bounds,
00065 unsigned _frequency = 1, std::string _filename = "gen",
00066 std::string _delim = " ", unsigned _counter = 0, bool _rmFiles = true ) :
00067 eoFileSnapshot(_dirname, _frequency, _filename, _delim, _counter, _rmFiles),
00068 eoGnuplot(_filename,"set data style points"),
00069 pointSize(5)
00070 {
00071 handleBounds(_bounds);
00072 }
00073
00074 eoGnuplot1DSnapshot(eoFileSnapshot & _fSnapshot) :
00075 eoFileSnapshot(_fSnapshot),
00076 eoGnuplot(_fSnapshot.baseFileName(),"set data style points"),
00077 pointSize(5)
00078 {}
00079
00080
00081 eoGnuplot1DSnapshot(eoFileSnapshot & _fSnapshot, eoRealVectorBounds & _bounds) :
00082 eoFileSnapshot(_fSnapshot),
00083 eoGnuplot(_fSnapshot.baseFileName(),"set data style points"),
00084 pointSize(5)
00085 {
00086 handleBounds(_bounds);
00087 }
00088
00089
00090 virtual ~eoGnuplot1DSnapshot(){}
00091
00092 virtual eoMonitor& operator()();
00093
00095 virtual std::string className() const { return "eoGnuplot1DSnapshot"; }
00096
00097 virtual void handleBounds(eoRealVectorBounds & _bounds)
00098 {
00099 std::ostringstream os;
00100 os << "set autoscale\nset yrange [" ;
00101 if (_bounds.isMinBounded(0))
00102 os << _bounds.minimum(0);
00103 os << ":" ;
00104 if (_bounds.isMaxBounded(0))
00105 os << _bounds.maximum(0);
00106 os << "]\n";
00107 gnuplotCommand(os.str());
00108 }
00109
00110 void setPointSize(unsigned _pointSize)
00111 { pointSize = _pointSize; }
00112
00113 protected:
00114
00115 unsigned pointSize;
00116 };
00117
00118
00119 #endif