24#ifndef DUMUX_DISCRETIZATION_MPFA_DUALGRID_INDEX_SET_HH
25#define DUMUX_DISCRETIZATION_MPFA_DUALGRID_INDEX_SET_HH
31#include <dune/common/reservedvector.hh>
58 Dune::ReservedVector< T, 2 > >;
71 using LI =
typename T::LocalIndexType;
72 using GI =
typename T::GridIndexType;
74 using DimIndexVector = Dune::ReservedVector<LI, T::GridView::dimension>;
75 using ScvfIndicesInScvStorage =
typename T::template NodalScvDataStorage< DimIndexVector >;
97 template<
typename SubControlVolumeFace>
98 void insert(
const SubControlVolumeFace& scvf)
100 insert(scvf.index(), scvf.insideScvIdx(), scvf.boundary());
109 assert(std::count(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx ) == 0 &&
"scvf already inserted!");
115 if (boundary) numBoundaryScvfs_++;
118 scvfIndices_.push_back(scvfIdx);
119 scvfIsOnBoundary_.push_back(boundary);
122 auto it = std::find( scvIndices_.begin(), scvIndices_.end(), insideScvIdx );
123 if (it != scvIndices_.end())
125 const auto scvIdxLocal =
std::distance(scvIndices_.begin(), it);
126 scvfInsideScvIndices_.push_back(scvIdxLocal);
127 localScvfIndicesInScv_[scvIdxLocal].push_back(curScvfLocalIdx);
131 scvfInsideScvIndices_.push_back(scvIndices_.size());
132 localScvfIndicesInScv_.push_back({curScvfLocalIdx});
133 scvIndices_.push_back(insideScvIdx);
139 {
return scvIndices_.size(); }
143 {
return scvfIndices_.size(); }
147 {
return numBoundaryScvfs_; }
151 {
return scvIndices_; }
155 {
return scvfIndices_; }
161 return scvfIsOnBoundary_[i];
168 return scvIndices_[i];
175 return scvfIndices_[i];
182 assert(j < localScvfIndicesInScv_[i].size());
183 return scvfIndices_[ localScvfIndicesInScv_[i][j] ];
190 assert(j < localScvfIndicesInScv_[i].size());
191 return localScvfIndicesInScv_[i][j];
198 return scvfInsideScvIndices_[i];
203 ScvfIndicesInScvStorage localScvfIndicesInScv_;
205 std::size_t numBoundaryScvfs_;
207 typename T::template NodalScvfDataStorage< bool > scvfIsOnBoundary_;
208 typename T::template NodalScvfDataStorage< LI > scvfInsideScvIndices_;
228 template<
class Gr
idView >
230 : nodalIndexSets_(gridView.size(GridView::dimension))
234 template<
class SubControlVolumeFace >
236 {
return nodalIndexSets_[scvf.vertexIndex()]; }
238 template<
class SubControlVolumeFace >
240 {
return nodalIndexSets_[scvf.vertexIndex()]; }
244 {
return nodalIndexSets_[i]; }
247 {
return nodalIndexSets_[i]; }
250 std::vector<NodalIndexSet> nodalIndexSets_;
Defines the index types used for grid and local indices.
ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:138
Struture to define the index types used for grid and local indices.
Definition: indextraits.hh:38
Default traits to be used in conjuntion with the dual grid nodal index set.
Definition: dualgridindexset.hh:45
std::vector< T > NodalScvDataStorage
per default, we use dynamic data containers (iv size unknown)
Definition: dualgridindexset.hh:51
std::vector< T > NodalScvfDataStorage
Definition: dualgridindexset.hh:52
typename IndexTraits< GV >::LocalIndex LocalIndexType
Definition: dualgridindexset.hh:48
GV GridView
Definition: dualgridindexset.hh:46
typename IndexTraits< GV >::GridIndex GridIndexType
Definition: dualgridindexset.hh:47
typename std::conditional_t<(int(GV::dimension)< int(GV::dimensionworld)), std::vector< T >, Dune::ReservedVector< T, 2 > > ScvfNeighborDataStorage
store data on neighbors of scvfs in static containers if possible
Definition: dualgridindexset.hh:58
Nodal index set for mpfa schemes, constructed around grid vertices.
Definition: dualgridindexset.hh:70
T Traits
Export the traits type.
Definition: dualgridindexset.hh:79
GridIndexType gridScvIndex(unsigned int i) const
returns the grid scv idx of the i-th scv
Definition: dualgridindexset.hh:165
GridIndexType gridScvfIndex(unsigned int i) const
returns the index of the i-th scvf
Definition: dualgridindexset.hh:172
const NodalGridScvfStencilType & gridScvfIndices() const
returns the grid scvf indices connected to this dual grid node
Definition: dualgridindexset.hh:154
typename T::template NodalScvDataStorage< LI > NodalLocalStencilType
Definition: dualgridindexset.hh:87
void insert(const SubControlVolumeFace &scvf)
Inserts data for a given scvf.
Definition: dualgridindexset.hh:98
void insert(const GridIndexType scvfIdx, const GridIndexType insideScvIdx, const bool boundary)
Inserts scvf data.
Definition: dualgridindexset.hh:104
const NodalGridStencilType & gridScvIndices() const
returns the grid scv indices connected to this dual grid node
Definition: dualgridindexset.hh:150
CCMpfaDualGridNodalIndexSet()
Constructor.
Definition: dualgridindexset.hh:94
std::size_t numScvs() const
returns the number of scvs around the node
Definition: dualgridindexset.hh:138
typename T::template NodalScvfDataStorage< GI > NodalGridScvfStencilType
Definition: dualgridindexset.hh:88
typename T::template NodalScvDataStorage< GI > NodalGridStencilType
Export the stencil types used.
Definition: dualgridindexset.hh:86
bool scvfIsOnBoundary(unsigned int i) const
returns whether or not the i-th scvf is on a domain boundary
Definition: dualgridindexset.hh:158
std::size_t numScvfs() const
returns the number of scvfs around the node
Definition: dualgridindexset.hh:142
std::size_t numBoundaryScvfs() const
returns the number of boundary scvfs around the node
Definition: dualgridindexset.hh:146
typename T::template ScvfNeighborDataStorage< LI > ScvfNeighborLocalIndexSet
Data structure to store the neighboring scv indices of an scvf (grid/local indices)
Definition: dualgridindexset.hh:91
LI LocalIndexType
Export the index types used.
Definition: dualgridindexset.hh:82
GI GridIndexType
Definition: dualgridindexset.hh:83
LocalIndexType insideScvLocalIndex(unsigned int i) const
returns the node-local index of the inside scv of the i-th scvf
Definition: dualgridindexset.hh:195
GridIndexType gridScvfIndex(unsigned int i, unsigned int j) const
returns the grid index of the j-th scvf embedded in the i-th scv
Definition: dualgridindexset.hh:179
LocalIndexType localScvfIndex(unsigned int i, unsigned int j) const
returns the node-local index of the j-th scvf embedded in the i-th scv
Definition: dualgridindexset.hh:187
Class for the index sets of the dual grid in mpfa schemes.
Definition: dualgridindexset.hh:219
const NodalIndexSet & operator[](const SubControlVolumeFace &scvf) const
Access with an scvf.
Definition: dualgridindexset.hh:235
CCMpfaDualGridIndexSet()=delete
Default constructor should not be used.
CCMpfaDualGridIndexSet(const GridView &gridView)
Constructor taking a grid view.
Definition: dualgridindexset.hh:229
typename NodalIndexSet::GridIndexType GridIndexType
Definition: dualgridindexset.hh:222
NI NodalIndexSet
Definition: dualgridindexset.hh:221