24#ifndef DUMUX_DISCRETIZATION_MPFA_O_GRIDINTERACTIONVOLUME_INDEXSETS_HH
25#define DUMUX_DISCRETIZATION_MPFA_O_GRIDINTERACTIONVOLUME_INDEXSETS_HH
42template<
class FVG,
class NI,
class PI,
class SI = PI>
45 using SubControlVolumeFace =
typename FVG::SubControlVolumeFace;
46 using PrimaryIVIndexSet =
typename PI::Traits::IndexSet;
47 using SecondaryIVIndexSet =
typename SI::Traits::IndexSet;
65 dualGridIndexSet_ = std::make_unique<DualGridIndexSet>(std::move(dualGridIdSet));
68 primaryIVIndexSets_.clear();
69 secondaryIVIndexSets_.clear();
70 scvfIndexMap_.clear();
75 for (
const auto& vertex : vertices(gridGeometry.gridView()))
77 const auto vIdxGlobal = gridGeometry.vertexMapper().index(vertex);
78 if (!gridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal))
79 numPrimaryIV_ += PrimaryInteractionVolume::numIVAtVertex((*dualGridIndexSet_)[vIdxGlobal]);
81 numSecondaryIV_ += SecondaryInteractionVolume::numIVAtVertex((*dualGridIndexSet_)[vIdxGlobal]);
85 primaryIVIndexSets_.reserve(numPrimaryIV_);
86 secondaryIVIndexSets_.reserve(numSecondaryIV_);
87 scvfIndexMap_.resize(gridGeometry.numScvf());
90 for (
const auto& vertex : vertices(gridGeometry.gridView()))
92 const auto vIdxGlobal = gridGeometry.vertexMapper().index(vertex);
93 if (!gridGeometry.vertexUsesSecondaryInteractionVolume(vIdxGlobal))
94 PrimaryInteractionVolume::addIVIndexSets(primaryIVIndexSets_,
96 (*dualGridIndexSet_)[vIdxGlobal],
97 gridGeometry.flipScvfIndexSet());
99 SecondaryInteractionVolume::addIVIndexSets(secondaryIVIndexSets_,
101 (*dualGridIndexSet_)[vIdxGlobal],
102 gridGeometry.flipScvfIndexSet());
112 {
return primaryIVIndexSets_[scvfIndexMap_[scvfIdx]]; }
120 {
return secondaryIVIndexSets_[scvfIndexMap_[scvfIdx]]; }
127 std::vector<PrimaryIVIndexSet> primaryIVIndexSets_;
128 std::vector<SecondaryIVIndexSet> secondaryIVIndexSets_;
129 std::vector<GridIndexType> scvfIndexMap_;
131 std::size_t numPrimaryIV_;
132 std::size_t numSecondaryIV_;
134 std::unique_ptr<DualGridIndexSet> dualGridIndexSet_;
Class for the index sets of the dual grid in mpfa schemes.
Class for the index sets of the dual grid in mpfa schemes.
Definition: dualgridindexset.hh:219
Class that holds all interaction volume index sets on a grid view.
Definition: gridinteractionvolumeindexsets.hh:44
PI PrimaryInteractionVolume
Definition: gridinteractionvolumeindexsets.hh:51
typename NI::GridIndexType GridIndexType
Definition: gridinteractionvolumeindexsets.hh:54
const SecondaryIVIndexSet & secondaryIndexSet(const GridIndexType scvfIdx) const
Return the iv index set in which a given scvf (index) is embedded in.
Definition: gridinteractionvolumeindexsets.hh:119
std::size_t numSecondaryInteractionVolumes() const
Definition: gridinteractionvolumeindexsets.hh:124
void update(GridGeometry &gridGeometry, DualGridIndexSet &&dualGridIdSet)
Construct all interaction volume index sets on the grid view.
Definition: gridinteractionvolumeindexsets.hh:63
const PrimaryIVIndexSet & primaryIndexSet(const GridIndexType scvfIdx) const
Return the iv index set in which a given scvf (index) is embedded in.
Definition: gridinteractionvolumeindexsets.hh:111
SI SecondaryInteractionVolume
Definition: gridinteractionvolumeindexsets.hh:52
const SecondaryIVIndexSet & secondaryIndexSet(const SubControlVolumeFace &scvf) const
Return the iv index set in which a given scvf is embedded in.
Definition: gridinteractionvolumeindexsets.hh:115
const PrimaryIVIndexSet & primaryIndexSet(const SubControlVolumeFace &scvf) const
Return the iv index set in which a given scvf is embedded in.
Definition: gridinteractionvolumeindexsets.hh:107
FVG GridGeometry
Definition: gridinteractionvolumeindexsets.hh:50
std::size_t numPrimaryInteractionVolumes() const
Returns number of primary/secondary interaction volumes on the grid view.
Definition: gridinteractionvolumeindexsets.hh:123