78 void update(
const GridGeometry& gridGeometry)
81 map_.resize(gridGeometry.gridView().size(0));
84 Dune::ReservedVector<std::pair<GridIndexType, DataJ>, maxElemStencilSize> dataJForI;
85 auto fvGeometry =
localView(gridGeometry);
86 for (
const auto& element : elements(gridGeometry.gridView()))
89 const auto globalJ = gridGeometry.elementMapper().index(element);
90 fvGeometry.bindElement(element);
96 for (
auto&& scvf : scvfs(fvGeometry))
98 const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf);
101 for (
auto globalI : stencil)
103 if (globalI == globalJ)
106 auto it = std::find_if(dataJForI.begin(), dataJForI.end(),
107 [globalI](
const auto& pair) { return pair.first == globalI; });
109 if (it != dataJForI.end())
110 it->second.scvfsJ.push_back(scvf.index());
113 if (dataJForI.size() > maxElemStencilSize - 1)
114 DUNE_THROW(Dune::InvalidStateException,
"Maximum admissible stencil size (" << maxElemStencilSize-1
115 <<
") is surpassed (" << dataJForI.size() <<
"). "
116 <<
"Please adjust the GridGeometry traits accordingly!");
118 dataJForI.push_back(std::make_pair(globalI, DataJ({globalJ, {scvf.index()}, {}})));
123 for (
auto&& pair : dataJForI)
124 map_[pair.first].emplace_back(std::move(pair.second));