Commit e0018206 authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'feature/numeqvector' into 'master'

Feature/numeqvector

See merge request !2510
parents af447f70 3837760f
......@@ -28,6 +28,7 @@ intersectionmapper.hh
loggingparametertree.hh
math.hh
monotonecubicspline.hh
numeqvector.hh
numericdifferentiation.hh
optionalscalar.hh
parameters.hh
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup Common
* \brief A helper to deduce a vector with the same size as numbers of equations
*/
#ifndef DUMUX_COMMON_NUMEQVECTOR_HH
#define DUMUX_COMMON_NUMEQVECTOR_HH
namespace Dumux {
template<class PrimaryVariables>
struct NumEqVectorTraits
{
static constexpr std::size_t numEq = PrimaryVariables::size();
using type = PrimaryVariables;
};
/*!
* \ingroup Common
* \brief A vector with the same size as numbers of equations
* This is the default implementation and has to be specialized for
* all custom primary variable vector types
* \note This is based on the primary variables concept
*/
template<class PrimaryVariables>
using NumEqVector = typename NumEqVectorTraits<PrimaryVariables>::type;
} // namespace Dumux
#endif
......@@ -26,6 +26,7 @@
#define DUMUX_SWITCHABLE_PRIMARY_VARIABLES_HH
#include <dune/common/exceptions.hh>
#include <dumux/common/numeqvector.hh>
namespace Dumux {
......@@ -73,6 +74,17 @@ private:
bool stateIsSet_{false};
};
/*!
* \ingroup PorousmediumflowModels
* \brief The corresponding NumEqVectorTraits for the primary variables with switchable state
*/
template<class PrimaryVariables, class StateType>
struct NumEqVectorTraits<SwitchablePrimaryVariables<PrimaryVariables, StateType>>
{
static constexpr std::size_t numEq = PrimaryVariables::size();
using type = PrimaryVariables;
};
} // end namespace Dumux
#endif
......@@ -32,6 +32,7 @@
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/numeqvector.hh>
#include <dumux/discretization/elementsolution.hh>
#include <dumux/porousmediumflow/problem.hh>
......@@ -64,7 +65,7 @@ class TubesTestProblem : public PorousMediumFlowProblem<TypeTag>
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
using Element = typename GridView::template Codim<0>::Entity;
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
......
......@@ -28,6 +28,7 @@
#include <dune/grid/yaspgrid.hh>
#include <dumux/common/boundarytypes.hh>
#include <dumux/common/numeqvector.hh>
#include <dumux/discretization/cellcentered/mpfa/omethod/staticinteractionvolume.hh>
#include <dumux/discretization/ccmpfa.hh>
......@@ -178,7 +179,7 @@ class InjectionProblem : public PorousMediumFlowProblem<TypeTag>
};
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
......
Markdown is supported
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