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 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029
00030 #include <sstream>
00031
00032 #include "utils/eoGnuplot1DMonitor.h"
00033 #include "utils/eoParam.h"
00034
00035
00036 eoMonitor& eoGnuplot1DMonitor::operator() (void)
00037 {
00038
00039 eoFileMonitor::operator()();
00040 #ifdef HAVE_GNUPLOT
00041
00042
00043 if (firstTime)
00044 {
00045 FirstPlot();
00046 firstTime = false;
00047 }
00048 else
00049 {
00050 if( gpCom ) {
00051 PipeComSend( gpCom, "replot\n" );
00052 }
00053 }
00054 #endif
00055 return *this;
00056 }
00057
00058
00059
00060 void eoGnuplot1DMonitor::FirstPlot()
00061 {
00062 if (this->vec.size() < 2)
00063 {
00064 throw std::runtime_error("Must have some stats to plot!\n");
00065 }
00066 #ifdef HAVE_GNUPLOT
00067 std::ostringstream os;
00068 os << "plot";
00069 for (unsigned i=1; i<this->vec.size(); i++) {
00070 os << " '" << getFileName().c_str() <<
00071 "' using 1:" << i+1 << " title '" << (this->vec[i])->longName() << "' with lines" ;
00072 if (i<this->vec.size()-1)
00073 os << ", ";
00074 }
00075 os << '\n';
00076 PipeComSend( gpCom, os.str().c_str());
00077 #endif
00078 }
00079
00080
00081
00082
00083
00084
00085