26#ifndef DUMUX_COMMON_VARIABLES_BACKEND_HH
27#define DUMUX_COMMON_VARIABLES_BACKEND_HH
33#include <dune/common/indices.hh>
34#include <dune/common/typetraits.hh>
35#include <dune/common/hybridutilities.hh>
36#include <dune/common/std/type_traits.hh>
37#include <dune/istl/bvector.hh>
42template<
class... Args>
53template<class DofVector, bool isScalar = Dune::IsNumber<DofVector>::value>
102 {
DofVector d; d.resize(size);
return d; }
113template<
class... Blocks>
117 static constexpr auto numBlocks = DV::size();
119 using VectorSizeInfo = std::array<std::size_t, numBlocks>;
128 VectorSizeInfo result;
129 using namespace Dune::Hybrid;
130 forEach(std::make_index_sequence<numBlocks>{}, [&](
auto i) {
131 result[i] = d[Dune::index_constant<i>{}].size();
140 using namespace Dune::Hybrid;
141 forEach(std::make_index_sequence<numBlocks>{}, [&](
auto i) {
142 result[Dune::index_constant<i>{}].resize(size[i]);
148 template<class Scalar, std::enable_if_t< Dune::IsNumber<Scalar>::value,
int> = 0>
158template<
class Vars,
bool varsExportSolution>
175 using typename ParentType::DofVector;
198:
public DofBackend<typename Vars::SolutionVector>
typename Vars::SolutionVector SolutionVectorType
Definition: variablesbackend.hh:156
Definition: common/pdesolver.hh:36
Definition: variablesbackend.hh:43
Class providing operations with primary variable vectors.
Definition: variablesbackend.hh:54
static void axpy(Scalar a, const DofVector &x, DofVector &y)
Perform axpy operation (y += a * x)
Definition: variablesbackend.hh:76
static SizeType size(const DofVector &d)
Return the number of entries in the dof vector.
Definition: variablesbackend.hh:68
static DofVector zeros(SizeType size)
Make a zero-initialized dof vector instance.
Definition: variablesbackend.hh:72
std::size_t SizeType
Definition: variablesbackend.hh:65
Scalar DofVector
the type of the dofs parametrizing the variables object
Definition: variablesbackend.hh:64
static SizeType size(const DofVector &d)
Return the number of entries in the dof vector.
Definition: variablesbackend.hh:97
std::size_t SizeType
Definition: variablesbackend.hh:94
Vector DofVector
the type of the dofs parametrizing the variables object
Definition: variablesbackend.hh:93
static DofVector zeros(SizeType size)
Make a zero-initialized dof vector instance.
Definition: variablesbackend.hh:101
static void axpy(typename DofVector::field_type a, const DofVector &x, DofVector &y)
Perform axpy operation (y += a * x)
Definition: variablesbackend.hh:105
static SizeType size(const DofVector &d)
Return the number of entries in the sub-dof-vectors.
Definition: variablesbackend.hh:126
static void axpy(Scalar a, const DofVector &x, DofVector &y)
Perform axpy operation (y += a * x)
Definition: variablesbackend.hh:149
VectorSizeInfo SizeType
Definition: variablesbackend.hh:123
static DofVector zeros(const SizeType &size)
Make a zero-initialized dof vector instance.
Definition: variablesbackend.hh:137
Definition: variablesbackend.hh:159
static void update(Variables &v, const DofVector &dofs)
update to new solution vector
Definition: variablesbackend.hh:178
Vars Variables
Definition: variablesbackend.hh:174
static const DofVector & dofs(const Variables &v)
return const reference to dof vector
Definition: variablesbackend.hh:182
static DofVector & dofs(Variables &v)
return reference to dof vector
Definition: variablesbackend.hh:186
static void update(Variables &v, const DofVector &dofs)
update to new solution vector
Definition: variablesbackend.hh:205
Vars Variables
the type of the variables object
Definition: variablesbackend.hh:202
static DofVector & dofs(Variables &v)
return reference to dof vector
Definition: variablesbackend.hh:213
static const DofVector & dofs(const Variables &v)
return const reference to dof vector
Definition: variablesbackend.hh:209
typename Vars::SolutionVector DofVector
Definition: variablesbackend.hh:201