diff --git a/dumux/material/components/o2.hh b/dumux/material/components/o2.hh index ef55ef42dab84cc80a2c6c3a47098f75c65cbc5f..be8848173b0f7ca3bb5f5edfa5021d34b544583f 100644 --- a/dumux/material/components/o2.hh +++ b/dumux/material/components/o2.hh @@ -51,7 +51,7 @@ public: /*! * \brief A human readable name for the \f$O_2\f$. */ - static const std::string name() + static std::string name() { return "O2"; } /*! diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh index e3682219c2b59842e7bdf99031b6a85d0ab0b1e9..e018a3589d07eefcad875122fd05eadf359d7b8b 100644 --- a/dumux/material/fluidsystems/h2oair.hh +++ b/dumux/material/fluidsystems/h2oair.hh @@ -119,7 +119,7 @@ public: * * \param phaseIdx index of the phase */ - static const std::string phaseName(int phaseIdx) + static std::string phaseName(int phaseIdx) { switch (phaseIdx) { case wPhaseIdx: return "liquid"; @@ -223,7 +223,7 @@ public: * * \param compIdx index of the component */ - static const std::string componentName(int compIdx) + static std::string componentName(int compIdx) { switch (compIdx) { diff --git a/dumux/material/fluidsystems/h2on2.hh b/dumux/material/fluidsystems/h2on2.hh index f7f0fa9652d3794d5c7eb494a950ad5e601c0b18..a15d769f3082c49e19418ed009bd946620604fe2 100644 --- a/dumux/material/fluidsystems/h2on2.hh +++ b/dumux/material/fluidsystems/h2on2.hh @@ -195,15 +195,15 @@ public: * * \param compIdx The index of the component to consider */ - static const std::string& componentName(int compIdx) + static std::string componentName(int compIdx) { - static const std::string name[] = { - H2O::name(), - N2::name() - }; + switch (compIdx) + { + case H2OIdx: return H2O::name(); + case N2Idx: return N2::name(); + } - assert(0 <= compIdx && compIdx < numComponents); - return name[compIdx]; + DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx); } /*! diff --git a/dumux/material/fluidsystems/h2on2o2.hh b/dumux/material/fluidsystems/h2on2o2.hh index 26eee94949a979271b127d84b8301a0066f59a66..b96715ec94d905a83ebb79204c1fc470326c6aa7 100644 --- a/dumux/material/fluidsystems/h2on2o2.hh +++ b/dumux/material/fluidsystems/h2on2o2.hh @@ -212,16 +212,16 @@ public: * * \param compIdx The index of the component to consider */ - static const std::string componentName(int compIdx) + static std::string componentName(int compIdx) { - static const std::string name[] = { - H2O::name(), - N2::name(), - O2::name() - }; + switch (compIdx) + { + case H2OIdx: return H2O::name(); + case N2Idx: return N2::name(); + case O2Idx: return O2::name(); + } - assert(0 <= compIdx && compIdx < numComponents); - return name[compIdx]; + DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx); } /*!