From 267230dba0fa9098b61a14d249387506ea20ff78 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Wed, 4 Sep 2013 10:39:53 +0000 Subject: [PATCH] checkfluidsystem: throw exception instead of doing an assert. Considering the commonly used interface for a component, the exception pretty much has to be thrown for any incompressible fluid phase. One should adapt the check from that perspective. git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@11370 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- test/material/fluidsystems/checkfluidsystem.hh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/material/fluidsystems/checkfluidsystem.hh b/test/material/fluidsystems/checkfluidsystem.hh index 4de45b621c..2be3b5fab9 100644 --- a/test/material/fluidsystems/checkfluidsystem.hh +++ b/test/material/fluidsystems/checkfluidsystem.hh @@ -124,7 +124,11 @@ public: Scalar pressure(int phaseIdx) const { - assert(allowPressure_); + if (!allowPressure_) + { + DUNE_THROW(Dune::InvalidStateException, + "pressure called but not allowed\n\n"); + } assert(restrictPhaseIdx_ < 0 || restrictPhaseIdx_ == phaseIdx); return BaseFluidState::pressure(phaseIdx); } @@ -235,8 +239,7 @@ std::string checkFluidState(const BaseFluidState &fs) std::string collectedExceptions; // make sure the fluid state provides all mandatory methods - Scalar - DUNE_UNUSED val; + Scalar DUNE_UNUSED val; try { @@ -445,8 +448,7 @@ void checkFluidSystem() // some value to make sure the return values of the fluid system // are convertible to scalars - Scalar - DUNE_UNUSED val; + Scalar DUNE_UNUSED val; // actually check the fluid system API FluidSystem::init(); @@ -459,8 +461,9 @@ void checkFluidSystem() try { val = FluidSystem::density(fs, paramCache, phaseIdx); - } catch (...) + } catch (Dune::Exception e) { + std::cout << "\ndensity calculation throws exception:\n" << e.what(); }; fs.allowPressure(true); -- GitLab