diff --git a/tests/material/test_fluidmatrixinteractions.cpp b/tests/material/test_fluidmatrixinteractions.cpp index 095064014..7f1035fea 100644 --- a/tests/material/test_fluidmatrixinteractions.cpp +++ b/tests/material/test_fluidmatrixinteractions.cpp @@ -29,6 +29,9 @@ */ #include "config.h" +#define BOOST_TEST_MODULE FluidMatrixInteractions +#include + #include // include the local AD framwork @@ -80,20 +83,20 @@ void testGenericApi() { while (0) { // ensure the presence of the required values - static const int numPhases = MaterialLaw::numPhases; + static constexpr int numPhases = MaterialLaw::numPhases; // check for the presence of the is*Dependent values - [[maybe_unused]] static const bool isSaturationDependent = MaterialLaw::isSaturationDependent; - [[maybe_unused]] static const bool isPressureDependent = MaterialLaw::isPressureDependent; - [[maybe_unused]] static const bool isTemperatureDependent = MaterialLaw::isTemperatureDependent; - [[maybe_unused]] static const bool isCompositionDependent = MaterialLaw::isCompositionDependent; + [[maybe_unused]] static constexpr bool isSaturationDependent = MaterialLaw::isSaturationDependent; + [[maybe_unused]] static constexpr bool isPressureDependent = MaterialLaw::isPressureDependent; + [[maybe_unused]] static constexpr bool isTemperatureDependent = MaterialLaw::isTemperatureDependent; + [[maybe_unused]] static constexpr bool isCompositionDependent = MaterialLaw::isCompositionDependent; // Make sure that the Traits, Params and Scalar typedefs are // exported by the material law - typedef typename MaterialLaw::Params Params; - typedef typename MaterialLaw::Traits Traits; - typedef typename MaterialLaw::Scalar Scalar; - typedef typename MaterialLaw::Traits::Scalar TraitsScalar; + using Params = typename MaterialLaw::Params; + using Traits = typename MaterialLaw::Traits; + using Scalar = typename MaterialLaw::Scalar; + using TraitsScalar = typename MaterialLaw::Traits::Scalar; static_assert(std::is_same::value, "The traits and the material law must use the same type as scalar value"); @@ -135,10 +138,10 @@ void testGenericApi() template void testTwoPhaseApi() { - typedef typename MaterialLaw::Scalar Scalar; + using Scalar = typename MaterialLaw::Scalar; while (0) { - static const int numPhases = MaterialLaw::numPhases; + static constexpr int numPhases = MaterialLaw::numPhases; static_assert(numPhases == 2, "The number of fluid phases for a twophase " "capillary pressure law must be 2"); @@ -146,8 +149,8 @@ void testTwoPhaseApi() "This material law is expected to implement " "the two-phase API!"); - [[maybe_unused]] static const int wettingPhaseIdx = MaterialLaw::wettingPhaseIdx; - [[maybe_unused]] static const int nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx; + [[maybe_unused]] static constexpr int wettingPhaseIdx = MaterialLaw::wettingPhaseIdx; + [[maybe_unused]] static constexpr int nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx; // make sure the two-phase specific methods are present const FluidState fs; @@ -173,7 +176,7 @@ void testTwoPhaseApi() template void testTwoPhaseSatApi() { - typedef typename MaterialLaw::Scalar Scalar; + using Scalar = typename MaterialLaw::Scalar; while (0) { static_assert(MaterialLaw::implementsTwoPhaseSatApi, @@ -189,7 +192,7 @@ void testTwoPhaseSatApi() "Capillary pressure laws which implement the twophase saturation only " "API cannot be dependent on the phase compositions!"); - [[maybe_unused]] static const int numPhases = MaterialLaw::numPhases; + [[maybe_unused]] static constexpr int numPhases = MaterialLaw::numPhases; // make sure the two-phase specific methods are present const typename MaterialLaw::Params params; @@ -215,17 +218,17 @@ void testTwoPhaseSatApi() template void testThreePhaseApi() { - typedef typename MaterialLaw::Scalar Scalar; + using Scalar = typename MaterialLaw::Scalar; while (0) { - static const int numPhases = MaterialLaw::numPhases; + static constexpr int numPhases = MaterialLaw::numPhases; static_assert(numPhases == 3, "The number of fluid phases for a threephase " "capillary pressure law must be 3"); - [[maybe_unused]] static const int wettingPhaseIdx = MaterialLaw::wettingPhaseIdx; - [[maybe_unused]] static const int nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx; - [[maybe_unused]] static const int gasPhaseIdx = MaterialLaw::gasPhaseIdx; + [[maybe_unused]] static constexpr int wettingPhaseIdx = MaterialLaw::wettingPhaseIdx; + [[maybe_unused]] static constexpr int nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx; + [[maybe_unused]] static constexpr int gasPhaseIdx = MaterialLaw::gasPhaseIdx; // make sure the two-phase specific methods are present const FluidState fs; @@ -251,192 +254,171 @@ void testThreePhaseApi() } } -template -void testThreePhaseSatApi() +using Types = std::tuple; + +BOOST_AUTO_TEST_CASE_TEMPLATE(ApiConformance, Scalar, Types) { -} + using H2O = Opm::SimpleH2O; + using N2 = Opm::N2; -template -inline void testAll() -{ - typedef Opm::SimpleH2O H2O; - typedef Opm::N2 N2; + using Liquid = Opm::LiquidPhase; + using Gas = Opm::GasPhase; - typedef Opm::LiquidPhase Liquid; - typedef Opm::GasPhase Gas; + using TwoPFluidSystem = Opm::TwoPhaseImmiscibleFluidSystem; + using ThreePFluidSystem = Opm::BlackOilFluidSystem; - typedef Opm::TwoPhaseImmiscibleFluidSystem TwoPFluidSystem; - typedef Opm::BlackOilFluidSystem ThreePFluidSystem; + using TwoPhaseTraits = Opm::TwoPhaseMaterialTraits; - typedef Opm::TwoPhaseMaterialTraits TwoPhaseTraits; + using ThreePhaseTraits = Opm::ThreePhaseMaterialTraits; - typedef Opm::ThreePhaseMaterialTraits ThreePhaseTraits; - - typedef Opm::DenseAd::Evaluation Evaluation; - typedef Opm::ImmiscibleFluidState TwoPhaseFluidState; - typedef Opm::ImmiscibleFluidState ThreePhaseFluidState; + using Evaluation = Opm::DenseAd::Evaluation; + using TwoPhaseFluidState = Opm::ImmiscibleFluidState; + using ThreePhaseFluidState = Opm::ImmiscibleFluidState; // test conformance to the capillary pressure APIs { - typedef Opm::BrooksCorey MaterialLaw; + using MaterialLaw = Opm::BrooksCorey; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::LinearMaterial MaterialLaw; + using MaterialLaw = Opm::LinearMaterial; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); - typedef Opm::EffToAbsLaw TwoPAbsLaw; + using TwoPAbsLaw = Opm::EffToAbsLaw; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); - typedef Opm::LinearMaterial ThreePMaterialLaw; + using ThreePMaterialLaw = Opm::LinearMaterial; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); - typedef Opm::EffToAbsLaw ThreePAbsLaw; + using ThreePAbsLaw = Opm::EffToAbsLaw; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::BrooksCorey TwoPhaseMaterial; - typedef Opm::EclDefaultMaterial MaterialLaw; + using TwoPhaseMaterial = Opm::BrooksCorey; + using MaterialLaw = Opm::EclDefaultMaterial; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::BrooksCorey TwoPhaseMaterial; - typedef Opm::EclStone1Material MaterialLaw; + using TwoPhaseMaterial = Opm::BrooksCorey; + using MaterialLaw = Opm::EclStone1Material; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::BrooksCorey TwoPhaseMaterial; - typedef Opm::EclStone2Material MaterialLaw; + using TwoPhaseMaterial = Opm::BrooksCorey; + using MaterialLaw = Opm::EclStone2Material; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::BrooksCorey TwoPhaseMaterial; - typedef Opm::EclTwoPhaseMaterial MaterialLaw; + using TwoPhaseMaterial = Opm::BrooksCorey; + using MaterialLaw = Opm::EclTwoPhaseMaterial; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::BrooksCorey TwoPhaseMaterial; - typedef Opm::EclMultiplexerMaterial MaterialLaw; + using TwoPhaseMaterial = Opm::BrooksCorey; + using MaterialLaw = Opm::EclMultiplexerMaterial; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::ThreePhaseParkerVanGenuchten MaterialLaw; + using MaterialLaw = Opm::ThreePhaseParkerVanGenuchten; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::NullMaterial MaterialLaw; + using MaterialLaw = Opm::NullMaterial; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::NullMaterial ThreePMaterialLaw; + using ThreePMaterialLaw = Opm::NullMaterial; testGenericApi(); testThreePhaseApi(); - //testThreePhaseSatApi(); } { - typedef Opm::ParkerLenhard MaterialLaw; + using MaterialLaw = Opm::ParkerLenhard; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::PiecewiseLinearTwoPhaseMaterial MaterialLaw; + using MaterialLaw = Opm::PiecewiseLinearTwoPhaseMaterial; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::TwoPhaseLETCurves MaterialLaw; + using MaterialLaw = Opm::TwoPhaseLETCurves; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::SplineTwoPhaseMaterial MaterialLaw; + using MaterialLaw = Opm::SplineTwoPhaseMaterial; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::VanGenuchten MaterialLaw; + using MaterialLaw = Opm::VanGenuchten; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::RegularizedBrooksCorey MaterialLaw; + using MaterialLaw = Opm::RegularizedBrooksCorey; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::RegularizedVanGenuchten MaterialLaw; + using MaterialLaw = Opm::RegularizedVanGenuchten; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::BrooksCorey RawMaterialLaw; - typedef Opm::EclEpsTwoPhaseLaw MaterialLaw; + using RawMaterialLaw = Opm::BrooksCorey; + using MaterialLaw = Opm::EclEpsTwoPhaseLaw; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } { - typedef Opm::BrooksCorey RawMaterialLaw; - typedef Opm::EclHysteresisTwoPhaseLaw MaterialLaw; + using RawMaterialLaw = Opm::BrooksCorey; + using MaterialLaw = Opm::EclHysteresisTwoPhaseLaw; testGenericApi(); testTwoPhaseApi(); testTwoPhaseSatApi(); } } - -int main() -{ - testAll(); - testAll(); - - return 0; -}