12#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_CONNECTIVITY_MAP_HH
13#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_CONNECTIVITY_MAP_HH
17#include <dune/grid/common/partitionset.hh>
18#include <dune/grid/common/gridenums.hh>
28template<
class Gr
idGeometry>
31 using GridView =
typename GridGeometry::GridView;
33 using Stencil = std::vector<GridIndexType>;
34 using Map = std::vector<Stencil>;
39 void update(
const GridGeometry& gridGeometry)
42 map_.resize(gridGeometry.numScv());
44 auto fvGeometry =
localView(gridGeometry);
45 for (
const auto& element : elements(gridGeometry.gridView()))
47 assert(element.partitionType() == Dune::OverlapEntity || element.partitionType() == Dune::InteriorEntity);
49 fvGeometry.bind(element);
52 for (
const auto& scvf : scvfs(fvGeometry))
54 if(scvf.processorBoundary())
57 const auto& ownScv = fvGeometry.scv(scvf.insideScvIdx());
58 const auto ownDofIndex = ownScv.dofIndex();
59 const auto ownScvIndex = ownScv.index();
64 map_[ownScvIndex].push_back(scvf.outsideScvIdx());
68 for (
const auto& scv : scvs(fvGeometry))
70 const auto otherDofIndex = scv.dofIndex();
71 if (ownDofIndex != otherDofIndex)
72 map_[scv.index()].push_back(ownScvIndex);
85 map_[ownScvIndex].push_back(scvf.outsideScvIdx());
96 const auto& orthogonalScvf = fvGeometry.lateralOrthogonalScvf(scvf);
97 assert(orthogonalScvf.isLateral());
98 map_[ownScvIndex].push_back(orthogonalScvf.insideScvIdx());
99 if (!orthogonalScvf.boundary())
100 map_[ownScvIndex].push_back(orthogonalScvf.outsideScvIdx());
106 for (
auto& stencil : map_)
108 std::sort(stencil.begin(), stencil.end());
109 stencil.erase(std::unique(stencil.begin(), stencil.end()), stencil.end());
113 const Stencil&
operator[] (
const GridIndexType globalI)
const
114 {
return map_[globalI]; }
Stores the dof indices corresponding to the neighboring scvs that contribute to the derivative calcul...
Definition: facecentered/staggered/connectivitymap.hh:30
void update(const GridGeometry &gridGeometry)
Update the map and prepare the stencils.
Definition: facecentered/staggered/connectivitymap.hh:39
const Stencil & operator[](const GridIndexType globalI) const
Definition: facecentered/staggered/connectivitymap.hh:113
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27