From b3e3f9f50e92a486b3b2a546f974d6cf5e74e4ce Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Mon, 30 Mar 2020 14:43:23 +0200 Subject: [PATCH] [mimetic][2p] At default to switch that throws NotImplemented Gets rid of compiler warning about non-treated enum case. --- .../2p/sequential/diffusion/mimetic/mimetic.hh | 8 ++++++++ .../2p/sequential/diffusion/mimetic/mimeticadaptive.hh | 8 ++++++++ .../2p/sequential/diffusion/mimetic/pressure.hh | 4 ++++ .../2p/sequential/diffusion/mimetic/pressureadaptive.hh | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh index 76e7c90d00..7c98f76ab6 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimetic.hh @@ -361,6 +361,8 @@ private: case Sn: sat = cellData.saturation(nPhaseIdx); break; + default: + DUNE_THROW(Dune::NotImplemented, "Only saturation formulation Sw and Sn are implemented!"); } Scalar error = (sat > 1.0) ? sat - 1.0 : 0.0; @@ -641,6 +643,8 @@ void MimeticTwoPLocalStiffness::assembleElementMatrices(const Element& fracFlow = -cellData.fracFlowFunc(wPhaseIdx); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } @@ -669,6 +673,8 @@ void MimeticTwoPLocalStiffness::assembleElementMatrices(const Element& fracFlow = -cellData.fracFlowFunc(wPhaseIdx); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } } else if (flux < 0. && bctype.isDirichlet(satEqIdx)) @@ -695,6 +701,8 @@ void MimeticTwoPLocalStiffness::assembleElementMatrices(const Element& / (krw / viscosity_[wPhaseIdx] + krn / viscosity_[nPhaseIdx]); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } } diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh index 896605001e..5bf9b3bcc7 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/mimeticadaptive.hh @@ -377,6 +377,8 @@ private: case Sn: sat = cellData.saturation(nPhaseIdx); break; + default: + DUNE_THROW(Dune::NotImplemented, "Only saturation formulation Sw and Sn are implemented!"); } Scalar error = (sat > 1.0) ? sat - 1.0 : 0.0; @@ -661,6 +663,8 @@ void MimeticTwoPLocalStiffnessAdaptive::assembleElementMatrices(const E fracFlow = -cellData.fracFlowFunc(wPhaseIdx); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } rhs_[eIdxGlobal] -= (faceVol[idx] * fracFlow * flux); @@ -688,6 +692,8 @@ void MimeticTwoPLocalStiffnessAdaptive::assembleElementMatrices(const E fracFlow = -cellData.fracFlowFunc(wPhaseIdx); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } } else if (flux < 0. && bctype.isDirichlet(satEqIdx)) @@ -714,6 +720,8 @@ void MimeticTwoPLocalStiffnessAdaptive::assembleElementMatrices(const E / (krw / viscosity_[wPhaseIdx] + krn / viscosity_[nPhaseIdx]); break; } + default: + DUNE_THROW(Dune::NotImplemented, "Only pressure formulation pw and pn are implemented!"); } } diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh index 4160138ba7..d23db57673 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_MIMETICPRESSURE2P_HH #define DUMUX_MIMETICPRESSURE2P_HH +#include + // dumux environment #include #include @@ -136,6 +138,8 @@ template class MimeticPressure2P case sn: sat = problem_.variables().cellData(i).saturation(nPhaseIdx); break; + default: + DUNE_THROW(Dune::NotImplemented, "Only saturation formulation sw and sn are implemented!"); } if (sat > 1.0) { diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh index a774ed7b10..948bc3dc83 100644 --- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh +++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_MIMETICPRESSURE2PADAPTIVE_HH #define DUMUX_MIMETICPRESSURE2PADAPTIVE_HH +#include + // dumux environment #include #include @@ -137,6 +139,8 @@ template class MimeticPressure2PAdaptive case Sn: sat = problem_.variables().cellData(i).saturation(nPhaseIdx); break; + default: + DUNE_THROW(Dune::NotImplemented, "Only saturation formulation Sw and Sn are implemented!"); } if (sat > 1.0) { -- GitLab