12#ifndef DUMUX_DISCRETIZATION_MPFA_O_GRIDINTERACTIONVOLUME_INDEXSETS_HH
13#define DUMUX_DISCRETIZATION_MPFA_O_GRIDINTERACTIONVOLUME_INDEXSETS_HH
30template<
class FVG,
class NI,
class PI,
class SI = PI>
33 using SubControlVolumeFace =
typename FVG::SubControlVolumeFace;
34 using PrimaryIVIndexSet =
typename PI::Traits::IndexSet;
35 using SecondaryIVIndexSet =
typename SI::Traits::IndexSet;
53 dualGridIndexSet_ = std::make_unique<DualGridIndexSet>(std::move(dualGridIdSet));
56 primaryIVIndexSets_.clear();
57 secondaryIVIndexSets_.clear();
58 scvfIndexMap_.clear();
63 for (
const auto& vertex : vertices(gridGeometry.gridView()))
65 const auto vIdxGlobal = gridGeometry.vertexMapper().index(vertex);
66 if (!gridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal))
67 numPrimaryIV_ += PrimaryInteractionVolume::numIVAtVertex((*dualGridIndexSet_)[vIdxGlobal]);
69 numSecondaryIV_ += SecondaryInteractionVolume::numIVAtVertex((*dualGridIndexSet_)[vIdxGlobal]);
73 primaryIVIndexSets_.reserve(numPrimaryIV_);
74 secondaryIVIndexSets_.reserve(numSecondaryIV_);
75 scvfIndexMap_.resize(gridGeometry.numScvf());
78 for (
const auto& vertex : vertices(gridGeometry.gridView()))
80 const auto vIdxGlobal = gridGeometry.vertexMapper().index(vertex);
81 if (!gridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal))
82 PrimaryInteractionVolume::addIVIndexSets(primaryIVIndexSets_,
84 (*dualGridIndexSet_)[vIdxGlobal],
85 gridGeometry.flipScvfIndexSet());
87 SecondaryInteractionVolume::addIVIndexSets(secondaryIVIndexSets_,
89 (*dualGridIndexSet_)[vIdxGlobal],
90 gridGeometry.flipScvfIndexSet());
100 {
return primaryIVIndexSets_[scvfIndexMap_[scvfIdx]]; }
108 {
return secondaryIVIndexSets_[scvfIndexMap_[scvfIdx]]; }
115 std::vector<PrimaryIVIndexSet> primaryIVIndexSets_;
116 std::vector<SecondaryIVIndexSet> secondaryIVIndexSets_;
117 std::vector<GridIndexType> scvfIndexMap_;
119 std::size_t numPrimaryIV_;
120 std::size_t numSecondaryIV_;
122 std::unique_ptr<DualGridIndexSet> dualGridIndexSet_;
Class for the index sets of the dual grid in mpfa schemes.
Definition: dualgridindexset.hh:207
Class that holds all interaction volume index sets on a grid view.
Definition: gridinteractionvolumeindexsets.hh:32
PI PrimaryInteractionVolume
Definition: gridinteractionvolumeindexsets.hh:39
typename NI::GridIndexType GridIndexType
Definition: gridinteractionvolumeindexsets.hh:42
const SecondaryIVIndexSet & secondaryIndexSet(const GridIndexType scvfIdx) const
Return the iv index set in which a given scvf (index) is embedded in.
Definition: gridinteractionvolumeindexsets.hh:107
std::size_t numSecondaryInteractionVolumes() const
Definition: gridinteractionvolumeindexsets.hh:112
void update(GridGeometry &gridGeometry, DualGridIndexSet &&dualGridIdSet)
Construct all interaction volume index sets on the grid view.
Definition: gridinteractionvolumeindexsets.hh:51
const PrimaryIVIndexSet & primaryIndexSet(const GridIndexType scvfIdx) const
Return the iv index set in which a given scvf (index) is embedded in.
Definition: gridinteractionvolumeindexsets.hh:99
SI SecondaryInteractionVolume
Definition: gridinteractionvolumeindexsets.hh:40
const SecondaryIVIndexSet & secondaryIndexSet(const SubControlVolumeFace &scvf) const
Return the iv index set in which a given scvf is embedded in.
Definition: gridinteractionvolumeindexsets.hh:103
const PrimaryIVIndexSet & primaryIndexSet(const SubControlVolumeFace &scvf) const
Return the iv index set in which a given scvf is embedded in.
Definition: gridinteractionvolumeindexsets.hh:95
FVG GridGeometry
Definition: gridinteractionvolumeindexsets.hh:38
std::size_t numPrimaryInteractionVolumes() const
Returns number of primary/secondary interaction volumes on the grid view.
Definition: gridinteractionvolumeindexsets.hh:111
Class for the index sets of the dual grid in mpfa schemes.