24#ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
25#define DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
37template<
class Gr
idFaceVariables,
bool cachingEnabled>
58 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
59 const FaceVariables& operator [](
const SubControlVolumeFace& scvf)
const
60 {
return gridFaceVariables().faceVars(scvf.index()); }
65 {
return gridFaceVariables().faceVars(scvfIdx); }
70 template<
class FVElementGeometry,
class SolutionVector>
71 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
72 const FVElementGeometry& fvGeometry,
73 const SolutionVector& sol)
78 template<
class FVElementGeometry,
class SolutionVector>
79 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
80 const FVElementGeometry& fvGeometry,
81 const SolutionVector& sol)
87 {
return *gridFaceVariablesPtr_; }
91 const GridFaceVariables* gridFaceVariablesPtr_;
111 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
113 {
return faceVariables_[scvf.localFaceIdx()]; }
117 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
120 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
122 {
return faceVariables_[scvf.localFaceIdx()]; }
126 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
130 template<
class FVElementGeometry,
class SolutionVector>
131 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
132 const FVElementGeometry& fvGeometry,
133 const SolutionVector& sol)
135 faceVariables_.resize(fvGeometry.numScvf());
136 faceVarIndices_.resize(fvGeometry.numScvf());
138 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
140 for(
auto&& scvf : scvfs(fvGeometry))
142 faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], gridFaceVariables().problem(), element, fvGeometry, scvf);
143 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
149 template<
class FVElementGeometry,
class SolutionVector>
150 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
151 const FVElementGeometry& fvGeometry,
152 const SolutionVector& sol)
154 faceVariables_.resize(fvGeometry.numScvf());
155 faceVarIndices_.resize(fvGeometry.numScvf());
157 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
159 for(
auto&& scvf : scvfs(fvGeometry))
161 faceVariables_[scvf.localFaceIdx()].updateOwnFaceOnly(sol[faceIdx][scvf.dofIndex()]);
162 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
168 {
return *gridFaceVariablesPtr_; }
172 int getLocalIdx_(
const int scvfIdx)
const
174 auto it = std::find(faceVarIndices_.begin(), faceVarIndices_.end(), scvfIdx);
175 assert(it != faceVarIndices_.end() &&
"Could not find the current face variables for scvfIdx!");
179 const GridFaceVariables* gridFaceVariablesPtr_;
180 std::vector<std::size_t> faceVarIndices_;
181 std::vector<FaceVariables> faceVariables_;
ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: geometry/distance.hh:138
Base class for the face variables vector.
Definition: elementfacevariables.hh:39
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:53
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol)
Definition: elementfacevariables.hh:71
StaggeredElementFaceVariables(const GridFaceVariables &gridFaceVariables)
Definition: elementfacevariables.hh:55
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:86
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:50
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol)
Definition: elementfacevariables.hh:79
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol)
Definition: elementfacevariables.hh:131
StaggeredElementFaceVariables(const GridFaceVariables &globalFacesVars)
Definition: elementfacevariables.hh:108
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol)
Definition: elementfacevariables.hh:150
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:106
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:167
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:103