diff --git a/dumux/discretization/fvgridvariables.hh b/dumux/discretization/fvgridvariables.hh index cda91b42673ba74314c0fbc4ab2021c5659f49e5..f606089e3210fcb93d928bde931a3e3f435e9dca 100644 --- a/dumux/discretization/fvgridvariables.hh +++ b/dumux/discretization/fvgridvariables.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_FV_GRID_VARIABLES_HH #define DUMUX_FV_GRID_VARIABLES_HH +#include <type_traits> #include <memory> namespace Dumux { @@ -35,13 +36,31 @@ namespace Dumux { * \tparam the type of the grid volume variables * \tparam the type of the grid flux variables cache */ -template<class FVGridGeometry, class GridVolumeVariables, class GridFluxVariablesCache> +template<class GG, class GVV, class GFVC> class FVGridVariables { public: + //! export type of the finite volume grid geometry + using GridGeometry = GG; + + //! export type of the finite volume grid geometry + using GridVolumeVariables = GVV; + + //! export type of the volume variables + using VolumeVariables = typename GridVolumeVariables::VolumeVariables; + + //! export primary variable type + using PrimaryVariables = typename VolumeVariables::PrimaryVariables; + + //! export scalar type (TODO get it directly from the volvars) + using Scalar = std::decay_t<decltype(std::declval<PrimaryVariables>()[0])>; + + //! export type of the finite volume grid geometry + using GridFluxVariablesCache = GFVC; + template<class Problem> FVGridVariables(std::shared_ptr<Problem> problem, - std::shared_ptr<FVGridGeometry> fvGridGeometry) + std::shared_ptr<GridGeometry> fvGridGeometry) : fvGridGeometry_(fvGridGeometry) , curGridVolVars_(*problem) , prevGridVolVars_(*problem) @@ -130,7 +149,7 @@ public: protected: - std::shared_ptr<const FVGridGeometry> fvGridGeometry_; //!< pointer to the constant grid geometry + std::shared_ptr<const GridGeometry> fvGridGeometry_; //!< pointer to the constant grid geometry private: GridVolumeVariables curGridVolVars_; //!< the current volume variables (primary and secondary variables) diff --git a/dumux/porousmediumflow/nonequilibrium/gridvariables.hh b/dumux/porousmediumflow/nonequilibrium/gridvariables.hh index 269866951fddc3835c6307ebb63c81ef744e6745..9e619befea78503939de09484a620df6d0097088 100644 --- a/dumux/porousmediumflow/nonequilibrium/gridvariables.hh +++ b/dumux/porousmediumflow/nonequilibrium/gridvariables.hh @@ -47,7 +47,6 @@ class NonEquilibriumGridVariables typename GET_PROP_TYPE(TypeTag, GridVolumeVariables), typename GET_PROP_TYPE(TypeTag, GridFluxVariablesCache)>; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GridView = typename FVGridGeometry::GridView; @@ -60,16 +59,17 @@ class NonEquilibriumGridVariables static constexpr bool isBox = FVGridGeometry::discMethod == DiscretizationMethod::box; public: + //! export the type used for scalar values + using typename ParentType::Scalar; + //! Constructor NonEquilibriumGridVariables(std::shared_ptr<Problem> problem, std::shared_ptr<FVGridGeometry> fvGridGeometry) : ParentType(problem, fvGridGeometry) , problem_(problem) { - for (int phaseIdx =0; phaseIdx<numPhases; ++phaseIdx) - { + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) velocityNorm_[phaseIdx].assign(fvGridGeometry->numDofs(), 0.0); - } } template<class SolutionVector> @@ -95,7 +95,6 @@ public: auto elemVolVars = localView(this->curGridVolVars()); fvGeometry.bind(element); - elemVolVars.bind(element, fvGeometry, curSol); for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)