From e71df3ab38e1650ecf25f8ea986a10fd61d0553f Mon Sep 17 00:00:00 2001 From: Felix Weinhardt <felixw@picard.iws.uni-stuttgart.de> Date: Thu, 20 Dec 2018 12:00:16 +0100 Subject: [PATCH] [exercise-fluidsystem] removed TypeTag ending --- exercises/exercise-fluidsystem/2p2cproblem.hh | 14 +++++++------- exercises/exercise-fluidsystem/2pproblem.hh | 14 +++++++------- exercises/exercise-fluidsystem/CMakeLists.txt | 4 ++-- exercises/exercise-fluidsystem/README.md | 12 ++++++------ .../exercise-fluidsystem/exercise-fluidsystem.cc | 4 ++-- .../solution/exercise-fluidsystem/2p2cproblem.hh | 14 +++++++------- .../solution/exercise-fluidsystem/2pproblem.hh | 14 +++++++------- .../solution/exercise-fluidsystem/CMakeLists.txt | 4 ++-- .../exercise-fluidsystem/exercise-fluidsystem.cc | 4 ++-- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index a89f4dae..d6f89ad9 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -47,33 +47,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoCTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid and the grid creator to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index 33950b28..2f945fab 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -70,33 +70,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/CMakeLists.txt b/exercises/exercise-fluidsystem/CMakeLists.txt index b8bcc17d..4e310fab 100644 --- a/exercises/exercise-fluidsystem/CMakeLists.txt +++ b/exercises/exercise-fluidsystem/CMakeLists.txt @@ -2,14 +2,14 @@ #part a: 2pproblem dune_add_test(NAME exercise-fluidsystem_a SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoP COMPILE_ONLY # for testing purposes, ignore for the exercise CMD_ARGS exercise-fluidsystem_a.input) #part b: 2p2cproblem dune_add_test(NAME exercise-fluidsystem_b SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoCTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoC COMPILE_ONLY # for testing purposes, ignore for the exercise CMD_ARGS exercise-fluidsystem_b.input) diff --git a/exercises/exercise-fluidsystem/README.md b/exercises/exercise-fluidsystem/README.md index 3cfe4bac..2f9591f6 100644 --- a/exercises/exercise-fluidsystem/README.md +++ b/exercises/exercise-fluidsystem/README.md @@ -35,13 +35,13 @@ To see more components, fluidsystems and binarycoefficients implementations, hav In the following, the basic steps required to set the desired fluid system are outlined. Here, this is done in the __problem file__, i.e. for this part of the exercise the code shown below is taken from the `2pproblem.hh` file. -In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseFluidsystemTwoPTypeTag`) derives from +In this part of the exercise we will consider a system consisting of two immiscible phases. Therefore, the _TypeTag_ for this problem (`ExerciseFluidsystemTwoP`) derives from the `TwoP` _TypeTag_ (immiscible two-phase model properties) and the `BoxModel` _TypeTag_ (specifies properties of the discretization scheme). ```c++ // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag ``` @@ -99,7 +99,7 @@ the other phase is liquid as well and consists of the incompressible fictitious ```c++ // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; @@ -175,7 +175,7 @@ Compare the gnuplot output to the following plot of the density function from ab ### 3. Implement a new fluid system -The problem file for this part of the exercise is `2p2cproblem.hh`. We now want to implement a new fluid system consisting of two liquid phases, which are water and the previously implemented compressible component. We will consider compositional effects, which is why we now have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoCTypeTag`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase +The problem file for this part of the exercise is `2p2cproblem.hh`. We now want to implement a new fluid system consisting of two liquid phases, which are water and the previously implemented compressible component. We will consider compositional effects, which is why we now have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase two-component model properties: ```c++ @@ -185,7 +185,7 @@ two-component model properties: ```c++ // Create a new type tag for the problem -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag ``` @@ -199,7 +199,7 @@ The new fluid system is to be implemented in the file `fluidsystems/h2omycompres ```c++ // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/exercise-fluidsystem/exercise-fluidsystem.cc b/exercises/exercise-fluidsystem/exercise-fluidsystem.cc index 184814d6..7241485c 100644 --- a/exercises/exercise-fluidsystem/exercise-fluidsystem.cc +++ b/exercises/exercise-fluidsystem/exercise-fluidsystem.cc @@ -62,8 +62,8 @@ int main(int argc, char** argv) try // define the type tag for this problem // TYPETAG is set in CMakeLists.txt as compile time definition - // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTypeTag;` - // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoPTypeTag;` + // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoP;` + // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemBoxTwoP;` // and recompile the executable using TypeTag = Properties::TTag::TYPETAG; diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index 35eca350..c53e9e53 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -47,33 +47,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTwoCTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; +struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<BoxModel, TwoPTwoC>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = ExerciseFluidsystemProblemTwoPTwoC<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoCTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoPTwoC, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid and the grid creator to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // The fluid system property template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoCTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index d97bba89..b30010a2 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -70,33 +70,33 @@ namespace Properties { // Create a new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFluidsystemTwoPTypeTag { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; +struct ExerciseFluidsystemTwoP { using InheritsFrom = std::tuple<BoxModel, TwoP>; }; } // end namespace TTag // Set the "Problem" property template<class TypeTag> -struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; +struct Problem<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = ExerciseFluidsystemProblemTwoP<TypeTag>; }; // Set the spatial parameters -SET_TYPE_PROP(ExerciseFluidsystemTwoPTypeTag, SpatialParams, +SET_TYPE_PROP(ExerciseFluidsystemTwoP, SpatialParams, ExerciseFluidsystemSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, GetPropType<TypeTag, Properties::Scalar>>); // Set grid to be used #if HAVE_DUNE_ALUGRID template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; }; #elif HAVE_UG template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::UGGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::UGGrid<2>; }; #else template<class TypeTag> -struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> { using type = Dune::YaspGrid<2>; }; +struct Grid<TypeTag, TTag::ExerciseFluidsystemTwoP> { using type = Dune::YaspGrid<2>; }; #endif // HAVE_DUNE_ALUGRID // we use the immiscible fluid system here template<class TypeTag> -struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoPTypeTag> +struct FluidSystem<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: using Scalar = GetPropType<TypeTag, Properties::Scalar>; diff --git a/exercises/solution/exercise-fluidsystem/CMakeLists.txt b/exercises/solution/exercise-fluidsystem/CMakeLists.txt index caccfb65..939a3433 100644 --- a/exercises/solution/exercise-fluidsystem/CMakeLists.txt +++ b/exercises/solution/exercise-fluidsystem/CMakeLists.txt @@ -2,13 +2,13 @@ #part a: 2pproblem dune_add_test(NAME exercise-fluidsystem_a_solution SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoP CMD_ARGS exercise-fluidsystem_a_solution.input) #part b: 2p2cproblem dune_add_test(NAME exercise-fluidsystem_b_solution SOURCES exercise-fluidsystem.cc - COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoCTypeTag + COMPILE_DEFINITIONS TYPETAG=ExerciseFluidsystemTwoPTwoC CMD_ARGS exercise-fluidsystem_b_solution.input) # add exercises to the common target diff --git a/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc b/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc index 723a640b..c90d22ab 100644 --- a/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc +++ b/exercises/solution/exercise-fluidsystem/exercise-fluidsystem.cc @@ -61,8 +61,8 @@ int main(int argc, char** argv) try // define the type tag for this problem // TYPETAG is set in CMakeLists.txt as compile time definition - // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTypeTag;` - // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTwoCTypeTag;` + // alternatively you could write `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoP;` + // then, for the 2p2c problem you have to change this line to `using TypeTag = Properties::TTag::ExerciseFluidsystemTwoPTwoC;` // and recompile the executable using TypeTag = Properties::TTag::TYPETAG; -- GitLab