12#ifndef DUMUX_DISCRETIZATION_FACECENTERED_GRID_VOLUMEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_FACECENTERED_GRID_VOLUMEVARIABLES_HH
27template<
class P,
class VV>
33 template<
class Gr
idVolumeVariables,
bool cachingEnabled>
44template<
class Traits,
bool cachingEnabled = false>
61 static constexpr bool cachingEnabled =
true;
68 template<
class Gr
idGeometry,
class SolutionVector>
69 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol)
71 volumeVariables_.resize(gridGeometry.numScv());
72 Dumux::parallelFor(gridGeometry.gridView().size(0), [&, &problem = problem()](
const std::size_t eIdx)
74 const auto element = gridGeometry.element(eIdx);
75 const auto fvGeometry =
localView(gridGeometry).bindElement(element);
78 for (
const auto& scv : scvs(fvGeometry))
79 volumeVariables_[scv.index()].update(elemSol, problem, element, scv);
84 {
return volumeVariables_[scvIdx]; }
87 {
return volumeVariables_[scvIdx]; }
89 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
91 {
return volumeVariables_[scv.index()]; }
93 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
95 {
return volumeVariables_[scv.index()]; }
99 {
return volumeVariables_[scvIdx]; }
103 {
return volumeVariables_[scvIdx]; }
107 {
return *problemPtr_; }
110 const Problem* problemPtr_;
111 std::vector<VolumeVariables> volumeVariables_;
116template<
class Traits>
129 static constexpr bool cachingEnabled =
false;
136 template<
class Gr
idGeometry,
class SolutionVector>
137 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
141 {
return *problemPtr_;}
144 const Problem* problemPtr_;
Base class for the face variables vector.
Definition: facecentered/staggered/elementvolumevariables.hh:29
Specialization when the current volume variables are not stored globally.
Definition: facecentered/staggered/gridvolumevariables.hh:118
FaceCenteredStaggeredGridVolumeVariables(const Problem &problem)
Definition: facecentered/staggered/gridvolumevariables.hh:134
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: facecentered/staggered/gridvolumevariables.hh:126
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: facecentered/staggered/gridvolumevariables.hh:132
typename Traits::Problem Problem
export the problem type
Definition: facecentered/staggered/gridvolumevariables.hh:123
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: facecentered/staggered/gridvolumevariables.hh:137
const Problem & problem() const
The problem we are solving.
Definition: facecentered/staggered/gridvolumevariables.hh:140
specialization in case of storing the volume variables
Definition: facecentered/staggered/gridvolumevariables.hh:50
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: facecentered/staggered/gridvolumevariables.hh:69
FaceCenteredStaggeredGridVolumeVariables(const Problem &problem)
Definition: facecentered/staggered/gridvolumevariables.hh:66
VolumeVariables & volVars(const std::size_t scvIdx, const std::size_t localIdx)
Definition: facecentered/staggered/gridvolumevariables.hh:102
const VolumeVariables & volVars(const std::size_t scvIdx) const
Definition: facecentered/staggered/gridvolumevariables.hh:83
typename Traits::Problem Problem
export the problem type
Definition: facecentered/staggered/gridvolumevariables.hh:55
const VolumeVariables & volVars(const SubControlVolume scv) const
Definition: facecentered/staggered/gridvolumevariables.hh:90
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: facecentered/staggered/gridvolumevariables.hh:58
VolumeVariables & volVars(const SubControlVolume scv)
Definition: facecentered/staggered/gridvolumevariables.hh:94
VolumeVariables & volVars(const std::size_t scvIdx)
Definition: facecentered/staggered/gridvolumevariables.hh:86
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: facecentered/staggered/gridvolumevariables.hh:64
const Problem & problem() const
The problem we are solving.
Definition: facecentered/staggered/gridvolumevariables.hh:106
const VolumeVariables & volVars(const std::size_t scvIdx, const std::size_t localIdx) const
Definition: facecentered/staggered/gridvolumevariables.hh:98
Base class for the grid volume variables.
Definition: facecentered/staggered/gridvolumevariables.hh:45
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: facecentered/staggered/gridvolumevariables.hh:29
P Problem
Definition: facecentered/staggered/gridvolumevariables.hh:30
VV VolumeVariables
Definition: facecentered/staggered/gridvolumevariables.hh:31