Commit d060df58 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[discretization] Remove DiscretizationMethods property. Use aliases.

The DiscretizationMethods property is substituted by an enum
listing all the available methods. Using aliases to simplify
specializations of the method-specific classes.

(cherry picked from commit bf2d9555d79e428bc476bd7cab38d46d3547334e)
parent c638c7dc
......@@ -33,6 +33,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/implicit/properties.hh>
#include <dumux/discretization/methods.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
......@@ -50,7 +51,7 @@ NEW_PROP_TAG(ProblemEnableGravity);
* \brief Specialization of Darcy's Law for the box method.
*/
template <class TypeTag>
class DarcysLaw<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::Box>::type >
class DarcysLawImplementation<TypeTag, DiscretizationMethods::Box>
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
......
......@@ -30,7 +30,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/implicit/properties.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
......@@ -48,7 +48,7 @@ NEW_PROP_TAG(EffectiveDiffusivityModel);
* \brief Specialization of Fick's Law for the box method.
*/
template <class TypeTag>
class FicksLaw<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::Box>::type >
class FicksLawImplementation<TypeTag, DiscretizationMethods::Box>
{
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
......
......@@ -33,8 +33,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/implicit/properties.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
......@@ -50,7 +49,7 @@ NEW_PROP_TAG(ProblemEnableGravity);
* \brief Specialization of Darcy's Law for the CCTpfa method.
*/
template <class TypeTag>
class DarcysLaw<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::CCTpfa>::type >
class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
......
......@@ -30,7 +30,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/implicit/properties.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
......@@ -48,7 +48,7 @@ NEW_PROP_TAG(EffectiveDiffusivityModel);
* \brief Specialization of Fick's Law for the CCTpfa method.
*/
template <class TypeTag>
class FicksLaw<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::CCTpfa>::type >
class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa >
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
......
......@@ -27,6 +27,10 @@
namespace Dumux
{
// forward declaration
template <class TypeTag, int Method>
class DarcysLawImplementation
{};
/*!
* \ingroup DarcysLaw
......@@ -35,9 +39,8 @@ namespace Dumux
* for the different discretization methods. These specializations
* are found in the headers included below.
*/
template <class TypeTag, typename DiscretizationMethod = void>
class DarcysLaw
{};
template <class TypeTag>
using DarcysLaw = DarcysLawImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>;
} // end namespace
......
......@@ -24,15 +24,21 @@
#ifndef DUMUX_DISCRETIZATION_FICKS_LAW_HH
#define DUMUX_DISCRETIZATION_FICKS_LAW_HH
#include <dumux/discretization/methods.hh>
namespace Dumux
{
// forward declaration
template <class TypeTag, DiscretizationMethods Method>
class FicksLawImplementation
{};
/*!
* \ingroup CCTpfaFicksLaw
* \brief Evaluates the diffusive mass flux according to Fick's law
*/
template <class TypeTag, typename DiscretizationMethod = void>
class FicksLaw
{};
template <class TypeTag>
using FicksLaw = FicksLawImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>;
} // end namespace
......
......@@ -37,6 +37,7 @@
#include <dumux/discretization/box/fvelementgeometry.hh>
#include <dumux/discretization/box/stencils.hh>
#include <dumux/porousmediumflow/implicit/fluxvariablescache.hh>
#include <dumux/discretization/methods.hh>
#include "elementboundarytypes.hh"
#include "localresidual.hh"
......@@ -56,7 +57,10 @@ template<class TypeTag> class BoxStencilsVector;
namespace Properties {
//! Set the corresponding discretization method property
SET_INT_PROP(BoxModel, DiscretizationMethod, GET_PROP(TypeTag, DiscretizationMethods)::Box);
SET_PROP(BoxModel, DiscretizationMethod)
{
static const DiscretizationMethods value = DiscretizationMethods::Box;
};
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(BoxModel, GlobalFVGeometry, BoxGlobalFVGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFVGeometryCache)>);
......
......@@ -33,6 +33,7 @@
#include <dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh>
#include <dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh>
#include <dumux/implicit/cellcentered/properties.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux {
......@@ -41,7 +42,10 @@ template<class TypeTag> class CCElementBoundaryTypes;
namespace Properties {
//! Set the corresponding discretization method property
SET_INT_PROP(CCTpfaModel, DiscretizationMethod, GET_PROP(TypeTag, DiscretizationMethods)::CCTpfa);
SET_PROP(CCTpfaModel, DiscretizationMethod)
{
static const DiscretizationMethods value = DiscretizationMethods::CCTpfa;
};
//! Set the default for the global finite volume geometry
SET_TYPE_PROP(CCTpfaModel, GlobalFVGeometry, CCTpfaGlobalFVGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFVGeometryCache)>);
......
......@@ -83,8 +83,6 @@ NEW_PROP_TAG(ElementFluxVariablesCache); //!< A local vector of flux variable ca
NEW_PROP_TAG(EnableGlobalFluxVariablesCache); //! specifies if data on flux vars should be saved (faster, but more memory consuming)
NEW_PROP_TAG(BoundaryVariables); //!< Data required to calculate fluxes over boundary faces in cc models(outflow)
NEW_PROP_TAG(ConstantBoundaryConditions); //!< boundary data is stored in case the BC are constant
NEW_PROP_TAG(DiscretizationMethods); //!< Contains all the available discretization methods
NEW_PROP_TAG(DiscretizationMethod); //!< Property for the used discretization method
// Specify the forms of fluxes that should be considered in the model
......
......@@ -58,20 +58,6 @@ namespace Properties {
// Some defaults for very fundamental properties
//////////////////////////////////////////////////////////////////
//! All the available discretization methods
SET_PROP(ImplicitBase, DiscretizationMethods)
{
// Box-Method
static const int Box = 0;
// CC-Tpfa Method
static const int CCTpfa = 1;
// TODO: implement the other methods
// CC-NLTPFA?
// static const int CCNlTpfa = 2;
// CC-MPFA
// static const int CCMpfa = 3;
};
//! Set the default type for the time manager
SET_TYPE_PROP(ImplicitBase, TimeManager, TimeManager<TypeTag>);
......
......@@ -25,21 +25,26 @@
#include <dumux/implicit/properties.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
// forward declaration
template<class TypeTag, DiscretizationMethods Method>
class PorousMediumFluxVariablesCacheImplementation
{};
/*!
* \ingroup ImplicitModel
* \brief The flux variables cache classes for porous media.
* Store flux stencils and data required for flux calculation
*/
template<class TypeTag, typename DiscretizationMethod = void>
class PorousMediumFluxVariablesCache {};
template<class TypeTag>
using PorousMediumFluxVariablesCache = PorousMediumFluxVariablesCacheImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>;
// specialization for the Box Method
template<class TypeTag>
class PorousMediumFluxVariablesCache<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::Box>::type >
class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::Box>
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
......@@ -107,7 +112,7 @@ private:
// specialization for the cell centered tpfa method
template<class TypeTag>
class PorousMediumFluxVariablesCache<TypeTag, typename std::enable_if<GET_PROP_VALUE(TypeTag, DiscretizationMethod) == GET_PROP(TypeTag, DiscretizationMethods)::CCTpfa>::type >
class PorousMediumFluxVariablesCacheImplementation<TypeTag, DiscretizationMethods::CCTpfa>
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment