12#ifndef DUMUX_DISCRETIZATION_MPFA_DUALGRID_INDEX_SET_HH
13#define DUMUX_DISCRETIZATION_MPFA_DUALGRID_INDEX_SET_HH
19#include <dune/common/reservedvector.hh>
46 Dune::ReservedVector< T, 2 > >;
59 using LI =
typename T::LocalIndexType;
60 using GI =
typename T::GridIndexType;
62 using DimIndexVector = Dune::ReservedVector<LI, T::GridView::dimension>;
63 using ScvfIndicesInScvStorage =
typename T::template NodalScvDataStorage< DimIndexVector >;
85 template<
typename SubControlVolumeFace>
86 void insert(
const SubControlVolumeFace& scvf)
88 insert(scvf.index(), scvf.insideScvIdx(), scvf.boundary());
97 assert(std::count(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx ) == 0 &&
"scvf already inserted!");
103 if (boundary) numBoundaryScvfs_++;
106 scvfIndices_.push_back(scvfIdx);
107 scvfIsOnBoundary_.push_back(boundary);
110 auto it = std::find( scvIndices_.begin(), scvIndices_.end(), insideScvIdx );
111 if (it != scvIndices_.end())
113 const auto scvIdxLocal =
std::distance(scvIndices_.begin(), it);
114 scvfInsideScvIndices_.push_back(scvIdxLocal);
115 localScvfIndicesInScv_[scvIdxLocal].push_back(curScvfLocalIdx);
119 scvfInsideScvIndices_.push_back(scvIndices_.size());
120 localScvfIndicesInScv_.push_back({curScvfLocalIdx});
121 scvIndices_.push_back(insideScvIdx);
127 {
return scvIndices_.size(); }
131 {
return scvfIndices_.size(); }
135 {
return numBoundaryScvfs_; }
139 {
return scvIndices_; }
143 {
return scvfIndices_; }
149 return scvfIsOnBoundary_[i];
156 return scvIndices_[i];
163 return scvfIndices_[i];
170 assert(j < localScvfIndicesInScv_[i].size());
171 return scvfIndices_[ localScvfIndicesInScv_[i][j] ];
178 assert(j < localScvfIndicesInScv_[i].size());
179 return localScvfIndicesInScv_[i][j];
186 return scvfInsideScvIndices_[i];
191 ScvfIndicesInScvStorage localScvfIndicesInScv_;
193 std::size_t numBoundaryScvfs_;
195 typename T::template NodalScvfDataStorage< bool > scvfIsOnBoundary_;
196 typename T::template NodalScvfDataStorage< LI > scvfInsideScvIndices_;
216 template<
class Gr
idView >
218 : nodalIndexSets_(gridView.size(GridView::dimension))
222 template<
class SubControlVolumeFace >
224 {
return nodalIndexSets_[scvf.vertexIndex()]; }
226 template<
class SubControlVolumeFace >
228 {
return nodalIndexSets_[scvf.vertexIndex()]; }
232 {
return nodalIndexSets_[i]; }
235 {
return nodalIndexSets_[i]; }
238 std::vector<NodalIndexSet> nodalIndexSets_;
Class for the index sets of the dual grid in mpfa schemes.
Definition: dualgridindexset.hh:207
const NodalIndexSet & operator[](const SubControlVolumeFace &scvf) const
Access with an scvf.
Definition: dualgridindexset.hh:223
CCMpfaDualGridIndexSet()=delete
Default constructor should not be used.
CCMpfaDualGridIndexSet(const GridView &gridView)
Constructor taking a grid view.
Definition: dualgridindexset.hh:217
typename NodalIndexSet::GridIndexType GridIndexType
Definition: dualgridindexset.hh:210
NI NodalIndexSet
Definition: dualgridindexset.hh:209
Nodal index set for mpfa schemes, constructed around grid vertices.
Definition: dualgridindexset.hh:58
T Traits
Export the traits type.
Definition: dualgridindexset.hh:67
GridIndexType gridScvIndex(unsigned int i) const
returns the grid scv idx of the i-th scv
Definition: dualgridindexset.hh:153
GridIndexType gridScvfIndex(unsigned int i) const
returns the index of the i-th scvf
Definition: dualgridindexset.hh:160
const NodalGridScvfStencilType & gridScvfIndices() const
returns the grid scvf indices connected to this dual grid node
Definition: dualgridindexset.hh:142
typename T::template NodalScvDataStorage< LI > NodalLocalStencilType
Definition: dualgridindexset.hh:75
void insert(const SubControlVolumeFace &scvf)
Inserts data for a given scvf.
Definition: dualgridindexset.hh:86
void insert(const GridIndexType scvfIdx, const GridIndexType insideScvIdx, const bool boundary)
Inserts scvf data.
Definition: dualgridindexset.hh:92
const NodalGridStencilType & gridScvIndices() const
returns the grid scv indices connected to this dual grid node
Definition: dualgridindexset.hh:138
CCMpfaDualGridNodalIndexSet()
Constructor.
Definition: dualgridindexset.hh:82
std::size_t numScvs() const
returns the number of scvs around the node
Definition: dualgridindexset.hh:126
typename T::template NodalScvfDataStorage< GI > NodalGridScvfStencilType
Definition: dualgridindexset.hh:76
typename T::template NodalScvDataStorage< GI > NodalGridStencilType
Export the stencil types used.
Definition: dualgridindexset.hh:74
bool scvfIsOnBoundary(unsigned int i) const
returns whether or not the i-th scvf is on a domain boundary
Definition: dualgridindexset.hh:146
std::size_t numScvfs() const
returns the number of scvfs around the node
Definition: dualgridindexset.hh:130
std::size_t numBoundaryScvfs() const
returns the number of boundary scvfs around the node
Definition: dualgridindexset.hh:134
typename T::template ScvfNeighborDataStorage< LI > ScvfNeighborLocalIndexSet
Data structure to store the neighboring scv indices of an scvf (grid/local indices)
Definition: dualgridindexset.hh:79
LI LocalIndexType
Export the index types used.
Definition: dualgridindexset.hh:70
GI GridIndexType
Definition: dualgridindexset.hh:71
LocalIndexType insideScvLocalIndex(unsigned int i) const
returns the node-local index of the inside scv of the i-th scvf
Definition: dualgridindexset.hh:183
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:167
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:175
static ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:282
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:26
Default traits to be used in conjunction with the dual grid nodal index set.
Definition: dualgridindexset.hh:33
std::vector< T > NodalScvDataStorage
per default, we use dynamic data containers (iv size unknown)
Definition: dualgridindexset.hh:39
std::vector< T > NodalScvfDataStorage
Definition: dualgridindexset.hh:40
typename IndexTraits< GV >::LocalIndex LocalIndexType
Definition: dualgridindexset.hh:36
GV GridView
Definition: dualgridindexset.hh:34
typename IndexTraits< GV >::GridIndex GridIndexType
Definition: dualgridindexset.hh:35
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:46