12#ifndef DUMUX_DISCRETIZATION_CVFE_GRID_VOLUMEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_CVFE_GRID_VOLUMEVARIABLES_HH
27template<
class P,
class VV>
33 template<
class Gr
idVolumeVariables,
bool cachingEnabled>
41template<
class Traits,
bool enableCaching>
58 static constexpr bool cachingEnabled =
true;
65 template<
class Gr
idGeometry,
class SolutionVector>
66 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol)
68 volumeVariables_.resize(gridGeometry.gridView().size(0));
69 Dumux::parallelFor(gridGeometry.gridView().size(0), [&, &problem = problem()](
const std::size_t eIdx)
71 const auto element = gridGeometry.element(eIdx);
72 const auto fvGeometry =
localView(gridGeometry).bindElement(element);
78 volumeVariables_[eIdx].resize(fvGeometry.numScv());
79 for (
const auto& scv : scvs(fvGeometry))
80 volumeVariables_[eIdx][scv.indexInElement()].update(elemSol, problem, element, scv);
84 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
86 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
88 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
90 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
93 {
return volumeVariables_[eIdx][scvIdx]; }
96 {
return volumeVariables_[eIdx][scvIdx]; }
99 {
return *problemPtr_; }
102 const Problem* problemPtr_;
103 std::vector<std::vector<VolumeVariables>> volumeVariables_;
108template<
class Traits>
121 static constexpr bool cachingEnabled =
false;
128 template<
class Gr
idGeometry,
class SolutionVector>
129 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
132 {
return *problemPtr_;}
135 const Problem* problemPtr_;
The local (stencil) volume variables class for control-volume finite element.
Definition: cvfe/elementvolumevariables.hh:31
Definition: cvfe/gridvolumevariables.hh:110
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: cvfe/gridvolumevariables.hh:129
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: cvfe/gridvolumevariables.hh:118
typename Traits::Problem Problem
export the problem type
Definition: cvfe/gridvolumevariables.hh:115
CVFEGridVolumeVariables(const Problem &problem)
Definition: cvfe/gridvolumevariables.hh:126
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: cvfe/gridvolumevariables.hh:124
const Problem & problem() const
Definition: cvfe/gridvolumevariables.hh:131
Definition: cvfe/gridvolumevariables.hh:47
CVFEGridVolumeVariables(const Problem &problem)
Definition: cvfe/gridvolumevariables.hh:63
const VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx) const
Definition: cvfe/gridvolumevariables.hh:92
VolumeVariables & volVars(const std::size_t eIdx, const std::size_t scvIdx)
Definition: cvfe/gridvolumevariables.hh:95
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: cvfe/gridvolumevariables.hh:55
const Problem & problem() const
Definition: cvfe/gridvolumevariables.hh:98
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: cvfe/gridvolumevariables.hh:66
typename Traits::Problem Problem
export the problem type
Definition: cvfe/gridvolumevariables.hh:52
const VolumeVariables & volVars(const SubControlVolume &scv) const
Definition: cvfe/gridvolumevariables.hh:85
VolumeVariables & volVars(const SubControlVolume &scv)
Definition: cvfe/gridvolumevariables.hh:89
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: cvfe/gridvolumevariables.hh:61
Base class for the grid volume variables.
Definition: cvfe/gridvolumevariables.hh:42
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.
Parallel for loop (multithreading)
Definition: cvfe/gridvolumevariables.hh:29
VV VolumeVariables
Definition: cvfe/gridvolumevariables.hh:31
P Problem
Definition: cvfe/gridvolumevariables.hh:30