12#ifndef DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
13#define DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
33template<
class Traits,
bool cachingEnabled = false>
44 using Problem =
typename Traits::Problem;
47 using VolumeVariables =
typename Traits::VolumeVariables;
50 static constexpr bool cachingEnabled =
true;
53 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
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);
73 const VolumeVariables& volVars(
const std::size_t scvIdx)
const
74 {
return volumeVariables_[scvIdx]; }
76 VolumeVariables& volVars(
const std::size_t scvIdx)
77 {
return volumeVariables_[scvIdx]; }
79 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
80 const VolumeVariables& volVars(
const SubControlVolume& scv)
const
81 {
return volumeVariables_[scv.dofIndex()]; }
83 template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value,
int> = 0>
84 VolumeVariables& volVars(
const SubControlVolume& scv)
85 {
return volumeVariables_[scv.dofIndex()]; }
88 const VolumeVariables& volVars(
const std::size_t scvIdx,
const std::size_t localIdx)
const
89 {
return volumeVariables_[scvIdx]; }
92 VolumeVariables& volVars(
const std::size_t scvIdx,
const std::size_t localIdx)
93 {
return volumeVariables_[scvIdx]; }
96 const Problem& problem()
const
97 {
return *problemPtr_; }
100 const Problem* problemPtr_;
101 std::vector<VolumeVariables> volumeVariables_;
106template<
class Traits>
109 using ThisType = CCGridVolumeVariables<Traits, false>;
113 using Problem =
typename Traits::Problem;
116 using VolumeVariables =
typename Traits::VolumeVariables;
119 static constexpr bool cachingEnabled =
false;
122 using LocalView =
typename Traits::template LocalView<ThisType, cachingEnabled>;
124 CCGridVolumeVariables(
const Problem& problem) : problemPtr_(&problem) {}
126 template<
class Gr
idGeometry,
class SolutionVector>
127 void update(
const GridGeometry& gridGeometry,
const SolutionVector& sol) {}
130 const Problem& problem()
const
131 {
return *problemPtr_;}
134 const Problem* problemPtr_;
The local element solution class for cell-centered methods.
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)