12#ifndef DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
33template<
class Traits,
bool cachingEnabled = false>
50 static constexpr bool cachingEnabled =
true;
57 template<
class Gr
idGeometry,
class SolutionVector>
58 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol)
60 volumeVariables_.resize(gridGeometry.numScv());
61 Dumux::parallelFor(gridGeometry.gridView().size(0), [&, &problem = problem()](
const std::size_t eIdx)
63 const auto element = gridGeometry.element(eIdx);
64 const auto fvGeometry =
localView(gridGeometry).bindElement(element);
65 for (
const auto& scv : scvs(fvGeometry))
68 volumeVariables_[scv.dofIndex()].update(elemSol, problem, element, scv);
74 {
return volumeVariables_[scvIdx]; }
77 {
return volumeVariables_[scvIdx]; }
79 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
81 {
return volumeVariables_[scv.dofIndex()]; }
83 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
85 {
return volumeVariables_[scv.dofIndex()]; }
89 {
return volumeVariables_[scvIdx]; }
93 {
return volumeVariables_[scvIdx]; }
97 {
return *problemPtr_; }
100 const Problem* problemPtr_;
101 std::vector<VolumeVariables> volumeVariables_;
106template<
class Traits>
119 static constexpr bool cachingEnabled =
false;
126 template<
class Gr
idGeometry,
class SolutionVector>
127 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
131 {
return *problemPtr_;}
134 const Problem* problemPtr_;
The local element solution class for cell-centered methods.
Specialization when the current volume variables are not stored globally.
Definition: cellcentered/gridvolumevariables.hh:108
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: cellcentered/gridvolumevariables.hh:116
CCGridVolumeVariables(const Problem &problem)
Definition: cellcentered/gridvolumevariables.hh:124
typename Traits::Problem Problem
export the problem type
Definition: cellcentered/gridvolumevariables.hh:113
const Problem & problem() const
The problem we are solving.
Definition: cellcentered/gridvolumevariables.hh:130
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: cellcentered/gridvolumevariables.hh:127
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: cellcentered/gridvolumevariables.hh:122
specialization in case of storing the volume variables
Definition: cellcentered/gridvolumevariables.hh:39
void update(const GridGeometry &gridGeometry, const SolutionVector &sol)
Definition: cellcentered/gridvolumevariables.hh:58
VolumeVariables & volVars(const std::size_t scvIdx)
Definition: cellcentered/gridvolumevariables.hh:76
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: cellcentered/gridvolumevariables.hh:53
VolumeVariables & volVars(const SubControlVolume &scv)
Definition: cellcentered/gridvolumevariables.hh:84
const Problem & problem() const
The problem we are solving.
Definition: cellcentered/gridvolumevariables.hh:96
const VolumeVariables & volVars(const std::size_t scvIdx, const std::size_t localIdx) const
Definition: cellcentered/gridvolumevariables.hh:88
const VolumeVariables & volVars(const std::size_t scvIdx) const
Definition: cellcentered/gridvolumevariables.hh:73
typename Traits::Problem Problem
export the problem type
Definition: cellcentered/gridvolumevariables.hh:44
const VolumeVariables & volVars(const SubControlVolume &scv) const
Definition: cellcentered/gridvolumevariables.hh:80
typename Traits::VolumeVariables VolumeVariables
export the volume variables type
Definition: cellcentered/gridvolumevariables.hh:47
CCGridVolumeVariables(const Problem &problem)
Definition: cellcentered/gridvolumevariables.hh:55
VolumeVariables & volVars(const std::size_t scvIdx, const std::size_t localIdx)
Definition: cellcentered/gridvolumevariables.hh:92
Base class for the grid volume variables.
Definition: cellcentered/gridvolumevariables.hh:34
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)