From 8c9b32e8476da6fbeb1717ee677b1e31a56a430f Mon Sep 17 00:00:00 2001 From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de> Date: Wed, 12 Oct 2016 09:32:25 +0200 Subject: [PATCH] [io] Improve variable names by better discerning between plot and curve --- dumux/io/gnuplotinterface.hh | 58 +++++++++++------------ dumux/io/ploteffectivediffusivitymodel.hh | 6 +-- dumux/io/plotmateriallaw.hh | 48 +++++++++---------- dumux/io/plotmateriallaw3p.hh | 52 ++++++++++---------- dumux/io/plotthermalconductivitymodel.hh | 6 +-- 5 files changed, 85 insertions(+), 85 deletions(-) diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh index 8a729c3757..8da49ce440 100644 --- a/dumux/io/gnuplotinterface.hh +++ b/dumux/io/gnuplotinterface.hh @@ -63,12 +63,12 @@ public: //! \brief The constructor GnuplotInterface(bool persist = true) : plotStyle_("lines"), pipe_(0), - fileName_(0), plotOptions_(0), plotName_(0), + curveFile_(0), curveOptions_(0), curveTitle_(0), interaction_(true), xRangeMin_(1e100), xRangeMax_(-1e100), yRangeMin_(1e100), yRangeMax_(-1e100), xLabel_(""), yLabel_(""), - options_(""), + plotOptions_(""), datafileSeparator_(' '), gnuplotPath_(GNUPLOT_EXECUTABLE) { @@ -113,16 +113,16 @@ public: plot += "set ylabel \"" + yLabel_ + "\"\n"; // set user defined options - plot += options_ + "\n"; + plot += plotOptions_ + "\n"; // plot curves plot += "plot"; - for (unsigned int i = 0; i < fileName_.size(); ++i) + for (unsigned int i = 0; i < curveFile_.size(); ++i) { - plot += + " " + fileName_[i] - + " " + plotOptions_[i] - + " title '" + plotName_[i] + "'"; - if (i < fileName_.size()-1) + plot += + " " + curveFile_[i] + + " " + curveOptions_[i] + + " title '" + curveTitle_[i] + "'"; + if (i < curveFile_.size()-1) plot += ",\\"; plot += "\n"; } @@ -150,14 +150,14 @@ public: */ void reset() { - fileName_.resize(0); - plotOptions_.resize(0); - plotName_.resize(0); - options_ = ""; + curveFile_.resize(0); + curveOptions_.resize(0); + curveTitle_.resize(0); + plotOptions_ = ""; } /*! - * \brief Adds a function to list of plotted lines for specific window number + * \brief Adds a function to list of plotted lines * * \param function Function to be plotted * \param plotName The name of the data set @@ -167,13 +167,13 @@ public: const std::string plotName, const std::string plotOptions = "with lines") { - fileName_.push_back(function); - plotOptions_.push_back(plotOptions); - plotName_.push_back(plotName); + curveFile_.push_back(function); + curveOptions_.push_back(plotOptions); + curveTitle_.push_back(plotName); } /*! - * \brief Adds a file to list of plotted lines for specific window number + * \brief Adds a file to list of plotted lines * * \param file Function to be plotted * \param plotName The name of the data set @@ -183,13 +183,13 @@ public: const std::string plotName, const std::string plotOptions = "with lines") { - fileName_.push_back("'" + file + "'"); - plotOptions_.push_back(plotOptions); - plotName_.push_back(plotName); + curveFile_.push_back("'" + file + "'"); + curveOptions_.push_back(plotOptions); + curveTitle_.push_back(plotName); } /*! - * \brief Adds a data set for specific window number and writes a data file + * \brief Adds a data set and writes a data file * * \param x Vector containing the x-axis data points * \param y Vector containing the y-axis data points @@ -216,9 +216,9 @@ public: file.close(); // adding file to list of plotted lines - fileName_.push_back("'" + fileName + "'"); - plotOptions_.push_back(plotOptions); - plotName_.push_back(plotName); + curveFile_.push_back("'" + fileName + "'"); + curveOptions_.push_back(plotOptions); + curveTitle_.push_back(plotName); } /*! @@ -282,7 +282,7 @@ public: */ void setOption(std::string option) { - options_ += option + "\n"; + plotOptions_ += option + "\n"; } /*! @@ -323,9 +323,9 @@ private: std::string plotStyle_; std::FILE * pipe_; - StringVector fileName_; - StringVector plotOptions_; - StringVector plotName_; + StringVector curveFile_; + StringVector curveOptions_; + StringVector curveTitle_; bool interaction_; Scalar xRangeMin_; Scalar xRangeMax_; @@ -333,7 +333,7 @@ private: Scalar yRangeMax_; std::string xLabel_; std::string yLabel_; - std::string options_; + std::string plotOptions_; char datafileSeparator_; std::string gnuplotPath_; }; diff --git a/dumux/io/ploteffectivediffusivitymodel.hh b/dumux/io/ploteffectivediffusivitymodel.hh index 3df6b56cec..d150b10c94 100644 --- a/dumux/io/ploteffectivediffusivitymodel.hh +++ b/dumux/io/ploteffectivediffusivitymodel.hh @@ -59,12 +59,12 @@ public: * \param porosity The porosity of the porous medium * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotdeff(Scalar porosity, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw(numIntervals_+1); std::vector<Scalar> deff(numIntervals_+1); @@ -85,7 +85,7 @@ public: gnuplot_.setYRange(deffMin, deffMax); gnuplot_.setXlabel("phase saturation [-]"); gnuplot_.setYlabel("effective diffusion/molecular diffusion [-]"); - gnuplot_.addDataSetToPlot(sw, deff, plotName + "_d_eff"); + gnuplot_.addDataSetToPlot(sw, deff, curveTitle + "_d_eff"); gnuplot_.plot("deff"); } diff --git a/dumux/io/plotmateriallaw.hh b/dumux/io/plotmateriallaw.hh index ef87efa516..9f2abd826d 100644 --- a/dumux/io/plotmateriallaw.hh +++ b/dumux/io/plotmateriallaw.hh @@ -68,12 +68,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotpcsw(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> pc; @@ -99,7 +99,7 @@ public: gnuplotpcsw_.setYRange(pcMin, pcMax); gnuplotpcsw_.setXlabel("wetting phase saturation [-]"); gnuplotpcsw_.setYlabel("capillary pressure [Pa]"); - gnuplotpcsw_.addDataSetToPlot(sw, pc, plotName + "_pc-Sw"); + gnuplotpcsw_.addDataSetToPlot(sw, pc, curveTitle + "_pc-Sw"); gnuplotpcsw_.plot("pc-Sw"); } @@ -109,12 +109,12 @@ public: * \param params The material law parameters * \param lowerpc Minimum x-value * \param upperpc Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotswpc(const MaterialLawParams ¶ms, Scalar lowerpc = 0.0, Scalar upperpc = 5000.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> pc; @@ -140,7 +140,7 @@ public: gnuplotswpc_.setYRange(swMin, swMax); gnuplotswpc_.setXlabel("capillary pressure [Pa]"); gnuplotswpc_.setYlabel("wetting phase saturation [-]"); - gnuplotswpc_.addDataSetToPlot(pc, sw, plotName + "_Sw-pc"); + gnuplotswpc_.addDataSetToPlot(pc, sw, curveTitle + "_Sw-pc"); gnuplotswpc_.plot("sw-pc"); } @@ -150,12 +150,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotdpcdsw(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> dpcdsw; @@ -181,7 +181,7 @@ public: gnuplotdpcdsw_.setYRange(dpcdswMin, dpcdswMax); gnuplotdpcdsw_.setXlabel("wetting phase saturation [-]"); gnuplotdpcdsw_.setYlabel("gradient of the pc-Sw curve [Pa]"); - gnuplotdpcdsw_.addDataSetToPlot(sw, dpcdsw, plotName + "_dpcdSw-Sw"); + gnuplotdpcdsw_.addDataSetToPlot(sw, dpcdsw, curveTitle + "_dpcdSw-Sw"); gnuplotdpcdsw_.plot("dpcdsw"); } @@ -191,12 +191,12 @@ public: * \param params The material law parameters * \param lowerpc Minimum x-value * \param upperpc Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotdswdpc(const MaterialLawParams ¶ms, Scalar lowerpc = 0.0, Scalar upperpc = 5000.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> pc; std::vector<Scalar> dswdpc; @@ -222,7 +222,7 @@ public: gnuplotdswdpc_.setYRange(dswdpcMin, dswdpcMax); gnuplotdswdpc_.setXlabel("capillary pressure [Pa]"); gnuplotdswdpc_.setYlabel("gradient of the Sw-pc curve [1/Pa]"); - gnuplotdswdpc_.addDataSetToPlot(pc, dswdpc, plotName + "_dSwdpc-pc"); + gnuplotdswdpc_.addDataSetToPlot(pc, dswdpc, curveTitle + "_dSwdpc-pc"); gnuplotdswdpc_.plot("dswdpc"); } @@ -232,12 +232,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotkr(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> krw; @@ -266,8 +266,8 @@ public: gnuplotkr_.setYRange(krMin, krMax); gnuplotkr_.setXlabel("wetting phase saturation [-]"); gnuplotkr_.setYlabel("relative permeability [-]"); - gnuplotkr_.addDataSetToPlot(sw, krw, plotName + "_krw"); - gnuplotkr_.addDataSetToPlot(sw, krn, plotName + "_krn"); + gnuplotkr_.addDataSetToPlot(sw, krw, curveTitle + "_krw"); + gnuplotkr_.addDataSetToPlot(sw, krn, curveTitle + "_krn"); gnuplotkr_.plot("kr"); } @@ -277,12 +277,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotdkrdsw(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> dkrw_dsw; @@ -311,8 +311,8 @@ public: gnuplotkrdsw_.setYRange(dkrdswMin, dkrdswMax); gnuplotkrdsw_.setXlabel("wetting phase saturation [-]"); gnuplotkrdsw_.setYlabel("gradient of the kr-Sw function [-]"); - gnuplotkrdsw_.addDataSetToPlot(sw, dkrw_dsw, plotName + "_dkrw_dsw"); - gnuplotkrdsw_.addDataSetToPlot(sw, dkrn_dsw, plotName + "_dkrn_dsw"); + gnuplotkrdsw_.addDataSetToPlot(sw, dkrw_dsw, curveTitle + "_dkrw_dsw"); + gnuplotkrdsw_.addDataSetToPlot(sw, dkrn_dsw, curveTitle + "_dkrn_dsw"); gnuplotkrdsw_.plot("dkrndsw"); } @@ -323,18 +323,18 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ DUNE_DEPRECATED_MSG("checkEffectiveSaturation is deprecated.") void checkEffectiveSaturation(const MaterialLawParams ¶ms, Scalar lowerSat, Scalar upperSat, - std::string plotName = "") + std::string curveTitle = "") { if (lowerSat < params.swr()) - Dune::dwarn << "warning: fluid-matrix law " << plotName << " can only be plotted for sw > swr" << std::endl; + Dune::dwarn << "warning: fluid-matrix law " << curveTitle << " can only be plotted for sw > swr" << std::endl; if (upperSat > (1.0 - params.snr())) - Dune::dwarn << "warning: fluid-matrix law " << plotName << " can only be plotted for sw < 1.0 - snr" << std::endl; + Dune::dwarn << "warning: fluid-matrix law " << curveTitle << " can only be plotted for sw < 1.0 - snr" << std::endl; } private: diff --git a/dumux/io/plotmateriallaw3p.hh b/dumux/io/plotmateriallaw3p.hh index 7da7ab693d..4b05cbd347 100644 --- a/dumux/io/plotmateriallaw3p.hh +++ b/dumux/io/plotmateriallaw3p.hh @@ -68,16 +68,16 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotpc(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { - plotpcgw(params, lowerSat, upperSat, plotName); - plotpcnw(params, lowerSat, upperSat, plotName); - plotpcgn(params, lowerSat, upperSat, plotName); + plotpcgw(params, lowerSat, upperSat, curveTitle); + plotpcnw(params, lowerSat, upperSat, curveTitle); + plotpcgn(params, lowerSat, upperSat, curveTitle); } /*! @@ -86,12 +86,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotpcgw(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> pc; @@ -117,7 +117,7 @@ public: gnuplotpc_.setYRange(pcMin, pcMax); gnuplotpc_.setXlabel("wetting phase saturation [-]"); gnuplotpc_.setYlabel("capillary pressure [Pa]"); - gnuplotpc_.addDataSetToPlot(sw, pc, plotName + "_pcgw-Sw"); + gnuplotpc_.addDataSetToPlot(sw, pc, curveTitle + "_pcgw-Sw"); gnuplotpc_.plot("pcgw-Sw"); } @@ -127,12 +127,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotpcnw(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw; std::vector<Scalar> pc; @@ -158,7 +158,7 @@ public: gnuplotpc_.setYRange(pcMin, pcMax); gnuplotpc_.setXlabel("wetting phase saturation [-]"); gnuplotpc_.setYlabel("capillary pressure [Pa]"); - gnuplotpc_.addDataSetToPlot(sw, pc, plotName + "_pcnw-Sw"); + gnuplotpc_.addDataSetToPlot(sw, pc, curveTitle + "_pcnw-Sw"); gnuplotpc_.plot("pcnw-Sw"); } @@ -168,12 +168,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotpcgn(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> st; std::vector<Scalar> pc; @@ -199,7 +199,7 @@ public: gnuplotpc_.setYRange(pcMin, pcMax); gnuplotpc_.setXlabel("wetting phase saturation [-]"); gnuplotpc_.setYlabel("capillary pressure [Pa]"); - gnuplotpc_.addDataSetToPlot(st, pc, plotName + "_pcgn-St"); + gnuplotpc_.addDataSetToPlot(st, pc, curveTitle + "_pcgn-St"); gnuplotpc_.plot("pcgn-St (St=Sw+Sn)"); } @@ -210,12 +210,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotkr(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw(numIntervals_ + 1); std::vector<Scalar> krw(numIntervals_ + 1); @@ -249,9 +249,9 @@ public: gnuplotkr_.setYRange(krMin, krMax); gnuplotkr_.setXlabel("wetting phase saturation [-]"); gnuplotkr_.setYlabel("relative permeability [-]"); - gnuplotkr_.addDataSetToPlot(sw, krw, plotName + "_krw"); - gnuplotkr_.addDataSetToPlot(sw, krn, plotName + "_krn"); - gnuplotkr_.addDataSetToPlot(sw, krg, plotName + "_krg"); + gnuplotkr_.addDataSetToPlot(sw, krw, curveTitle + "_krw"); + gnuplotkr_.addDataSetToPlot(sw, krn, curveTitle + "_krn"); + gnuplotkr_.addDataSetToPlot(sw, krg, curveTitle + "_krg"); gnuplotkr_.plot("kr"); } @@ -261,12 +261,12 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotPcAlpha(const MaterialLawParams ¶ms, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sn(numIntervals_ + 1); std::vector<Scalar> alpha(numIntervals_ + 1); @@ -292,7 +292,7 @@ public: gnuplotpcAlpha_.setYRange(alphaMin, alphaMax); gnuplotpcAlpha_.setXlabel("non-wetting phase saturation [-]"); gnuplotpcAlpha_.setYlabel("transition function [-]"); - gnuplotpcAlpha_.addDataSetToPlot(sn, alpha, plotName + "_alpha"); + gnuplotpcAlpha_.addDataSetToPlot(sn, alpha, curveTitle + "_alpha"); gnuplotpcAlpha_.plot("alpha"); } @@ -303,18 +303,18 @@ public: * \param params The material law parameters * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ DUNE_DEPRECATED_MSG("checkEffectiveSaturation is deprecated.") void checkEffectiveSaturation(const MaterialLawParams ¶ms, Scalar lowerSat, Scalar upperSat, - std::string plotName = "") + std::string curveTitle = "") { if (lowerSat < params.swr()) - Dune::dwarn << "warning: fluid-matrix law " << plotName << " can only be plotted for sw > swr" << std::endl; + Dune::dwarn << "warning: fluid-matrix law " << curveTitle << " can only be plotted for sw > swr" << std::endl; if (upperSat > (1.0 - params.snr())) - Dune::dwarn << "warning: fluid-matrix law " << plotName << " can only be plotted for sw < 1.0 - snr" << std::endl; + Dune::dwarn << "warning: fluid-matrix law " << curveTitle << " can only be plotted for sw < 1.0 - snr" << std::endl; } private: diff --git a/dumux/io/plotthermalconductivitymodel.hh b/dumux/io/plotthermalconductivitymodel.hh index d47f398ca8..42851c23b8 100644 --- a/dumux/io/plotthermalconductivitymodel.hh +++ b/dumux/io/plotthermalconductivitymodel.hh @@ -88,14 +88,14 @@ public: * \param lambdaSolid The thermal conductivity of the solid material * \param lowerSat Minimum x-value * \param upperSat Maximum x-value - * \param plotName Name of the plotted curve + * \param curveTitle Name of the plotted curve */ void plotlambdaeff(Scalar porosity, Scalar rhoSolid, Scalar lambdaSolid, Scalar lowerSat = 0.0, Scalar upperSat = 1.0, - std::string plotName = "") + std::string curveTitle = "") { std::vector<Scalar> sw(numIntervals_+1); std::vector<Scalar> lambda(numIntervals_+1); @@ -117,7 +117,7 @@ public: gnuplot_.setYRange(lambdaMin, lambdaMax); gnuplot_.setXlabel("wetting phase saturation [-]"); gnuplot_.setYlabel("effective thermal conductivity [W/(m K)]"); - gnuplot_.addDataSetToPlot(sw, lambda, plotName + "_lambda_eff"); + gnuplot_.addDataSetToPlot(sw, lambda, curveTitle + "_lambda_eff"); gnuplot_.plot("lambdaeff"); } -- GitLab