From 60f1a4162e6341a3ff4ea4a2a060a7c91d79d517 Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Fri, 21 Dec 2018 11:10:01 +0100 Subject: [PATCH 1/5] [macros] Use script to replace exercise macros --- .../exercise-basic/injection2p2cproblem.hh | 2 +- .../exercise-mainfile/1pspatialparams.hh | 1 - .../exercise-properties/mylocalresidual.hh | 26 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index 7900985..d2cc518 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -43,7 +43,7 @@ namespace Properties { // Create new type tags namespace TTag { struct Injection2p2c { using InheritsFrom = std::tuple; }; -struct Injection2p2cCC { using InheritsFrom = std::tuple; }; +struct Injection2p2cCC { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the grid type diff --git a/exercises/exercise-mainfile/1pspatialparams.hh b/exercises/exercise-mainfile/1pspatialparams.hh index a7df1fd..d15c8b5 100644 --- a/exercises/exercise-mainfile/1pspatialparams.hh +++ b/exercises/exercise-mainfile/1pspatialparams.hh @@ -36,7 +36,6 @@ namespace Dumux { template class OnePTestSpatialParams : public FVSpatialParamsOneP> -{ using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename FVGridGeometry::LocalView; diff --git a/exercises/exercise-properties/mylocalresidual.hh b/exercises/exercise-properties/mylocalresidual.hh index 1a35cf0..f47698e 100644 --- a/exercises/exercise-properties/mylocalresidual.hh +++ b/exercises/exercise-properties/mylocalresidual.hh @@ -35,24 +35,24 @@ namespace Dumux * using the n-phase immiscible fully implicit models. */ template -class MyLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual) +class MyLocalResidual : public GetPropType { - using ParentType = typename GET_PROP_TYPE(TypeTag, BaseLocalResidual); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView; - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache)::LocalView; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using ParentType = GetPropType; + using Scalar = GetPropType; + using Problem = GetPropType; + using NumEqVector = GetPropType; + using VolumeVariables = GetPropType; + using ElementVolumeVariables = typename GetPropType::LocalView; + using FluxVariables = GetPropType; + using ElementFluxVariablesCache = typename GetPropType::LocalView; + using FVElementGeometry = typename GetPropType::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using GridView = GetPropType; using Element = typename GridView::template Codim<0>::Entity; - using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); + using EnergyLocalResidual = GetPropType; - using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits); + using ModelTraits = GetPropType; static constexpr int numPhases = ModelTraits::numPhases(); static constexpr int conti0EqIdx = ModelTraits::Indices::conti0EqIdx; //!< first index for the mass balance -- GitLab From c760558ca7cad05a9ffeca0cddaf6e03bd985e57 Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Fri, 21 Dec 2018 11:19:27 +0100 Subject: [PATCH 2/5] [macros] Replace macros for solutions using the script --- .../interface/ex_interface_coupling_ff-pm.cc | 30 ++++++------ .../interface/ex_interface_ffproblem.hh | 46 +++++++++++-------- .../interface/ex_interface_pmproblem.hh | 2 - .../exercise-properties/mylocalresidual.hh | 26 +++++------ 4 files changed, 57 insertions(+), 47 deletions(-) diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc index 812cae4..31e5c53 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc @@ -53,15 +53,17 @@ namespace Dumux { namespace Properties { -SET_PROP(StokesOneP, CouplingManager) +template +struct CouplingManager { - using Traits = StaggeredMultiDomainTraits; + using Traits = StaggeredMultiDomainTraits; using type = Dumux::StokesDarcyCouplingManager; }; -SET_PROP(DarcyOneP, CouplingManager) +template +struct CouplingManager { - using Traits = StaggeredMultiDomainTraits; + using Traits = StaggeredMultiDomainTraits; using type = Dumux::StokesDarcyCouplingManager; }; @@ -83,17 +85,17 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = TTAG(StokesOneP); - using DarcyTypeTag = TTAG(DarcyOneP); + using StokesTypeTag = Properties::TTag::StokesOnePTypeTag; + using DarcyTypeTag = Properties::TTag::DarcyOnePTypeTag; #if EXNUMBER < 3 // try to create a grid (from the given grid file or the input file) // for both sub-domains - using DarcyGridManager = Dumux::GridManager; + using DarcyGridManager = Dumux::GridManager>; DarcyGridManager darcyGridManager; darcyGridManager.init("Darcy"); // pass parameter group - using StokesGridManager = Dumux::GridManager; + using StokesGridManager = Dumux::GridManager>; StokesGridManager stokesGridManager; stokesGridManager.init("Stokes"); // pass parameter group @@ -143,10 +145,10 @@ int main(int argc, char** argv) try // create the finite volume grid geometry - using StokesFVGridGeometry = typename GET_PROP_TYPE(StokesTypeTag, FVGridGeometry); + using StokesFVGridGeometry = GetPropType; auto stokesFvGridGeometry = std::make_shared(stokesGridView); stokesFvGridGeometry->update(); - using DarcyFVGridGeometry = typename GET_PROP_TYPE(DarcyTypeTag, FVGridGeometry); + using DarcyFVGridGeometry = GetPropType; auto darcyFvGridGeometry = std::make_shared(darcyGridView); darcyFvGridGeometry->update(); @@ -162,9 +164,9 @@ int main(int argc, char** argv) try constexpr auto darcyIdx = CouplingManager::darcyIdx; // the problem (initial and boundary conditions) - using StokesProblem = typename GET_PROP_TYPE(StokesTypeTag, Problem); + using StokesProblem = GetPropType; auto stokesProblem = std::make_shared(stokesFvGridGeometry, couplingManager); - using DarcyProblem = typename GET_PROP_TYPE(DarcyTypeTag, Problem); + using DarcyProblem = GetPropType; auto darcyProblem = std::make_shared(darcyFvGridGeometry, couplingManager); // the solution vector @@ -181,10 +183,10 @@ int main(int argc, char** argv) try couplingManager->init(stokesProblem, darcyProblem, sol); // the grid variables - using StokesGridVariables = typename GET_PROP_TYPE(StokesTypeTag, GridVariables); + using StokesGridVariables = GetPropType; auto stokesGridVariables = std::make_shared(stokesProblem, stokesFvGridGeometry); stokesGridVariables->init(stokesSol); - using DarcyGridVariables = typename GET_PROP_TYPE(DarcyTypeTag, GridVariables); + using DarcyGridVariables = GetPropType; auto darcyGridVariables = std::make_shared(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh index 38ff20a..0043c69 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh @@ -43,20 +43,25 @@ class StokesSubProblem; namespace Properties { -NEW_TYPE_TAG(StokesOneP, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); +// Create new type tags +namespace TTag { +struct StokesOneP { using InheritsFrom = std::tuple; }; +} // end namespace TTag // the fluid system -SET_PROP(StokesOneP, FluidSystem) +template +struct FluidSystem { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using Scalar = GetPropType; using type = FluidSystems::OnePLiquid > ; }; // Set the grid type -SET_PROP(StokesOneP, Grid) +template +struct Grid { static constexpr auto dim = 2; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using Scalar = GetPropType; using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates >; #if EXNUMBER < 3 // use "normal" grid @@ -68,11 +73,16 @@ SET_PROP(StokesOneP, Grid) }; // Set the problem property -SET_TYPE_PROP(StokesOneP, Problem, Dumux::StokesSubProblem ); +template +struct Problem { using type = Dumux::StokesSubProblem ; }; -SET_BOOL_PROP(StokesOneP, EnableFVGridGeometryCache, true); -SET_BOOL_PROP(StokesOneP, EnableGridFluxVariablesCache, true); -SET_BOOL_PROP(StokesOneP, EnableGridVolumeVariablesCache, true); +template +struct EnableFVGridGeometryCache { static constexpr bool value = true; }; +template +struct EnableGridFluxVariablesCache { static constexpr bool value = true; }; +template +struct EnableGridVolumeVariablesCache { static constexpr bool value = true; }; +>>>>>>> 812d3cb... [macros] Replace macros for solutions using the script } @@ -84,25 +94,25 @@ class StokesSubProblem : public NavierStokesProblem { using ParentType = NavierStokesProblem; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using GridView = GetPropType; + using Scalar = GetPropType; - using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices; + using Indices = typename GetPropType::Indices; - using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); + using BoundaryTypes = GetPropType; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GetPropType; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); + using PrimaryVariables = GetPropType; + using NumEqVector = GetPropType; + using FluidSystem = GetPropType; - using CouplingManager = typename GET_PROP_TYPE(TypeTag, CouplingManager); + using CouplingManager = GetPropType; public: StokesSubProblem(std::shared_ptr fvGridGeometry, std::shared_ptr couplingManager) diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh index 51e1663..4bd156f 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh @@ -48,7 +48,6 @@ class DarcySubProblem; namespace Properties { // Create new type tags -namespace TTag { struct DarcyOneP { using InheritsFrom = std::tuple; }; } // end namespace TTag @@ -84,7 +83,6 @@ template struct SpatialParams { using type = OnePSpatialParams, GetPropType>; }; - } // end namespace Properties /*! diff --git a/exercises/solution/exercise-properties/mylocalresidual.hh b/exercises/solution/exercise-properties/mylocalresidual.hh index 2270f28..5b80d2e 100644 --- a/exercises/solution/exercise-properties/mylocalresidual.hh +++ b/exercises/solution/exercise-properties/mylocalresidual.hh @@ -35,24 +35,24 @@ namespace Dumux * using the n-phase immiscible fully implicit models. */ template -class MyLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual) +class MyLocalResidual : public GetPropType { - using ParentType = typename GET_PROP_TYPE(TypeTag, BaseLocalResidual); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView; - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache)::LocalView; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using ParentType = GetPropType; + using Scalar = GetPropType; + using Problem = GetPropType; + using NumEqVector = GetPropType; + using VolumeVariables = GetPropType; + using ElementVolumeVariables = typename GetPropType::LocalView; + using FluxVariables = GetPropType; + using ElementFluxVariablesCache = typename GetPropType::LocalView; + using FVElementGeometry = typename GetPropType::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using GridView = GetPropType; using Element = typename GridView::template Codim<0>::Entity; - using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); + using EnergyLocalResidual = GetPropType; - using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits); + using ModelTraits = GetPropType; static constexpr int numPhases = ModelTraits::numFluidPhases(); static constexpr int conti0EqIdx = ModelTraits::Indices::conti0EqIdx; //!< first index for the mass balance -- GitLab From 8282eb999ffa8e486ed8d7f6e6c7a2b6ae1dd5b6 Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Fri, 21 Dec 2018 11:38:10 +0100 Subject: [PATCH 3/5] [macros] Replace further macros --- .../exercise-basic/injection2p2cproblem.hh | 12 ++++++--- .../exercise-basic/injection2pniproblem.hh | 12 ++++++--- .../exercise-basic/injection2pproblem.hh | 12 ++++++--- .../models/ex_models_pmproblem.hh | 6 ++--- exercises/exercise-fluidsystem/2p2cproblem.hh | 12 ++++++--- exercises/exercise-fluidsystem/2pproblem.hh | 12 ++++++--- .../exercise-grids/injection2pproblem.hh | 12 ++++++--- .../injection2pproblem.hh | 12 ++++++--- .../exercise-basic/injection2pniproblem.hh | 26 +++++++++++++++---- .../models/ex_models_pmproblem.hh | 6 ++--- .../exercise-fluidsystem/2p2cproblem.hh | 12 ++++++--- .../exercise-fluidsystem/2pproblem.hh | 12 ++++++--- .../exercise-grids/injection2pproblem.hh | 12 ++++++--- .../injection2pproblem.hh | 12 ++++++--- 14 files changed, 126 insertions(+), 44 deletions(-) diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index d2cc518..f564bff 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -55,9 +55,15 @@ template struct Problem { using type = Injection2p2cProblem; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p2c, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index 8f0bd5d..c6ee453 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -61,9 +61,15 @@ template struct Problem { using type = InjectionProblem2PNI; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2pNITypeTag, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/exercise-basic/injection2pproblem.hh b/exercises/exercise-basic/injection2pproblem.hh index 49257b1..a4f762b 100644 --- a/exercises/exercise-basic/injection2pproblem.hh +++ b/exercises/exercise-basic/injection2pproblem.hh @@ -57,9 +57,15 @@ template struct Problem { using type = InjectionProblem2P; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh index 31fdc8a..29402f3 100644 --- a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh @@ -70,9 +70,9 @@ template struct ReplaceCompEqIdx { static constexpr int value = 3; }; //! Use a model with constant tortuosity for the effective diffusivity -SET_TYPE_PROP(DarcyOnePNC, EffectiveDiffusivityModel, - DiffusivityConstantTortuosity>); - +template +struct EffectiveDiffusivityModel +{ using type = DiffusivityConstantTortuosity>; }; // Set the grid type template struct Grid { using type = Dune::YaspGrid<2>; }; diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index d89d54e..1a395ad 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -58,9 +58,15 @@ template struct Problem { using type = ExerciseFluidsystemProblemTwoPTwoC; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, - ExerciseFluidsystemSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = ExerciseFluidsystemSpatialParams; +}; // Set grid and the grid creator to be used template diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index f0f2572..2787cac 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -72,9 +72,15 @@ template struct Problem { using type = ExerciseFluidsystemProblemTwoP; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, - ExerciseFluidsystemSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = ExerciseFluidsystemSpatialParams; +}; // Set grid to be used template diff --git a/exercises/exercise-grids/injection2pproblem.hh b/exercises/exercise-grids/injection2pproblem.hh index b99e7eb..910b2ff 100644 --- a/exercises/exercise-grids/injection2pproblem.hh +++ b/exercises/exercise-grids/injection2pproblem.hh @@ -60,9 +60,15 @@ template struct Problem { using type = InjectionProblem2P; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/exercise-runtimeparams/injection2pproblem.hh b/exercises/exercise-runtimeparams/injection2pproblem.hh index cdae77b..ea35326 100644 --- a/exercises/exercise-runtimeparams/injection2pproblem.hh +++ b/exercises/exercise-runtimeparams/injection2pproblem.hh @@ -57,9 +57,15 @@ template struct Problem { using type = InjectionProblem2P; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/solution/exercise-basic/injection2pniproblem.hh b/exercises/solution/exercise-basic/injection2pniproblem.hh index 6c9c835..1a668c7 100644 --- a/exercises/solution/exercise-basic/injection2pniproblem.hh +++ b/exercises/solution/exercise-basic/injection2pniproblem.hh @@ -56,13 +56,29 @@ template struct Problem { using type = InjectionProblem2PNI; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2pNITypeTag, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; + +// the fluid system for incompressible tests +template +struct FluidSystem +{ +private: + using Scalar = GetPropType; +public: + using type = FluidSystems::OnePLiquid >; +}; // Set fluid configuration -SET_TYPE_PROP(Injection2pNITypeTag, FluidSystem, - FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy>); +template +struct FluidSystem { using type = FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy>; }; } // end namespace Properties /*! diff --git a/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh index aec17c6..7377192 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh @@ -83,9 +83,9 @@ template struct ReplaceCompEqIdx { static constexpr int value = 3; }; //! Use a model with constant tortuosity for the effective diffusivity -SET_TYPE_PROP(DarcyOnePNC, EffectiveDiffusivityModel, - DiffusivityConstantTortuosity>); - +template +struct EffectiveDiffusivityModel +{ using type = DiffusivityConstantTortuosity>; }; // Set the grid type template struct Grid { using type = Dune::YaspGrid<2>; }; diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index 09221c4..0f0602f 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -58,9 +58,15 @@ template struct Problem { using type = ExerciseFluidsystemProblemTwoPTwoC; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, - ExerciseFluidsystemSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = ExerciseFluidsystemSpatialParams; +}; // Set grid and the grid creator to be used template diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index e289f9d..b292a43 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -72,9 +72,15 @@ template struct Problem { using type = ExerciseFluidsystemProblemTwoP; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, - ExerciseFluidsystemSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = ExerciseFluidsystemSpatialParams; +}; // Set grid to be used template diff --git a/exercises/solution/exercise-grids/injection2pproblem.hh b/exercises/solution/exercise-grids/injection2pproblem.hh index 91d8701..101c037 100644 --- a/exercises/solution/exercise-grids/injection2pproblem.hh +++ b/exercises/solution/exercise-grids/injection2pproblem.hh @@ -68,9 +68,15 @@ template struct Problem { using type = InjectionProblem2P; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template diff --git a/exercises/solution/exercise-runtimeparams/injection2pproblem.hh b/exercises/solution/exercise-runtimeparams/injection2pproblem.hh index d0ca659..b2d7930 100644 --- a/exercises/solution/exercise-runtimeparams/injection2pproblem.hh +++ b/exercises/solution/exercise-runtimeparams/injection2pproblem.hh @@ -57,9 +57,15 @@ template struct Problem { using type = InjectionProblem2P; }; // Set the spatial parameters -SET_TYPE_PROP(Injection2p, SpatialParams, - InjectionSpatialParams, - GetPropType>); +template +struct SpatialParams +{ +private: + using FVGridGeometry = GetPropType; + using Scalar = GetPropType; +public: + using type = InjectionSpatialParams; +}; // Set fluid configuration template -- GitLab From 97ae6f0f91019faacb32920e3ac01242ff27d295 Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Fri, 21 Dec 2018 11:48:38 +0100 Subject: [PATCH 4/5] [InheritsFrom] Consistent ordering --- exercises/exercise-basic/injection2pniproblem.hh | 6 +++++- exercises/exercise-fluidsystem/2p2cproblem.hh | 2 +- exercises/exercise-fluidsystem/2pproblem.hh | 2 +- exercises/exercise-fluidsystem/README.md | 4 ++-- exercises/exercise-fractures/fractureproblem.hh | 2 +- .../solution/exercise-basic/injection2pniproblem.hh | 12 +++--------- .../solution/exercise-fluidsystem/2p2cproblem.hh | 2 +- exercises/solution/exercise-fluidsystem/2pproblem.hh | 2 +- .../solution/exercise-fractures/fractureproblem.hh | 2 +- 9 files changed, 16 insertions(+), 18 deletions(-) diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index c6ee453..7642c96 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -73,7 +73,11 @@ public: // Set fluid configuration template -struct FluidSystem { using type = FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy>; }; +struct FluidSystem +{ + using type = FluidSystems::H2ON2, + FluidSystems::H2ON2DefaultPolicy>; +}; } // end namespace Properties /*! diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index 1a395ad..0c3082c 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -50,7 +50,7 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index 2787cac..1acfb0f 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -64,7 +64,7 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property diff --git a/exercises/exercise-fluidsystem/README.md b/exercises/exercise-fluidsystem/README.md index 8ab0cb8..124002b 100644 --- a/exercises/exercise-fluidsystem/README.md +++ b/exercises/exercise-fluidsystem/README.md @@ -41,7 +41,7 @@ the `TwoP` _TypeTag_ (immiscible two-phase model properties) and the `BoxModel` ```c++ // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; } // end namespace TTag ``` @@ -185,7 +185,7 @@ two-component model properties: ```c++ // Create a new type tag for the problem -struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; } // end namespace TTag ``` diff --git a/exercises/exercise-fractures/fractureproblem.hh b/exercises/exercise-fractures/fractureproblem.hh index 38caa0c..5088241 100644 --- a/exercises/exercise-fractures/fractureproblem.hh +++ b/exercises/exercise-fractures/fractureproblem.hh @@ -51,7 +51,7 @@ namespace Properties { // Create new type tag node namespace TTag { -struct FractureProblem { using InheritsFrom = std::tuple; }; +struct FractureProblem { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the grid type diff --git a/exercises/solution/exercise-basic/injection2pniproblem.hh b/exercises/solution/exercise-basic/injection2pniproblem.hh index 1a668c7..8d97115 100644 --- a/exercises/solution/exercise-basic/injection2pniproblem.hh +++ b/exercises/solution/exercise-basic/injection2pniproblem.hh @@ -66,19 +66,13 @@ public: using type = InjectionSpatialParams; }; -// the fluid system for incompressible tests +// Set fluid configuration template struct FluidSystem { -private: - using Scalar = GetPropType; -public: - using type = FluidSystems::OnePLiquid >; + using type = FluidSystems::H2ON2, + FluidSystems::H2ON2DefaultPolicy>; }; - -// Set fluid configuration -template -struct FluidSystem { using type = FluidSystems::H2ON2, FluidSystems::H2ON2DefaultPolicy>; }; } // end namespace Properties /*! diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index 0f0602f..25ae5d6 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -50,7 +50,7 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index b292a43..fa46179 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -64,7 +64,7 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the "Problem" property diff --git a/exercises/solution/exercise-fractures/fractureproblem.hh b/exercises/solution/exercise-fractures/fractureproblem.hh index 2fc8aaa..1f74f6c 100644 --- a/exercises/solution/exercise-fractures/fractureproblem.hh +++ b/exercises/solution/exercise-fractures/fractureproblem.hh @@ -51,7 +51,7 @@ namespace Properties { // Create new type tag node namespace TTag { -struct FractureProblem { using InheritsFrom = std::tuple; }; +struct FractureProblem { using InheritsFrom = std::tuple; }; } // end namespace TTag // Set the grid type -- GitLab From a71cc1387ce133c46cf6633eb7be3e7acf0cabde Mon Sep 17 00:00:00 2001 From: Martin Schneider Date: Fri, 21 Dec 2018 13:07:42 +0100 Subject: [PATCH 5/5] [TTag] Missing TTag --- .../models/ex_models_pmproblem.hh | 2 +- exercises/exercise-mainfile/1pspatialparams.hh | 1 + .../interface/ex_interface_coupling_ff-pm.cc | 12 ++++++------ .../interface/ex_interface_ffproblem.hh | 2 -- .../interface/ex_interface_pmproblem.hh | 1 + 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh index 29402f3..f25401b 100644 --- a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh @@ -71,7 +71,7 @@ struct ReplaceCompEqIdx { static constexpr int value //! Use a model with constant tortuosity for the effective diffusivity template -struct EffectiveDiffusivityModel +struct EffectiveDiffusivityModel { using type = DiffusivityConstantTortuosity>; }; // Set the grid type template diff --git a/exercises/exercise-mainfile/1pspatialparams.hh b/exercises/exercise-mainfile/1pspatialparams.hh index d15c8b5..a7df1fd 100644 --- a/exercises/exercise-mainfile/1pspatialparams.hh +++ b/exercises/exercise-mainfile/1pspatialparams.hh @@ -36,6 +36,7 @@ namespace Dumux { template class OnePTestSpatialParams : public FVSpatialParamsOneP> +{ using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename FVGridGeometry::LocalView; diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc index 31e5c53..868ccc9 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_coupling_ff-pm.cc @@ -54,16 +54,16 @@ namespace Dumux { namespace Properties { template -struct CouplingManager +struct CouplingManager { - using Traits = StaggeredMultiDomainTraits; + using Traits = StaggeredMultiDomainTraits; using type = Dumux::StokesDarcyCouplingManager; }; template -struct CouplingManager +struct CouplingManager { - using Traits = StaggeredMultiDomainTraits; + using Traits = StaggeredMultiDomainTraits; using type = Dumux::StokesDarcyCouplingManager; }; @@ -85,8 +85,8 @@ int main(int argc, char** argv) try Parameters::init(argc, argv); // Define the sub problem type tags - using StokesTypeTag = Properties::TTag::StokesOnePTypeTag; - using DarcyTypeTag = Properties::TTag::DarcyOnePTypeTag; + using StokesTypeTag = Properties::TTag::StokesOneP; + using DarcyTypeTag = Properties::TTag::DarcyOneP; #if EXNUMBER < 3 // try to create a grid (from the given grid file or the input file) diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh index 0043c69..79e7c8e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_ffproblem.hh @@ -82,8 +82,6 @@ template struct EnableGridFluxVariablesCache { static constexpr bool value = true; }; template struct EnableGridVolumeVariablesCache { static constexpr bool value = true; }; ->>>>>>> 812d3cb... [macros] Replace macros for solutions using the script - } /*! diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh index 4bd156f..9649b0e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh @@ -48,6 +48,7 @@ class DarcySubProblem; namespace Properties { // Create new type tags +namespace TTag { struct DarcyOneP { using InheritsFrom = std::tuple; }; } // end namespace TTag -- GitLab