24#ifndef DUMUX_BOX_ELEMENT_SOLUTION_HH
25#define DUMUX_BOX_ELEMENT_SOLUTION_HH
28#include <dune/common/reservedvector.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;
44 static constexpr int dim = GridView::dimension;
45 static constexpr int numCubeCorners = 1 << dim;
55 template<
class SolutionVector>
57 const GridGeometry& gridGeometry)
59 update(element, sol, gridGeometry);
63 template<
class ElementVolumeVariables>
65 const FVElementGeometry& fvGeometry)
67 const auto numVert = element.subEntities(GridView::dimension);
68 priVars_.resize(numVert);
69 for (
const auto& scv : scvs(fvGeometry))
70 priVars_[scv.localDofIndex()] = elemVolVars[scv].priVars();
74 template<
class SolutionVector>
75 void update(
const Element& element,
const SolutionVector& sol,
76 const GridGeometry& gridGeometry)
78 const auto numVert = element.subEntities(GridView::dimension);
79 priVars_.resize(numVert);
80 for (
int vIdx = 0; vIdx < numVert; ++vIdx)
81 priVars_[vIdx] = sol[gridGeometry.vertexMapper().subIndex(element, vIdx, GridView::dimension)];
85 template<
class SolutionVector>
86 void update(
const Element& element,
const SolutionVector& sol,
87 const FVElementGeometry& fvGeometry)
89 const auto numVert = element.subEntities(GridView::dimension);
90 priVars_.resize(numVert);
91 for (
const auto& scv : scvs(fvGeometry))
92 priVars_[scv.localDofIndex()] = sol[scv.dofIndex()];
97 {
return priVars_.size(); }
100 template<
typename IndexType>
102 {
return priVars_[i]; }
105 template<
typename IndexType>
107 {
return priVars_[i]; }
110 Dune::ReservedVector<PrimaryVariables, numCubeCorners> priVars_;
117template<
class Element,
class SolutionVector,
class Gr
idGeometry>
118auto elementSolution(
const Element& element,
const SolutionVector& sol,
const GridGeometry& gg)
121 std::decay_t<decltype(std::declval<SolutionVector>()[0])>>
124 using PrimaryVariables = std::decay_t<decltype(std::declval<SolutionVector>()[0])>;
132template<
class Element,
class ElementVolumeVariables,
class FVElementGeometry>
133auto elementSolution(
const Element& element,
const ElementVolumeVariables& elemVolVars,
const FVElementGeometry& gg)
136 typename ElementVolumeVariables::VolumeVariables::PrimaryVariables>>
138 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==DiscretizationMethods::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:118
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
constexpr Box box
Definition: method.hh:136
The element solution vector.
Definition: box/elementsolution.hh:39
PV PrimaryVariables
export the primary variables type
Definition: box/elementsolution.hh:49
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:86
std::size_t size() const
return the size of the element solution
Definition: box/elementsolution.hh:96
BoxElementSolution(const Element &element, const ElementVolumeVariables &elemVolVars, const FVElementGeometry &fvGeometry)
Constructor with element and elemVolVars and fvGeometry.
Definition: box/elementsolution.hh:64
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:56
const PrimaryVariables & operator[](IndexType i) const
bracket operator const access
Definition: box/elementsolution.hh:101
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:75