12#ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
26template<
class Gr
idFaceVariables,
bool cachingEnabled>
47 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
48 const FaceVariables& operator [](
const SubControlVolumeFace& scvf)
const
49 {
return gridFaceVariables().faceVars(scvf.index()); }
54 {
return gridFaceVariables().faceVars(scvfIdx); }
61 template<
class FVElementGeometry,
class SolutionVector>
63 const FVElementGeometry& fvGeometry,
64 const SolutionVector& sol) &&
66 this->bind_(element, fvGeometry, sol);
67 return std::move(*
this);
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) &
74 { this->bind_(element, fvGeometry, sol); }
81 template<
class FVElementGeometry,
class SolutionVector>
83 const FVElementGeometry& fvGeometry,
84 const SolutionVector& sol) &&
86 this->bindElement_(element, fvGeometry, sol);
87 return std::move(*
this);
90 template<
class FVElementGeometry,
class SolutionVector>
91 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
92 const FVElementGeometry& fvGeometry,
93 const SolutionVector& sol) &
94 { this->bindElement_(element, fvGeometry, sol); }
98 {
return *gridFaceVariablesPtr_; }
104 template<
class FVElementGeometry,
class SolutionVector>
105 void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
106 const FVElementGeometry& fvGeometry,
107 const SolutionVector& sol)
112 template<
class FVElementGeometry,
class SolutionVector>
113 void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
114 const FVElementGeometry& fvGeometry,
115 const SolutionVector& sol)
118 const GridFaceVariables* gridFaceVariablesPtr_;
138 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
140 {
return faceVariables_[scvf.localFaceIdx()]; }
144 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
147 template<class SubControlVolumeFace, typename std::enable_if_t<!std::is_integral<SubControlVolumeFace>::value,
int> = 0>
149 {
return faceVariables_[scvf.localFaceIdx()]; }
153 {
return faceVariables_[getLocalIdx_(scvfIdx)]; }
160 template<
class FVElementGeometry,
class SolutionVector>
162 const FVElementGeometry& fvGeometry,
163 const SolutionVector& sol) &&
165 this->bind_(element, fvGeometry, sol);
166 return std::move(*
this);
169 template<
class FVElementGeometry,
class SolutionVector>
170 void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
171 const FVElementGeometry& fvGeometry,
172 const SolutionVector& sol) &
173 { this->bind_(element, fvGeometry, sol); }
180 template<
class FVElementGeometry,
class SolutionVector>
182 const FVElementGeometry& fvGeometry,
183 const SolutionVector& sol) &&
185 this->bindElement_(element, fvGeometry, sol);
186 return std::move(*
this);
189 template<
class FVElementGeometry,
class SolutionVector>
190 void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
191 const FVElementGeometry& fvGeometry,
192 const SolutionVector& sol) &
193 { this->bindElement_(element, fvGeometry, sol); }
197 {
return *gridFaceVariablesPtr_; }
203 template<
class FVElementGeometry,
class SolutionVector>
204 void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
205 const FVElementGeometry& fvGeometry,
206 const SolutionVector& sol)
208 faceVariables_.resize(fvGeometry.numScvf());
209 faceVarIndices_.resize(fvGeometry.numScvf());
211 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
213 for(
auto&& scvf : scvfs(fvGeometry))
215 faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], gridFaceVariables().problem(), element, fvGeometry, scvf);
216 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
222 template<
class FVElementGeometry,
class SolutionVector>
223 void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
224 const FVElementGeometry& fvGeometry,
225 const SolutionVector& sol)
227 faceVariables_.resize(fvGeometry.numScvf());
228 faceVarIndices_.resize(fvGeometry.numScvf());
230 constexpr auto faceIdx = FVElementGeometry::GridGeometry::faceIdx();
232 for(
auto&& scvf : scvfs(fvGeometry))
234 faceVariables_[scvf.localFaceIdx()].updateOwnFaceOnly(sol[faceIdx][scvf.dofIndex()]);
235 faceVarIndices_[scvf.localFaceIdx()] = scvf.index();
239 int getLocalIdx_(
const int scvfIdx)
const
241 auto it = std::find(faceVarIndices_.begin(), faceVarIndices_.end(), scvfIdx);
242 assert(it != faceVarIndices_.end() &&
"Could not find the current face variables for scvfIdx!");
246 const GridFaceVariables* gridFaceVariablesPtr_;
247 std::vector<std::size_t> faceVarIndices_;
248 std::vector<FaceVariables> faceVariables_;
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:190
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:170
StaggeredElementFaceVariables(const GridFaceVariables &globalFacesVars)
Definition: elementfacevariables.hh:135
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:133
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:181
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:196
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:130
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:161
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:62
typename GridFaceVariables::FaceVariables FaceVariables
export type of the volume variables
Definition: elementfacevariables.hh:42
StaggeredElementFaceVariables(const GridFaceVariables &gridFaceVariables)
Definition: elementfacevariables.hh:44
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:91
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:82
const GridFaceVariables & gridFaceVariables() const
The global volume variables object we are a restriction of.
Definition: elementfacevariables.hh:97
GFV GridFaceVariables
export type of the grid volume variables
Definition: elementfacevariables.hh:39
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const SolutionVector &sol) &
Definition: elementfacevariables.hh:71
Base class for the face variables vector.
Definition: elementfacevariables.hh:28
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:282