24#ifndef DUMUX_BOX_ELEMENT_SOLUTION_HH
25#define DUMUX_BOX_ELEMENT_SOLUTION_HH
28#include <dune/istl/bvector.hh>
37template<
class FVElementGeometry,
class PV>
40 using GridGeometry =
typename FVElementGeometry::GridGeometry;
41 using GridView =
typename GridGeometry::GridView;
42 using Element =
typename GridView::template Codim<0>::Entity;
52 template<
class SolutionVector>
54 const GridGeometry& gridGeometry)
56 update(element, sol, gridGeometry);
60 template<
class ElementVolumeVariables>
62 const FVElementGeometry& fvGeometry)
64 const auto numVert = element.subEntities(GridView::dimension);
65 priVars_.resize(numVert);
66 for (
const auto& scv : scvs(fvGeometry))
67 priVars_[scv.localDofIndex()] = elemVolVars[scv].priVars();
71 template<
class SolutionVector>
72 void update(
const Element& element,
const SolutionVector& sol,
73 const GridGeometry& gridGeometry)
75 const auto numVert = element.subEntities(GridView::dimension);
76 priVars_.resize(numVert);
77 for (
int vIdx = 0; vIdx < numVert; ++vIdx)
78 priVars_[vIdx] = sol[gridGeometry.vertexMapper().subIndex(element, vIdx, GridView::dimension)];
82 template<
class SolutionVector>
83 void update(
const Element& element,
const SolutionVector& sol,
84 const FVElementGeometry& fvGeometry)
86 const auto numVert = element.subEntities(GridView::dimension);
87 priVars_.resize(numVert);
88 for (
const auto& scv : scvs(fvGeometry))
89 priVars_[scv.localDofIndex()] = sol[scv.dofIndex()];
94 {
return priVars_.size(); }
97 template<
typename IndexType>
99 {
return priVars_[i]; }
102 template<
typename IndexType>
104 {
return priVars_[i]; }
107 Dune::BlockVector<PrimaryVariables> priVars_;
114template<
class Element,
class SolutionVector,
class Gr
idGeometry>
115auto elementSolution(
const Element& element,
const SolutionVector& sol,
const GridGeometry& gg)
118 std::decay_t<decltype(std::declval<SolutionVector>()[0])>>
121 using PrimaryVariables = std::decay_t<decltype(std::declval<SolutionVector>()[0])>;
129template<
class Element,
class ElementVolumeVariables,
class FVElementGeometry>
130auto elementSolution(
const Element& element,
const ElementVolumeVariables& elemVolVars,
const FVElementGeometry& gg)
133 typename ElementVolumeVariables::VolumeVariables::PrimaryVariables>>
135 using PrimaryVariables =
typename ElementVolumeVariables::VolumeVariables::PrimaryVariables;
The available discretization methods in Dumux.
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
The element solution vector.
Definition: box/elementsolution.hh:39
PV PrimaryVariables
export the primary variables type
Definition: box/elementsolution.hh:46
void update(const Element &element, const SolutionVector &sol, const FVElementGeometry &fvGeometry)
extract the element solution from the solution vector using a local fv geometry
Definition: box/elementsolution.hh:83
std::size_t size() const
return the size of the element solution
Definition: box/elementsolution.hh:93
BoxElementSolution(const Element &element, const ElementVolumeVariables &elemVolVars, const FVElementGeometry &fvGeometry)
Constructor with element and elemVolVars and fvGeometry.
Definition: box/elementsolution.hh:61
BoxElementSolution()=default
Default constructor.
BoxElementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gridGeometry)
Constructor with element and solution and grid geometry.
Definition: box/elementsolution.hh:53
const PrimaryVariables & operator[](IndexType i) const
bracket operator const access
Definition: box/elementsolution.hh:98
void update(const Element &element, const SolutionVector &sol, const GridGeometry &gridGeometry)
extract the element solution from the solution vector using a mapper
Definition: box/elementsolution.hh:72