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>
52 using Problem =
typename Traits::Problem;
55 using VolumeVariables =
typename Traits::VolumeVariables;
58 static constexpr bool cachingEnabled =
true;
61 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
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>
85 const VolumeVariables& volVars(
const SubControlVolume& scv)
const
86 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
88 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
89 VolumeVariables& volVars(
const SubControlVolume& scv)
90 {
return volumeVariables_[scv.elementIndex()][scv.indexInElement()]; }
92 const VolumeVariables& volVars(
const std::size_t eIdx,
const std::size_t scvIdx)
const
93 {
return volumeVariables_[eIdx][scvIdx]; }
95 VolumeVariables& volVars(
const std::size_t eIdx,
const std::size_t scvIdx)
96 {
return volumeVariables_[eIdx][scvIdx]; }
98 const Problem& problem()
const
99 {
return *problemPtr_; }
102 const Problem* problemPtr_;
103 std::vector<std::vector<VolumeVariables>> volumeVariables_;
108template<
class Traits>
111 using ThisType = CVFEGridVolumeVariables<Traits, false>;
115 using Problem =
typename Traits::Problem;
118 using VolumeVariables =
typename Traits::VolumeVariables;
121 static constexpr bool cachingEnabled =
false;
124 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
126 CVFEGridVolumeVariables(
const Problem& problem) : problemPtr_(&problem) {}
128 template<
class Gr
idGeometry,
class SolutionVector>
129 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
131 const Problem& problem()
const
132 {
return *problemPtr_;}
135 const Problem* problemPtr_;
The local (stencil) volume variables class for control-volume finite element.
Definition cvfe/elementvolumevariables.hh:31
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
VolumeVariables VolumeVariables
Definition cvfe/gridvolumevariables.hh:31
Problem Problem
Definition cvfe/gridvolumevariables.hh:30
CVFEElementVolumeVariables< GridVolumeVariables, cachingEnabled > LocalView
Definition cvfe/gridvolumevariables.hh:34