12#ifndef DUMUX_DISCRETIZATION_CVFE_GRID_VOLUMEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_CVFE_GRID_VOLUMEVARIABLES_HH
20#include <dumux/common/concepts/localdofs_.hh>
29template<
class P,
class VV>
35 template<
class Gr
idVolumeVariables,
bool cachingEnabled>
43template<
class Traits,
bool enableCaching>
70 template<
class Gr
idGeometry,
class SolutionVector>
71 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol)
73 volumeVariables_.resize(gridGeometry.gridView().size(0));
76 const auto element = gridGeometry.element(eIdx);
77 const auto fvGeometry =
localView(gridGeometry).bindElement(element);
83 volumeVariables_[eIdx].resize(fvGeometry.numScv());
84 for (
const auto& scv :
scvs(fvGeometry))
85 volumeVariables_[eIdx][scv.indexInElement()].update(elemSol,
problem, element, scv);
89 template<class ScvOrLocalDof, typename std::enable_if_t<!std::is_integral<ScvOrLocalDof>::value,
int> = 0>
92 if constexpr (Concept::LocalDof<ScvOrLocalDof>)
93 return volumeVariables_[scvOrLocalDof.elementIndex()][scvOrLocalDof.index()];
95 return volumeVariables_[scvOrLocalDof.elementIndex()][scvOrLocalDof.indexInElement()];
98 template<class ScvOrLocalDof, typename std::enable_if_t<!std::is_integral<ScvOrLocalDof>::value,
int> = 0>
101 if constexpr (Concept::LocalDof<ScvOrLocalDof>)
102 return volumeVariables_[scvOrLocalDof.elementIndex()][scvOrLocalDof.index()];
104 return volumeVariables_[scvOrLocalDof.elementIndex()][scvOrLocalDof.indexInElement()];
108 {
return volumeVariables_[eIdx][scvIdx]; }
111 {
return volumeVariables_[eIdx][scvIdx]; }
114 {
return *problemPtr_; }
117 const Problem* problemPtr_;
118 std::vector<std::vector<VolumeVariables>> volumeVariables_;
123template<
class Traits>
146 template<
class Gr
idGeometry,
class SolutionVector>
147 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
150 {
return *problemPtr_;}
153 const Problem* problemPtr_;
The local (stencil) volume variables class for control-volume finite element.
Definition cvfe/elementvolumevariables.hh:32
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition cvfe/gridvolumevariables.hh:147
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition cvfe/gridvolumevariables.hh:133
typename Traits::Problem Problem
export the problem type
Definition cvfe/gridvolumevariables.hh:130
CVFEGridVolumeVariables(const Problem &problem)
Definition cvfe/gridvolumevariables.hh:144
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition cvfe/gridvolumevariables.hh:139
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition cvfe/gridvolumevariables.hh:136
const Problem & problem() const
Definition cvfe/gridvolumevariables.hh:149
LocalView::MutableView MutableLocalView
export the type of the mutable local view
Definition cvfe/gridvolumevariables.hh:142
CVFEGridVolumeVariables(const Problem &problem)
Definition cvfe/gridvolumevariables.hh:68
const VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx) const
Definition cvfe/gridvolumevariables.hh:107
VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx)
Definition cvfe/gridvolumevariables.hh:110
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition cvfe/gridvolumevariables.hh:57
const VolumeVariables & volVars(const ScvOrLocalDof &scvOrLocalDof) const
Definition cvfe/gridvolumevariables.hh:90
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition cvfe/gridvolumevariables.hh:60
const Problem & problem() const
Definition cvfe/gridvolumevariables.hh:113
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition cvfe/gridvolumevariables.hh:71
typename Traits::Problem Problem
export the problem type
Definition cvfe/gridvolumevariables.hh:54
VolumeVariables & volVars(const ScvOrLocalDof &scvOrLocalDof)
Definition cvfe/gridvolumevariables.hh:99
LocalView::MutableView MutableLocalView
export the type of the mutable local view
Definition cvfe/gridvolumevariables.hh:66
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition cvfe/gridvolumevariables.hh:63
Base class for the grid volume variables.
Definition cvfe/gridvolumevariables.hh:44
The local element solution class for control-volume finite element methods.
The local volume variables class.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:26
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::cctpfa||GridGeometry::discMethod==DiscretizationMethods::ccmpfa, CCElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for cell-centered schemes.
Definition cellcentered/elementsolution.hh:101
void parallelFor(const std::size_t count, const FunctorType &functor)
A parallel for loop (multithreading).
Definition parallel_for.hh:160
Free function to get the local view of a grid cache object.
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
Parallel for loop (multithreading).
Definition cvfe/gridvolumevariables.hh:31
VolumeVariables VolumeVariables
Definition cvfe/gridvolumevariables.hh:33
Problem Problem
Definition cvfe/gridvolumevariables.hh:32
CVFEElementVolumeVariables< GridVolumeVariables, cachingEnabled > LocalView
Definition cvfe/gridvolumevariables.hh:36