24#ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
25#define DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
38template<
class Gr
idFaceVariables,
bool cachingEnabled>
59 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
60 const FaceVariables& operator [](
const SubControlVolumeFace& scvf)
const
61 {
return gridFaceVariables().faceVars(scvf.index()); }
66 {
return gridFaceVariables().faceVars(scvfIdx); }
73 template<
class FVElementGeometry,
class SolutionVector>
75 const FVElementGeometry& fvGeometry,
76 const SolutionVector& sol) &&
78 this->bind_(element, fvGeometry, sol);
79 return std::move(*
this);
82 template<
class FVElementGeometry,
class SolutionVector>
83 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
84 const FVElementGeometry& fvGeometry,
85 const SolutionVector& sol) &
86 { this->bind_(element, fvGeometry, sol); }
93 template<
class FVElementGeometry,
class SolutionVector>
95 const FVElementGeometry& fvGeometry,
96 const SolutionVector& sol) &&
98 this->bindElement_(element, fvGeometry, sol);
99 return std::move(*
this);
102 template<
class FVElementGeometry,
class SolutionVector>
103 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
104 const FVElementGeometry& fvGeometry,
105 const SolutionVector& sol) &
106 { this->bindElement_(element, fvGeometry, sol); }
110 {
return *gridFaceVariablesPtr_; }
116 template<
class FVElementGeometry,
class SolutionVector>
117 void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
118 const FVElementGeometry& fvGeometry,
119 const SolutionVector& sol)
124 template<
class FVElementGeometry,
class SolutionVector>
125 void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
126 const FVElementGeometry& fvGeometry,
127 const SolutionVector& sol)
130 const GridFaceVariables* gridFaceVariablesPtr_;
150 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
152 {
return faceVariables_[scvf.localFaceIdx()]; }
156 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
159 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
161 {
return faceVariables_[scvf.localFaceIdx()]; }
165 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
172 template<
class FVElementGeometry,
class SolutionVector>
174 const FVElementGeometry& fvGeometry,
175 const SolutionVector& sol) &&
177 this->bind_(element, fvGeometry, sol);
178 return std::move(*
this);
181 template<
class FVElementGeometry,
class SolutionVector>
182 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
183 const FVElementGeometry& fvGeometry,
184 const SolutionVector& sol) &
185 { this->bind_(element, fvGeometry, sol); }
192 template<
class FVElementGeometry,
class SolutionVector>
194 const FVElementGeometry& fvGeometry,
195 const SolutionVector& sol) &&
197 this->bindElement_(element, fvGeometry, sol);
198 return std::move(*
this);
201 template<
class FVElementGeometry,
class SolutionVector>
202 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
203 const FVElementGeometry& fvGeometry,
204 const SolutionVector& sol) &
205 { this->bindElement_(element, fvGeometry, sol); }
209 {
return *gridFaceVariablesPtr_; }
215 template<
class FVElementGeometry,
class SolutionVector>
216 void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
217 const FVElementGeometry& fvGeometry,
218 const SolutionVector& sol)
220 faceVariables_.resize(fvGeometry.numScvf());
221 faceVarIndices_.resize(fvGeometry.numScvf());
223 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
225 for(
auto&& scvf : scvfs(fvGeometry))
227 faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], gridFaceVariables().problem(), element, fvGeometry, scvf);
228 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
234 template<
class FVElementGeometry,
class SolutionVector>
235 void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
236 const FVElementGeometry& fvGeometry,
237 const SolutionVector& sol)
239 faceVariables_.resize(fvGeometry.numScvf());
240 faceVarIndices_.resize(fvGeometry.numScvf());
242 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
244 for(
auto&& scvf : scvfs(fvGeometry))
246 faceVariables_[scvf.localFaceIdx()].updateOwnFaceOnly(sol[faceIdx][scvf.dofIndex()]);
247 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
251 int getLocalIdx_(
const int scvfIdx)
const
253 auto it = std::find(faceVarIndices_.begin(), faceVarIndices_.end(), scvfIdx);
254 assert(it != faceVarIndices_.end() &&
"Could not find the current face variables for scvfIdx!");
258 const GridFaceVariables* gridFaceVariablesPtr_;
259 std::vector<std::size_t> faceVarIndices_;
260 std::vector<FaceVariables> faceVariables_;
static ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:294
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Base class for the face variables vector.
Definition: elementfacevariables.hh:40
StaggeredElementFaceVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: elementfacevariables.hh:74
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:54
StaggeredElementFaceVariables(const GridFaceVariables &gridFaceVariables)
Definition: elementfacevariables.hh:56
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:103
StaggeredElementFaceVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: elementfacevariables.hh:94
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:109
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:51
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:83
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:202
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:182
StaggeredElementFaceVariables(const GridFaceVariables &globalFacesVars)
Definition: elementfacevariables.hh:147
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:145
StaggeredElementFaceVariables bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: elementfacevariables.hh:193
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:208
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:142
StaggeredElementFaceVariables bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: elementfacevariables.hh:173