From befe8fe69ed13b5af4f1d51586f0f15dbd1a550d Mon Sep 17 00:00:00 2001 From: Daniel Lins de Albuquerque Date: Mon, 17 Oct 2016 13:14:15 -0200 Subject: [PATCH] To fix inline command. --- Profile.h | 1 + Projection.cc | 41 ------------------------------------ Projection.h | 1 - command/PlotInlineCommand.cc | 9 ++++++-- in/inline_example.dat | 35 ++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 44 deletions(-) create mode 100644 in/inline_example.dat diff --git a/Profile.h b/Profile.h index 4683956..a6f92e1 100644 --- a/Profile.h +++ b/Profile.h @@ -25,6 +25,7 @@ private: vector colors_; vector stepTime_; vector > > data_; // first dim = step; second dim = point; third dim = coordinate ( or component ) + vector data_str_; // dim = step; one string with all data from a step //------------------------------------------- vector inputComps_;// component names read from input file diff --git a/Projection.cc b/Projection.cc index 4e756f0..d7c4607 100644 --- a/Projection.cc +++ b/Projection.cc @@ -5,7 +5,6 @@ Projection :: Projection(int ID, string argvComp, argvOpt geometry, const vector &inputComps, vector > > * data) : -//Projection :: Projection(int ID, string argvComp, argvOpt geometry, const vector &inputComps) : ID_(ID), argvComp_(argvComp), geometry_(geometry), @@ -28,26 +27,6 @@ Projection :: Projection(int ID, string argvComp, argvOpt geometry, const vector gplt = new Gnuplot("lines"); gplt->reset_plot(); gplt->cmd("set term %s noraise title 'Projection %d'", terminal_.c_str(), ID); - - -/* DEBUG - cout.precision(6); - cout << scientific; - cout << "SIZE: " << data_->size() << endl; - cout << "SIZE: " << data_[i].size() << endl; - cout << "SIZE: " << data_[i][j].size() << endl; - cout << "SIZE: " << data_[i][j][k].size() << endl; - - for (auto i = 0; i < data_.size(); i++) { - for (auto j = 0; j < data_[i].size(); j++) { - for (auto k = 0; k < data_[i][j].size(); k++) { - cout << data_[i][j][k] << " "; - } - cout << endl; - } - cout << endl; - } -*/ } @@ -164,7 +143,6 @@ void Projection :: extractArgv() string argvLabel_ = argvComp_; string argvRange_ = argvComp_; - // replacePattern() from util.cc replacePattern(inputComps_, argvComp_); calcRange(argvRange_); @@ -235,25 +213,6 @@ void Projection :: calcRange(string argvRange_) } -/* - // Substitute for min values - for (int i=0; i < inputComps_.size(); i++) - { - nstr << inputComps_[i]->min(); - replaceAll (minRange_, inputComps_[i]->name(), nstr.str()); - nstr.str(string()); - } - - // Substitute for max values - for (int i=0; i < inputComps_.size(); i++) - { - nstr << inputComps_[i]->max(); - replaceAll (maxRange_, inputComps_[i]->name(), nstr.str()); - nstr.str(string()); - } - -*/ - // Strip component names to min Range vector min; stringstream s1 (minRange_); diff --git a/Projection.h b/Projection.h index 4a300b0..8c54a5f 100644 --- a/Projection.h +++ b/Projection.h @@ -36,7 +36,6 @@ private: void calcRange(string); void replaceAll(string& str, const string& from, const string& to); public: - //Projection(int, string, argvOpt, const vector &); Projection(int, string, argvOpt, const vector &, vector > > *); int ID(void); diff --git a/command/PlotInlineCommand.cc b/command/PlotInlineCommand.cc index 230dcce..1d5b4ba 100644 --- a/command/PlotInlineCommand.cc +++ b/command/PlotInlineCommand.cc @@ -33,7 +33,8 @@ string PlotInlineCommand :: execute(Projection *projection, Profile *profile, in compName = projection->compToLabel(1); command = "plot '-' "; - command += " using ($1):($2)"; + //command += " using ($1):($2)"; + command += " using (" + projection->compToProj(0) + "):(" + projection->compToProj(1) + ")"; command += " " + withTitle + "title '" + compName + "' w l ls 1"; for (int j = 2; j < projection->nComps(); j++) @@ -41,11 +42,14 @@ string PlotInlineCommand :: execute(Projection *projection, Profile *profile, in lineStyle << j; compName = projection->compToLabel(j); command += ", '-' "; - command += " using ($1):($2)"; + //command += " using ($1):($2)"; + command += " using (" + projection->compToProj(0) + "):(" + projection->compToProj(j) + ")"; command += " " + withTitle + "title '" + compName + "' w l ls " + lineStyle.str(); lineStyle.str(string()); } + if ( profile->verbose() ) cout << "Command: " << command << endl; + command += "\n"; for (auto j = 0; j < projection->data_->at(index_).size(); j++) { stringstream xx, yy; @@ -55,6 +59,7 @@ string PlotInlineCommand :: execute(Projection *projection, Profile *profile, in } command += "e\n"; + for (int k = 2; k < projection->nComps(); k++) { for (auto j = 0; j < projection->data_->at(index_).size(); j++) { diff --git a/in/inline_example.dat b/in/inline_example.dat new file mode 100644 index 0000000..73325bb --- /dev/null +++ b/in/inline_example.dat @@ -0,0 +1,35 @@ +plot '-' using ($1):($2) title 'u' w l ls 1, '-' using ($1):($3) title 'v' w l ls 2, '-' using ($1):($2+$3) title 'u+v' w l ls 3 +-1.000000e+01 1.500000e+00 1.500000e+00 1.800000e+00 +-9.980000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.960000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.940000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.920000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.900000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.880000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.860000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.840000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.820000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +e +-1.000000e+01 1.500000e+00 1.500000e+00 1.800000e+00 +-9.980000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.960000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.940000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.920000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.900000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.880000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.860000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.840000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.820000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +e +-1.000000e+01 1.500000e+00 1.500000e+00 1.800000e+00 +-9.980000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.960000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.940000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.920000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.900000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.880000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.860000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.840000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +-9.820000e+00 1.500000e+00 1.500000e+00 1.800000e+00 +e +pause -1 -- GitLab