52    , numScv_(
gridVolVars.problem().gridGeometry().numScv())
 
 
   56    template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, 
int> = 0>
 
   59        if (scv.dofIndex() < numScv_)
 
   62            return boundaryVolumeVariables_[getLocalIdx_(scv.dofIndex())];
 
 
   72            return boundaryVolumeVariables_[getLocalIdx_(scvIdx)];
 
 
   80    template<
class FVElementGeometry, 
class SolutionVector>
 
   82                                         const FVElementGeometry& fvGeometry,
 
   83                                         const SolutionVector& sol) &&
 
   85        this->bind_(element, fvGeometry, sol);
 
   86        return std::move(*
this);
 
 
   89    template<
class FVElementGeometry, 
class SolutionVector>
 
   90    void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
   91              const FVElementGeometry& fvGeometry,
 
   92              const SolutionVector& sol) &
 
   93    { this->bind_(element, fvGeometry, sol); }
 
 
  100    template<
class FVElementGeometry, 
class SolutionVector>
 
  102                                                const FVElementGeometry& fvGeometry,
 
  103                                                const SolutionVector& sol) &&
 
  105        this->bindElement_(element, fvGeometry, sol);
 
  106        return std::move(*
this);
 
 
  109    template<
class FVElementGeometry, 
class SolutionVector>
 
  110    void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  111                     const FVElementGeometry& fvGeometry,
 
  112                     const SolutionVector& sol) &
 
  113    { this->bindElement_(element, fvGeometry, sol); }
 
 
  117    { 
return *gridVolVarsPtr_; }
 
 
  124        boundaryVolVarIndices_.clear();
 
  125        boundaryVolumeVariables_.clear();
 
  130    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  131    void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  132               const FVElementGeometry& fvGeometry,
 
  133               const SolutionVector& sol)
 
  136        bind_(element, fvGeometry, sol[FVElementGeometry::GridGeometry::cellCenterIdx()]);
 
  141    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<!isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  142    void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  143               const FVElementGeometry& fvGeometry,
 
  144               const SolutionVector& sol)
 
  146        if (!fvGeometry.hasBoundaryScvf())
 
  150        boundaryVolVarIndices_.reserve(fvGeometry.numScvf());
 
  151        boundaryVolumeVariables_.reserve(fvGeometry.numScvf());
 
  154        for (
auto&& scvf : scvfs(fvGeometry))
 
  157            if (!scvf.boundary())
 
  160            const auto& problem = gridVolVars().problem();
 
  161            auto boundaryPriVars = gridVolVars().getBoundaryPriVars(problem, sol, element, scvf);
 
  163            auto&& scvI = fvGeometry.scv(scvf.insideScvIdx());
 
  165            VolumeVariables volVars;
 
  166            volVars.update(elemSol,
 
  171           boundaryVolumeVariables_.emplace_back(std::move(volVars));
 
  172           boundaryVolVarIndices_.push_back(scvf.outsideScvIdx());
 
  177    template<
class FVElementGeometry, 
class SolutionVector>
 
  178    void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  179                      const FVElementGeometry& fvGeometry,
 
  180                      const SolutionVector& sol)
 
  183    const GridVolumeVariables* gridVolVarsPtr_;
 
  186    int getLocalIdx_(
const int volVarIdx)
 const 
  188        auto it = std::find(boundaryVolVarIndices_.begin(), boundaryVolVarIndices_.end(), volVarIdx);
 
  189        assert(it != boundaryVolVarIndices_.end() && 
"Could not find the current volume variables for volVarIdx!");
 
  190        return std::distance(boundaryVolVarIndices_.begin(), it);
 
  193    std::vector<std::size_t> boundaryVolVarIndices_;
 
  194    std::vector<VolumeVariables> boundaryVolumeVariables_;
 
  195    const std::size_t numScv_;
 
 
  207    using PrimaryVariables = 
typename GVV::VolumeVariables::PrimaryVariables;
 
  225    template<
class FVElementGeometry, 
class SolutionVector>
 
  227                                         const FVElementGeometry& fvGeometry,
 
  228                                         const SolutionVector& sol) &&
 
  230        this->bind_(element, fvGeometry, sol);
 
  231        return std::move(*
this);
 
 
  234    template<
class FVElementGeometry, 
class SolutionVector>
 
  235    void bind(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  236              const FVElementGeometry& fvGeometry,
 
  237              const SolutionVector& sol) &
 
  238    { this->bind_(element, fvGeometry, sol); }
 
 
  245    template<
class FVElementGeometry, 
class SolutionVector>
 
  247                                                const FVElementGeometry& fvGeometry,
 
  248                                                const SolutionVector& sol) &&
 
  250        this->bindElement_(element, fvGeometry, sol);
 
  251        return std::move(*
this);
 
 
  254    template<
class FVElementGeometry, 
class SolutionVector>
 
  255    void bindElement(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  256                     const FVElementGeometry& fvGeometry,
 
  257                     const SolutionVector& sol) &
 
  258    { this->bindElement_(element, fvGeometry, sol); }
 
 
  261    template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, 
int> = 0>
 
  263    { 
return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
 
  266    template<class SubControlVolume, typename std::enable_if_t<!std::is_integral<SubControlVolume>::value, 
int> = 0>
 
  268    { 
return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
 
  272    { 
return volumeVariables_[getLocalIdx_(scvIdx)]; }
 
 
  276    { 
return volumeVariables_[getLocalIdx_(scvIdx)]; }
 
 
  280    { 
return *gridVolVarsPtr_; }
 
 
  285    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  286    void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  287               const FVElementGeometry& fvGeometry,
 
  288               const SolutionVector& sol)
 
  291        bind_(element, fvGeometry, sol[FVElementGeometry::GridGeometry::cellCenterIdx()]);
 
  296    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<!isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  297    void bind_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  298               const FVElementGeometry& fvGeometry,
 
  299               const SolutionVector& sol)
 
  303        const auto& problem = gridVolVars().problem();
 
  304        const auto& gridGeometry = fvGeometry.gridGeometry();
 
  305        const auto globalI = gridGeometry.elementMapper().index(element);
 
  306        const auto& map = gridGeometry.connectivityMap();
 
  307        constexpr auto cellCenterIdx = FVElementGeometry::GridGeometry::cellCenterIdx();
 
  308        const auto& connectivityMapI = map(cellCenterIdx, cellCenterIdx, globalI);
 
  309        const auto numDofs = connectivityMapI.size();
 
  311        auto&& scvI = fvGeometry.scv(globalI);
 
  314        volumeVariables_.resize(numDofs+1);
 
  315        volVarIndices_.resize(numDofs+1);
 
  319        auto doVolVarUpdate = [&](
int globalJ)
 
  321            const auto& elementJ = gridGeometry.element(globalJ);
 
  322            auto&& scvJ = fvGeometry.scv(globalJ);
 
  324            volumeVariables_[localIdx].update(elemSol,
 
  328            volVarIndices_[localIdx] = scvJ.dofIndex();
 
  333        doVolVarUpdate(globalI);
 
  336        for (
const auto& globalJ : connectivityMapI)
 
  337            doVolVarUpdate(globalJ);
 
  339        if (fvGeometry.hasBoundaryScvf())
 
  342            for (
auto&& scvf : scvfs(fvGeometry))
 
  345                if (!scvf.boundary())
 
  348                volumeVariables_.resize(localIdx+1);
 
  349                volVarIndices_.resize(localIdx+1);
 
  351                auto boundaryPriVars = gridVolVars().getBoundaryPriVars(problem, sol, element, scvf);
 
  353                volumeVariables_[localIdx].update(elemSol,
 
  357                volVarIndices_[localIdx] = scvf.outsideScvIdx();
 
  365    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  366    void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  367                      const FVElementGeometry& fvGeometry,
 
  368                      const SolutionVector& sol)
 
  371        bindElement_(element, fvGeometry, sol[FVElementGeometry::GridGeometry::cellCenterIdx()]);
 
  376    template<class FVElementGeometry, class SolutionVector, typename std::enable_if_t<!isMultiTypeBlockVector<SolutionVector>::value, 
int> = 0>
 
  377    void bindElement_(
const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
 
  378                      const FVElementGeometry& fvGeometry,
 
  379                      const SolutionVector& sol)
 
  383        const auto globalI = fvGeometry.gridGeometry().elementMapper().index(element);
 
  384        volumeVariables_.resize(1);
 
  385        volVarIndices_.resize(1);
 
  388        auto&& scv = fvGeometry.scv(globalI);
 
  391        volumeVariables_[0].update(elemSol,
 
  392                                   gridVolVars().problem(),
 
  395        volVarIndices_[0] = scv.dofIndex();
 
  401        volVarIndices_.clear();
 
  402        volumeVariables_.clear();
 
  405    const GridVolumeVariables* gridVolVarsPtr_;
 
  407    int getLocalIdx_(
const int volVarIdx)
 const 
  409        auto it = std::find(volVarIndices_.begin(), volVarIndices_.end(), volVarIdx);
 
  410        assert(it != volVarIndices_.end() && 
"Could not find the current volume variables for volVarIdx!");
 
  411        return std::distance(volVarIndices_.begin(), it);
 
  414    std::vector<std::size_t> volVarIndices_;
 
  415    std::vector<VolumeVariables> volumeVariables_;
 
 
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