Commit 3e4b42cc authored by Timo Koch's avatar Timo Koch
Browse files

[spatialparams] Enforce new fluidMatrixInteraction interface

parent 7902acae
......@@ -33,20 +33,19 @@ namespace Dumux {
#ifndef DOXYGEN
namespace Detail {
// helper struct detecting if the user-defined spatial params class has a materialLawParamsAtPos function
// for g++ > 5.3, this can be replaced by a lambda
// helper struct detecting if the user-defined spatial params class
// has a fluidMatrixInteractionAtPos function
template<class GlobalPosition>
struct hasMaterialLawParamsAtPos
struct hasFluidMatrixInteractionAtPos
{
template<class SpatialParams>
auto operator()(const SpatialParams& a)
-> decltype(a.materialLawParamsAtPos(std::declval<GlobalPosition>()))
-> decltype(a.fluidMatrixInteractionAtPos(std::declval<GlobalPosition>()))
{}
};
} // end namespace Detail
#endif
/*!
* \ingroup SpatialParameters
* \brief The base class for spatial parameters of multi-phase problems
......@@ -68,40 +67,28 @@ public:
: ParentType(gridGeometry)
{}
// make sure we get a deprecation warning (remove this after release 3.3)
template<class ElementSolution>
[[deprecated("Use the new style material laws. Old material laws and this interface will no longer be supported after release 3.3")]]
decltype(auto) materialLawParamsDeprecated(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{
return this->asImp_().materialLawParams(element, scv, elemSol);
}
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-sw, pc-sw, etc.).
*
* \param element The current element
* \param scv The sub-control volume inside the element.
* \param elemSol The solution at the dofs connected to the element.
* \return the material parameters object
*/
template<class ElementSolution>
[[deprecated("Use the new style material laws. Old material laws and this interface will no longer be supported after release 3.3")]]
decltype(auto) materialLawParams(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
decltype(auto) fluidMatrixInteraction(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{
static_assert(decltype(isValid(Detail::hasMaterialLawParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
static_assert(decltype(isValid(Detail::hasFluidMatrixInteractionAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
" Your spatial params class has to either implement\n\n"
" const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition& globalPos) const\n\n"
" auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const\n\n"
" or overload this function\n\n"
" template<class ElementSolution>\n"
" const MaterialLawParams& materialLawParams(const Element& element,\n"
" const SubControlVolume& scv,\n"
" const ElementSolution& elemSol) const\n\n");
" auto fluidMatrixInteraction(const Element& element,\n"
" const SubControlVolume& scv,\n"
" const ElementSolution& elemSol) const\n\n");
return this->asImp_().materialLawParamsAtPos(scv.center());
return this->asImp_().fluidMatrixInteractionAtPos(scv.center());
}
/*!
......
......@@ -29,9 +29,6 @@
#include "sequentialfv1p.hh"
namespace Dumux {
namespace Properties
{ template<class TypeTag, class MyTypeTag>
struct MaterialLaw { using type = UndefinedProperty; }; }
/*!
* \ingroup SpatialParameters
......@@ -56,20 +53,8 @@ class SequentialFVSpatialParams: public SequentialFVSpatialParamsOneP<TypeTag>
public:
SequentialFVSpatialParams(const Problem& problem)
:SequentialFVSpatialParamsOneP<TypeTag>(problem)
{
}
// make sure we get a deprecation warning (remove this after release 3.3)
template<class ElementSolution, class SubControlVolume>
[[deprecated("Use the new style material laws. Old material laws and this interface will no longer be supported after release 3.3")]]
decltype(auto) materialLawParamsDeprecated(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{
return this->asImp_().materialLawParams(element);
}
: SequentialFVSpatialParamsOneP<TypeTag>(problem)
{}
/*!
* \brief Function for defining the parameters needed by constitutive relationships (kr-sw, pc-sw, etc.).
......@@ -77,9 +62,9 @@ public:
* \return the material parameters object
* \param element The element
*/
const auto& materialLawParams(const Element &element) const
auto fluidMatrixInteraction(const Element &element) const
{
return asImp_().materialLawParamsAtPos(element.geometry().center());
return asImp_().fluidMatrixInteractionAtPos(element.geometry().center());
}
/*!
......@@ -88,11 +73,11 @@ public:
* \return the material parameters object
* \param globalPos The position of the center of the element
*/
const auto& materialLawParamsAtPos(const GlobalPosition& globalPos) const
auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
{
DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide "
"a materialLawParamsAtPos() method.");
"a fluidMatrixInteractionAtPos() method.");
}
private:
......
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