diff --git a/dumux/common/exceptions.hh b/dumux/common/exceptions.hh index 7a5f6fe94baa02dadd28403a5129385dfac01c4a..4cefff885e275302438502e23f4ba4e37e2760ea 100644 --- a/dumux/common/exceptions.hh +++ b/dumux/common/exceptions.hh @@ -48,7 +48,7 @@ public: {} // constructor with error message - NumericalProblem(const std::string &s) + explicit NumericalProblem(const std::string &s) { this->message(s); } }; @@ -69,7 +69,7 @@ public: {} // constructor with error message - ParameterException(const std::string &s) + explicit ParameterException(const std::string &s) { this->message(s); } }; diff --git a/dumux/common/properties/propertysystem.hh b/dumux/common/properties/propertysystem.hh index e5adf3cddc1e3c290677890ea053b48b15aaadfe..791bdede502e6c6f9fa67046a0085465eaf268ca 100644 --- a/dumux/common/properties/propertysystem.hh +++ b/dumux/common/properties/propertysystem.hh @@ -919,7 +919,7 @@ std::string canonicalTypeTagNameToName_(const std::string &canonicalName) inline bool getDiagnostic_(const std::string &typeTagName, const std::string &propTagName, std::string &result, - const std::string indent) + const std::string &indent) { const PropertyRegistryKey *key = 0; @@ -996,7 +996,7 @@ const std::string getDiagnostic(std::string propTagName) inline void print_(const std::string &typeTagName, std::ostream &os, - const std::string indent, + const std::string &indent, std::set<std::string> &printedProperties) { if (indent == "") diff --git a/dumux/io/gnuplotinterface.hh b/dumux/io/gnuplotinterface.hh index fc7f150e79812f059570135be1c4dadec196031b..a64dce5ffe3f9388a35c1dba2eda77b45a0d1f04 100644 --- a/dumux/io/gnuplotinterface.hh +++ b/dumux/io/gnuplotinterface.hh @@ -63,7 +63,7 @@ public: using CurveTypeVector = std::vector<CurveType>; //! \brief The constructor - GnuplotInterface(bool persist = true) : + explicit GnuplotInterface(bool persist = true) : pipe_(0), openPlotWindow_(true), persist_(persist), createImage_(true), terminalType_("x11"), outputDirectory_("./"), datafileSeparator_(' '), linetype_("solid"), @@ -151,7 +151,7 @@ public: interactivePlot += plot; if (openPlotWindow_) - executeGnuplot(interactivePlot.c_str()); + executeGnuplot(interactivePlot); // create a gnuplot file if a filename is specified if (filename.compare("") != 0) @@ -168,7 +168,7 @@ public: // live plot of the results if (createImage_) - executeGnuplot(filePlot.c_str()); + executeGnuplot(filePlot); } } @@ -213,9 +213,9 @@ public: } DUNE_DEPRECATED_MSG("The signature of addFunctionToPlot(string, string, string) has been changed to addFunctionToPlot(string, string).") - void addFunctionToPlot(const std::string function, - const std::string plotName, - const std::string plotOptions) + void addFunctionToPlot(const std::string& function, + const std::string& plotName, + const std::string& plotOptions) { addFunctionToPlot(function, "title '" + plotName + "' " + plotOptions); } @@ -226,8 +226,8 @@ public: * \param function Function to be plotted * \param options Specific gnuplot options passed to this plot */ - void addFunctionToPlot(const std::string function, - const std::string options = "with lines") + void addFunctionToPlot(const std::string& function, + const std::string& options = "with lines") { curve_.push_back(function); curveOptions_.push_back(options); @@ -235,9 +235,9 @@ public: } DUNE_DEPRECATED_MSG("The signature of addFileToPlot(string, string, string) has been changed to addFileToPlot(string, string).") - void addFileToPlot(const std::string file, - const std::string plotName, - const std::string plotOptions) + void addFileToPlot(const std::string& file, + const std::string& plotName, + const std::string& plotOptions) { addFileToPlot(file, "title '" + plotName + "' " + plotOptions); } @@ -248,8 +248,8 @@ public: * \param fileName Name and path of the file to be plotted * \param options Specific gnuplot options passed to this plot */ - void addFileToPlot(const std::string fileName, - const std::string options = "with lines") + void addFileToPlot(const std::string& fileName, + const std::string& options = "with lines") { curve_.push_back(fileName); curveOptions_.push_back(options); @@ -268,8 +268,8 @@ public: */ void addDataSetToPlot(const std::vector<Scalar>& x, const std::vector<Scalar>& y, - const std::string fileName, - const std::string options = "with lines") + const std::string& fileName, + const std::string& options = "with lines") { assert(x.size() == y.size()); @@ -341,7 +341,7 @@ public: * * \param option Additional line of option in gnuplot language */ - void setOption(std::string option) + void setOption(const std::string& option) { plotOptions_ += option + "\n"; } @@ -391,7 +391,7 @@ public: * * \param outputDirectory The user-specified terminal */ - void setOutputDirectory(std::string outputDirectory) + void setOutputDirectory(const std::string& outputDirectory) { outputDirectory_ = outputDirectory + "/"; } @@ -417,7 +417,7 @@ private: } // Check validity of number - void checkNumber(Scalar number, std::string text = "") const + void checkNumber(Scalar number, const std::string& text = "") const { using std::isnan; using std::isinf; @@ -447,7 +447,6 @@ private: StringVector curve_; StringVector curveOptions_; CurveTypeVector curveType_; - bool interaction_; Scalar xRangeMin_; Scalar xRangeMax_; Scalar xRangeIsSet_; diff --git a/dumux/material/components/co2.hh b/dumux/material/components/co2.hh index 02b340a4dc7828c98f833ba7ea592e110b29b930..dbd8a46cc247f01324ef82d65c2edfdc3d05c985 100644 --- a/dumux/material/components/co2.hh +++ b/dumux/material/components/co2.hh @@ -136,7 +136,7 @@ public: Scalar Tred = T/criticalTemperature(); using std::pow; - for (int i = 0; i < 5; ++i) + for (int i = 0; i < 4; ++i) exponent += a[i]*pow(1 - Tred, t[i]); exponent *= 1.0/Tred; diff --git a/dumux/material/components/iapws/region1.hh b/dumux/material/components/iapws/region1.hh index bdc4f9960565f2365cb3dd262dc52e502a4276d1..9ca0aa7c738c59e3e5464895a237a33f764c21bb 100644 --- a/dumux/material/components/iapws/region1.hh +++ b/dumux/material/components/iapws/region1.hh @@ -60,7 +60,7 @@ public: * \param propertyName the name for which property the check is performed */ static void checkValidityRange(Scalar temperature, Scalar pressure, - std::string propertyName = "This property") + const std::string& propertyName = "This property") { // actually this is: /* 273.15 <= temperature && diff --git a/dumux/material/components/iapws/region2.hh b/dumux/material/components/iapws/region2.hh index 33c50889caa448daa5efe9607edcabcae2637115..076cbb5996aec4e4e8436051b8176901201a82fd 100644 --- a/dumux/material/components/iapws/region2.hh +++ b/dumux/material/components/iapws/region2.hh @@ -61,7 +61,7 @@ public: * \param propertyName the name for which property the check is performed */ static void checkValidityRange(Scalar temperature, Scalar pressure, - std::string propertyName = "This property") + const std::string& propertyName = "This property") { // actually this is: /* (273.15 <= temperature && temperature <= 623.15 && pressure <= vaporPressure(temperature)) || diff --git a/dumux/material/components/tabulatedcomponent.hh b/dumux/material/components/tabulatedcomponent.hh index feeb2c47d976854c464fa21ca800120713be43e2..eaf559061bef4785c6f0d04b6c86838675d0255b 100644 --- a/dumux/material/components/tabulatedcomponent.hh +++ b/dumux/material/components/tabulatedcomponent.hh @@ -113,7 +113,7 @@ public: try { vaporPressure_[iT] = RawComponent::vaporPressure(temperature); } catch (Dune::NotImplemented) { vaporPressure_[iT] = NaN; } - catch (NumericalProblem e) { vaporPressure_[iT] = NaN; } + catch (NumericalProblem) { vaporPressure_[iT] = NaN; } Scalar pgMax = maxGasPressure_(iT); Scalar pgMin = minGasPressure_(iT); @@ -569,7 +569,7 @@ public: private: // prints a warning if the result is not in range or the table has // not been initialized - static void printWarning_(std::string quantity, Scalar arg1, Scalar arg2) + static void printWarning_(const std::string& quantity, Scalar arg1, Scalar arg2) { #ifndef NDEBUG if (warningPrinted_)