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>
55 using Problem =
typename Traits::Problem;
58 using VolumeVariables =
typename Traits::VolumeVariables;
61 static constexpr bool cachingEnabled =
true;
64 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
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);
83 const VolumeVariables& volVars(
const std::size_t scvIdx)
const
84 {
return volumeVariables_[scvIdx]; }
86 VolumeVariables& volVars(
const std::size_t scvIdx)
87 {
return volumeVariables_[scvIdx]; }
89 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
90 const VolumeVariables& volVars(
const SubControlVolume scv)
const
91 {
return volumeVariables_[scv.index()]; }
93 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
94 VolumeVariables& volVars(
const SubControlVolume scv)
95 {
return volumeVariables_[scv.index()]; }
98 const VolumeVariables& volVars(
const std::size_t scvIdx,
const std::size_t localIdx)
const
99 {
return volumeVariables_[scvIdx]; }
102 VolumeVariables& volVars(
const std::size_t scvIdx,
const std::size_t localIdx)
103 {
return volumeVariables_[scvIdx]; }
106 const Problem& problem()
const
107 {
return *problemPtr_; }
110 const Problem* problemPtr_;
111 std::vector<VolumeVariables> volumeVariables_;
116template<
class Traits>
119 using ThisType = FaceCenteredStaggeredGridVolumeVariables<Traits, false>;
123 using Problem =
typename Traits::Problem;
126 using VolumeVariables =
typename Traits::VolumeVariables;
129 static constexpr bool cachingEnabled =
false;
132 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
134 FaceCenteredStaggeredGridVolumeVariables(
const Problem& problem) : problemPtr_(&problem) {}
136 template<
class Gr
idGeometry,
class SolutionVector>
137 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
140 const Problem& problem()
const
141 {
return *problemPtr_;}
144 const Problem* problemPtr_;
Base class for the face variables vector.
Definition facecentered/staggered/elementvolumevariables.hh:29
Base class for the grid volume variables.
Definition facecentered/staggered/gridvolumevariables.hh:45
The global face variables class for staggered models.
Base class for the face variables vector.
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
FaceCenteredStaggeredElementVolumeVariables< GridVolumeVariables, cachingEnabled > LocalView
Definition facecentered/staggered/gridvolumevariables.hh:34